Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:59:23

Eric Sunshine [off-list ref] writes:
quoted
+       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 ;-)
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help