Skip to content

Commit 652ca8e

Browse files
committed
feat: setting to change cloning depth
1 parent 6528d00 commit 652ca8e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

info.plist

+21
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,27 @@
17511751
<key>variable</key>
17521752
<string>fork_on_clone</string>
17531753
</dict>
1754+
<dict>
1755+
<key>config</key>
1756+
<dict>
1757+
<key>default</key>
1758+
<string>2</string>
1759+
<key>placeholder</key>
1760+
<string></string>
1761+
<key>required</key>
1762+
<false/>
1763+
<key>trim</key>
1764+
<true/>
1765+
</dict>
1766+
<key>description</key>
1767+
<string>Depth of the clone (`--shallow={n}`)</string>
1768+
<key>label</key>
1769+
<string></string>
1770+
<key>type</key>
1771+
<string>textfield</string>
1772+
<key>variable</key>
1773+
<string>clone_depth</string>
1774+
</dict>
17541775
</array>
17551776
<key>version</key>
17561777
<string>0.9.4</string>

scripts/clone-repo.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ url="[email protected]:$source_repo.git" # use SSH instead of https
99
[[ ! -e "$local_repo_folder" ]] && mkdir -p "$local_repo_folder"
1010
cd "$local_repo_folder" || return 1
1111

12+
# validate depth, minimum 2
1213
# WARN depth=2 ensures that amending a shallow commit does not result in a
1314
# new commit without parent, effectively destroying git history (!!)
14-
git clone --depth=2 "$url" --no-single-branch --no-tags # get branches, but not tags
15+
[[ $clone_depth =~ ^[0-9]+$ && $clone_depth -ge 2 ]] || clone_depth=2
16+
git clone --depth="$clone_depth" "$url" --no-single-branch --no-tags # get branches, but not tags
1517

1618
# Open in terminal via Alfred
1719
echo -n "$local_repo_folder/$reponame"

0 commit comments

Comments
 (0)