File tree 2 files changed +34
-2
lines changed
2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change 1755
1755
<key >config </key >
1756
1756
<dict >
1757
1757
<key >default </key >
1758
- <string >2 </string >
1758
+ <string >5 </string >
1759
1759
<key >placeholder </key >
1760
1760
<string ></string >
1761
1761
<key >required </key >
1772
1772
<key >variable </key >
1773
1773
<string >clone_depth </string >
1774
1774
</dict >
1775
+ <dict >
1776
+ <key >config </key >
1777
+ <dict >
1778
+ <key >default </key >
1779
+ <false />
1780
+ <key >required </key >
1781
+ <false />
1782
+ <key >text </key >
1783
+ <string >restore mtime </string >
1784
+ </dict >
1785
+ <key >description </key >
1786
+ <string ></string >
1787
+ <key >label </key >
1788
+ <string ></string >
1789
+ <key >type </key >
1790
+ <string >checkbox </string >
1791
+ <key >variable </key >
1792
+ <string >restore_mtime </string >
1793
+ </dict >
1775
1794
</array >
1776
1795
<key >version </key >
1777
1796
<string >0.10.1 </string >
Original file line number Diff line number Diff line change @@ -13,16 +13,29 @@ cd "$local_repo_folder" || return 1
13
13
# WARN depth=2 ensures that amending a shallow commit does not result in a
14
14
# new commit without parent, effectively destroying git history (!!)
15
15
[[ $clone_depth =~ ^[0-9]+$ && $clone_depth -ge 2 ]] || clone_depth=2
16
+
16
17
git clone --depth=" $clone_depth " " $url " --no-single-branch --no-tags # get branches, but not tags
17
18
18
19
# Open in terminal via Alfred
19
20
echo -n " $local_repo_folder /$reponame "
20
21
22
+ # ───────────────────────────────────────────────────────────────────────────────
23
+ # RESTORE MTIME
24
+
25
+ cd " $reponame " || return 1
26
+
27
+ # https://stackoverflow.com/a/36243002/22114136
28
+ if [[ " $restore_mtime " == " 1" ]]; then
29
+ for file in $( git ls-tree -r -t --full-name --name-only HEAD) ; do
30
+ timestamp=$( git log --pretty=format:%cd --date=format:%Y%m%d%H%M.%S -1 HEAD -- " $file " )
31
+ touch -t " $timestamp " " $file "
32
+ done
33
+ fi
34
+
21
35
# ───────────────────────────────────────────────────────────────────────────────
22
36
# FORK ON CLONE (if owner)
23
37
24
38
if [[ " $ownerOfRepo " != " 1" && " $fork_on_clone " == " 1" ]]; then
25
- cd " $reponame " || return 1
26
39
if [[ ! -x " $( command -v gh) " ]]; then print " \` gh\` not installed." && return 1; fi
27
40
28
41
gh repo fork --remote=false
You can’t perform that action at this time.
0 commit comments