Re: [PATCH 19/51] i18n: git-pull "rebase against" / "merge with" messages
- From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
- Date
- Apr 3, 2011, 17:33 UTC
- Message-ID
- <alpine.DEB.2.00.1104031314520.25129@debian>
- In-Reply-To
- <1301849175-1697-20-git-send-email-avarab@gmail.com>
On Sun, 3 Apr 2011, ?var Arnfj?r? Bjarmason wrote:
> Gettextize the two messages that used "rebase against" and "merge > with". Split them into two depending on whether we are rebasing or not.
I think this conflicts a lot with my 15a147e (rebase: use @{upstream} if no upstream specified, 2011-02-09), which factored out most or all of the code touched in your patch a reused it in git-rebase.sh. I remember thinking about i18n at some point while extracting that code, but then I forgot about it. I have inlcluded the relevant part of that patch below for your reference. As you can see, I added another variable $cmd that is either "pull" or "rebase". It is used in plain text because the command matches the verb in English, but I guess that may not be ideal in all translations. Maybe we extract some parts of the message, so we don't have to make four nearly identical copies of the message... I don't have any concrete suggestion right now, though.
+error_on_missing_default_upstream () {
+ cmd="$1"
+ op_type="$2"
+ op_prep="$3"
+ example="$4"
+ branch_name=$(git symbolic-ref -q HEAD)
+ if test -z "$branch_name"
+ then
+ echo "You are not currently on a branch, so I cannot use any
+'branch.<branchname>.merge' in your configuration file.
+Please specify which branch you want to $op_type $op_prep on the command
+line and try again (e.g. '$example').
+See git-${cmd}(1) for details."
+ else
+ echo "You asked me to $cmd without telling me which branch you
+want to $op_type $op_prep, 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. '$example').
+See git-${cmd}(1) for details.
+
+If you often $op_type $op_prep the same branch, you may want to
+use something like the following in your configuration file:
+ [branch \"${branch_name#refs/heads/}\"]
+ remote = <nickname>
+ merge = <remote-ref>"
+ test rebase = "$op_type" &&
+ echo " rebase = true"
+ echo "
+ [remote \"<nickname>\"]
+ url = <url>
+ fetch = <refspec>
+
+See git-config(1) for details."
+ fi
+ exit 1
+}