summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2021-08-13 05:16:50 +0000
committerOri Bernstein <ori@eigenstate.org>2021-08-13 05:16:50 +0000
commitda085a2d4cca788686b8f68b2555040cf29dc16c (patch)
tree5b93738237538077c224888a985f577c1bacb602
parent2af46e406bbd443ae10025777247798a685afc3c (diff)
downloadplan9front-da085a2d4cca788686b8f68b2555040cf29dc16c.tar.xz
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.
-rwxr-xr-xsys/src/cmd/git/branch4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/src/cmd/git/branch b/sys/src/cmd/git/branch
index 6693d7c4f..4646c3270 100755
--- a/sys/src/cmd/git/branch
+++ b/sys/src/cmd/git/branch
@@ -32,7 +32,7 @@ if not
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(~ $#newbr 0){
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 @@ if(! ~ $#deleted 0){
}
echo ref: $new > .git/HEAD
+echo $new: `{git/query $new}
exit ''