File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1751
1751
<key >variable </key >
1752
1752
<string >fork_on_clone </string >
1753
1753
</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 >
1754
1775
</array >
1755
1776
<key >version </key >
1756
1777
<string >0.9.4 </string >
Original file line number Diff line number Diff line change 9
9
[[ ! -e " $local_repo_folder " ]] && mkdir -p " $local_repo_folder "
10
10
cd " $local_repo_folder " || return 1
11
11
12
+ # validate depth, minimum 2
12
13
# WARN depth=2 ensures that amending a shallow commit does not result in a
13
14
# 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
15
17
16
18
# Open in terminal via Alfred
17
19
echo -n " $local_repo_folder /$reponame "
You can’t perform that action at this time.
0 commit comments