shithub: git9

Download patch

ref: a1a84bb65a0a2e072230b62cffb8974e3e1af5a3
parent: eca3cfd8453c48dc76c6c2349c0bfe1c8bfa3368
author: Ori Bernstein <[email protected]>
date: Thu Jan 30 18:15:33 EST 2020

use the current branch for clone

not all repositories default to master.

--- a/clone
+++ b/clone
@@ -62,10 +62,12 @@
 		}
 	'} |[3] tr '\x0d' '\x0a' || die 'could not clone repository'
 
-	tree=/mnt/git/branch/heads/master/tree
+	tree=/mnt/git/HEAD/tree
+	lbranch=`{git/branch}
+	rbranch=`{echo $lbranch | sed 's@^heads@remotes/origin@'}
 	echo checking out repository...
-	if(test -f .git/refs/remotes/origin/master){
-		cp .git/refs/remotes/origin/master .git/refs/heads/master
+	if(test -f .git/refs/$rbranch){
+		cp .git/refs/$rbranch .git/refs/$lbranch
 		git/fs
 		@ {builtin cd $tree && tar cif /fd/1 .} | @ {tar xf /fd/0} \
 			|| die 'checkout failed:' $status