git/branch: resolve implicit branch switch before using it
When switching a branch implicitly -- ie, creating a local branch off of a remote branch -- we would get the list of changed files before we would resolve the implicit branch switch, leading to an empty list of changes.
This commit is contained in:
parent
7f697e822b
commit
1da1ac52d2
1 changed files with 9 additions and 8 deletions
|
@ -37,6 +37,15 @@ if not if(test -e .git/$new)
|
|||
if not
|
||||
base=`{git/query HEAD}
|
||||
|
||||
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
|
||||
}
|
||||
modified=`$nl{git/query -c HEAD $base | grep '^[^-]' | subst '^..'}
|
||||
deleted=`$nl{git/query -c HEAD $base | grep '^-' | subst '^..'}
|
||||
|
||||
|
@ -49,14 +58,6 @@ if(~ $delete 1){
|
|||
echo 'deleted branch' $new
|
||||
exit
|
||||
}
|
||||
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(! base=`{git/query $baseref})
|
||||
die could not find branch $branch
|
||||
}
|
||||
commit=`{git/query $base} || die 'branch does not exist:' $base
|
||||
if(~ $new */*)
|
||||
mkdir -p .git/`{basename -d $new}
|
||||
|
|
Loading…
Reference in a new issue