git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] difftool: Change prompt to display the number of files in the diff queue

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 4, 2013, 20:18 UTC
Message-ID
<xmqq61r4l69h.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAPig+cTUB=UbY-j8mtz6QsvJKoA2T41u-wiR7Di596pM3t+k=Q@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 7 quoted lines
>> +       setenv ("GIT_DIFF_PATH_COUNTER", counterstr.buf, 1);
>> +       setenv ("GIT_DIFF_PATH_TOTAL", totalstr.buf, 1);
>> +
>>         retval = run_command_v_opt(spawn_arg, RUN_USING_SHELL);
>
> Would run_command_v_opt_cd_env() be more appropriate than setenv() +
> run_command_v_opt() done here?
Probably (besides, SPs after 'setenv' need to go).

Also, we know total/conter is a decimal integer. On-stack 32-byte arrays are sufficient and two strbufs are overkill ;-)

Show 15 quoted lines
>> diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh
>> index 8a30979..4935fc4 100755
>> --- a/t/t4020-diff-external.sh
>> +++ b/t/t4020-diff-external.sh
>> @@ -193,6 +193,22 @@ test_expect_success 'GIT_EXTERNAL_DIFF with more than one changed files' '
>>         GIT_EXTERNAL_DIFF=echo git diff
>>  '
>>
>> +echo "#!$SHELL_PATH" >external-diff.sh
>> +cat >> external-diff.sh <<\EOF
>> +echo $GIT_DIFF_PATH_COUNTER of $GIT_DIFF_PATH_TOTAL >>counter.txt
>> +EOF
>> +chmod a+x external-diff.sh
>
> Perhaps write_script()?
Definitely.
Thanks, both.
Previous: Eric Sunshine
Message 3 of 3 in “difftool: Change prompt to display the number of files in the diff queue”
  1. difftool: Change prompt to display the number of files in the diff queueZoltan Klinger, Dec 4, 2013
  2. Eric SunshineDec 4, 2013
  3. Junio C HamanoDec 4, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.