File tree 2 files changed +30
-5
lines changed
2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -1832,6 +1832,27 @@ end run</string>
1832
1832
<key >variable </key >
1833
1833
<string >fork_on_clone </string >
1834
1834
</dict >
1835
+ <dict >
1836
+ <key >config </key >
1837
+ <dict >
1838
+ <key >default </key >
1839
+ <string ></string >
1840
+ <key >placeholder </key >
1841
+ <string >dev </string >
1842
+ <key >required </key >
1843
+ <false />
1844
+ <key >trim </key >
1845
+ <true />
1846
+ </dict >
1847
+ <key >description </key >
1848
+ <string >Branch: If this branch exists, will switch to it after cloning. Leave empty to disable. </string >
1849
+ <key >label </key >
1850
+ <string ></string >
1851
+ <key >type </key >
1852
+ <string >textfield </string >
1853
+ <key >variable </key >
1854
+ <string >default_branch </string >
1855
+ </dict >
1835
1856
<dict >
1836
1857
<key >config </key >
1837
1858
<dict >
Original file line number Diff line number Diff line change 25
25
# Open in terminal via Alfred
26
26
echo -n " $local_repo_folder /$reponame "
27
27
28
+ cd " $reponame " || return 1
29
+
28
30
# ───────────────────────────────────────────────────────────────────────────────
29
- # RESTORE MTIME
30
31
31
- cd " $reponame " || return 1
32
+ # SWITCH TO DEFAULT BRANCH
33
+ if [[ -n " $default_branch " ]]; then
34
+ # `git switch` fails silently if the branch does not exist
35
+ git switch " $default_branch " & > /dev/null
36
+ fi
32
37
33
- # https://stackoverflow.com/a/36243002/22114136
38
+ # RESTORE MTIME
34
39
if [[ " $restore_mtime " == " 1" ]]; then
40
+ # https://stackoverflow.com/a/36243002/22114136
35
41
git ls-tree -r -t --full-name --name-only HEAD | while read -r file; do
36
42
timestamp=$( git log --pretty=format:%cd --date=format:%Y%m%d%H%M.%S -1 HEAD -- " $file " )
37
43
touch -t " $timestamp " " $file "
38
44
done
39
45
fi
40
46
41
- # ───────────────────────────────────────────────────────────────────────────────
42
47
# FORK ON CLONE (if not owner)
43
-
44
48
# INFO Alfred stores checkbox settings as `"1"` or `"0"`, and variables in stringified form.
45
49
if [[ " $ownerOfRepo " != " true" && " $fork_on_clone " == " 1" ]]; then
46
50
if [[ ! -x " $( command -v gh) " ]]; then print " \` gh\` not installed." && return 1; fi
You can’t perform that action at this time.
0 commit comments