From: Junio C Hamano Date: Sun, 23 Jun 2013 19:19:05 +0000 (-0700) Subject: add -i: add extra options at the right place in "diff" command line X-Git-Tag: v1.8.4-rc0~111^2 X-Git-Url: http://git.bitbasher.net/?a=commitdiff_plain;h=e5c29097826be86e2f18139491cdf9c830c7fa3e;p=git.git add -i: add extra options at the right place in "diff" command line Appending "--diff-algorithm=histogram" at the end of canned command line for various modes of "diff" is correct for most of them but not for "stash" that has a non-option already wired in, like so: 'stash' => { DIFF => 'diff-index -p HEAD', Appending an extra option after non-option may happen to work due to overly lax command line parser, but that is not something we should rely on. Instead, splice in the extra argument immediately after the command name (i.e. 'diff-index', 'diff-files', etc.). Signed-off-by: Junio C Hamano --- diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 531095916f..75a991f7ec 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -734,7 +734,7 @@ sub parse_diff { my ($path) = @_; my @diff_cmd = split(" ", $patch_mode_flavour{DIFF}); if (defined $diff_algorithm) { - push @diff_cmd, "--diff-algorithm=${diff_algorithm}"; + splice @diff_cmd, 1, 0, "--diff-algorithm=${diff_algorithm}"; } if (defined $patch_mode_revision) { push @diff_cmd, $patch_mode_revision;