Re: [PATCH] rebase: use @{upstream} if no upstream specified
- From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
- Date
- Feb 9, 2011, 00:28 UTC
- Message-ID
- <alpine.DEB.2.00.1102081916330.9042@debian>
- In-Reply-To
- <20110208220505.GA17981@elie>
On Tue, 8 Feb 2011, Jonathan Nieder wrote:
Show 10 quoted lines
> Martin von Zweigbergk wrote: > > On Tue, 8 Feb 2011, Sverre Rabbelier wrote: > > >> I particularly like that you explain to the user clearly what they > >> have to do to make this work (e.g., configure the upstream). Nice. > > > > Thanks, but that was stolen from git-pull.sh ;-) > > Doesn't that suggest it might belong in some common git-upstream--lib.sh > (or git-sh-setup.sh)?
Maybe it does... For comparison, I pasted the two sections below.
git-rebase.sh (after my patch):
if test -z "$branch_name"
then
die "You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which upstream branch you want to use on the command
line and try again (e.g. 'git rebase <upstream branch>').
See git-rebase(1) for details."
else
die "You asked me to rebase without telling me which branch you
want to rebase against, and 'branch.${branch_name#refs/heads/}.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git rebase <upstream branch>').
See git-rebase(1) for details."
figit-pull.sh:
elif [ -z "$curr_branch" ]; then
echo "You are not currently on a branch, so I cannot use any"
echo "'branch.<branchname>.merge' in your configuration file."
echo "Please specify which remote branch you want to use on the command"
echo "line and try again (e.g. 'git pull <repository> <refspec>')."
echo "See git-pull(1) for details."
elif [ -z "$upstream" ]; then
echo "You asked me to pull without telling me which branch you"
echo "want to $op_type $op_prep, and 'branch.${curr_branch}.merge' in"
echo "your configuration file does not tell me, either. Please"
echo "specify which branch you want to use on the command line and"
echo "try again (e.g. 'git pull <repository> <refspec>')."
echo "See git-pull(1) for details."
echo
echo "If you often $op_type $op_prep the same branch, you may want to"
echo "use something like the following in your configuration file:"
echo
echo " [branch \"${curr_branch}\"]"
echo " remote = <nickname>"
echo " merge = <remote-ref>"
test rebase = "$op_type" &&
echo " rebase = true"
echo
echo " [remote \"<nickname>\"]"
echo " url = <url>"
echo " fetch = <refspec>"
echo
echo "See git-config(1) for details."I had forgotten that I trimmed the last part of it. Maybe I should have also included that? Then it would make even more sense to extract this piece of code.
/Martin