ref: da085a2d4cca788686b8f68b2555040cf29dc16c
parent: 2af46e406bbd443ae10025777247798a685afc3c
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Aug 13 01:16:50 EDT 2021
git/branch: make '-n' use HEAD when '-b' unspecified This brings the behavior in line with the manual page, and makes things less surprising for users.
--- a/sys/src/cmd/git/branch
+++ b/sys/src/cmd/git/branch
@@ -32,7 +32,7 @@
orig=`{git/query HEAD}
if (~ $#baseref 1)
base=`{git/query $baseref} || exit 'bad base'
-if not if(test -e .git/$new)
+if not if(~ $#newbr 0)
base=`{git/query $new}
if not
base=`{git/query HEAD}
@@ -41,7 +41,6 @@
if(! ~ $#baseref 0)
die update would clobber $branch with $baseref
baseref=`$nl{echo -n $new | sed s@refs/heads/@refs/remotes/origin/@}
- echo $baseref
if(! test -e .git/$new)
if(! base=`{git/query $baseref})
die could not find branch $branch
@@ -119,4 +118,5 @@
}
echo ref: $new > .git/HEAD
+echo $new: `{git/query $new}
exit ''