Hello Johannes,
W dniu 01.09.2016 o 15:33, Johannes Schindelin pisze:
> On Wed, 31 Aug 2016, Jakub Narębski wrote:
>> W dniu 29.08.2016 o 10:06, Johannes Schindelin pisze:
>>> @@ -471,17 +487,20 @@ int sequencer_commit(const char *defmsg, struct
>>> replay_opts *opts,
>>>
>>> if (IS_REBASE_I()) {
>>> env = read_author_script();
>>> - if (!env)
>>> + if (!env) {
>>> + const char *gpg_opt = gpg_sign_opt_quoted(opts);
>>> +
>>> return error("You have staged changes in your working "
>>> "tree. If these changes are meant to be\n"
>>> "squashed into the previous commit, run:\n\n"
>>> - " git commit --amend $gpg_sign_opt_quoted\n\n"
>>
>> How did this get expanded by error(), and why we want to replace
>> it if it works?
After writing this email, I got an idea on how it could work:
git-rebase script calls some C helper, which outputs above, and
output of this helper is eval'ed by script (with gpg_sign_opt_quoted
variable present in the environment)...
>
> It did not work. It was a place-holder waiting for this patch ;-)
>
... but it might have been simply copy'n'pasted from shell script
to C, literally.
>>
>>> + " git commit --amend %s\n\n"
>>> "If they are meant to go into a new commit, "
>>> "run:\n\n"
>>> - " git commit $gpg_sign_opt_quoted\n\n"
>>> + " git commit %s\n\n"
>>> "In both case, once you're done, continue "
>>> "with:\n\n"
>>> - " git rebase --continue\n");
>>> + " git rebase --continue\n", gpg_opt, gpg_opt);
>>
>> Instead of passing option twice, why not make use of %1$s (arg reordering),
>> that is
>>
>> + " git commit --amend %1$s\n\n"
>> [...]
>> + " git commit %1$s\n\n"
>
> Cute. But would this not drive the l10ners insane?
>
Shouldn't, as l10ners need to deal with arg reordering, because in different
languages the order of words might be different: %s %s in English may be
%2$s %1$s in other language, see example in
https://www.gnu.org/software/gettext/manual/gettext.html#c_002dformat-Flag
Best,
--
Jakub Narębski