From: Martin von Zweigbergk Date: Wed, 09 Feb 2011 00:28:41 GMT Subject: Re: [PATCH] rebase: use @{upstream} if no upstream specified Message-ID: In-Reply-To: <20110208220505.GA17981@elie> On Tue, 8 Feb 2011, Jonathan Nieder wrote: > 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..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 '). 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 '). See git-rebase(1) for details." fi git-pull.sh: elif [ -z "$curr_branch" ]; then echo "You are not currently on a branch, so I cannot use any" echo "'branch..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 ')." 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 ')." 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 = " echo " merge = " test rebase = "$op_type" && echo " rebase = true" echo echo " [remote \"\"]" echo " url = " echo " fetch = " 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