ref: aa5f3ddd8b95b9b952ac914ad0fa4b3e6692d043
parent: a45630c13680de2884d05ac63105ee78875a4021
author: mia soweli <mia@soweli.net>
date: Sat Aug 9 14:10:47 EDT 2025
git/branch: don't clobber baseref when checking if we have an upstream branch if we assign baseref before checking if we already have the local branch, we end up querying for the branch at the origin. this is not fine if we are trying to switch to a local branch that is not present there.
--- a/sys/src/cmd/git/branch
+++ b/sys/src/cmd/git/branch
@@ -40,10 +40,11 @@
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/@}
- if(! test -e .git/$new)
+ if(! test -e .git/$new){
+ baseref=`$nl{echo -n $new | sed s@refs/heads/@refs/remotes/origin/@}
if(! base=`{git/query $baseref})
exit 'bad ref'
+ }
}
# figure out where we want the new branch to point to
--
⑨