Skip to content

Commit e5c2909

Browse files
committed
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 <[email protected]>
1 parent 2cc0f53 commit e5c2909

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-add--interactive.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ sub parse_diff {
734734
my ($path) = @_;
735735
my @diff_cmd = split(" ", $patch_mode_flavour{DIFF});
736736
if (defined $diff_algorithm) {
737-
push @diff_cmd, "--diff-algorithm=${diff_algorithm}";
737+
splice @diff_cmd, 1, 0, "--diff-algorithm=${diff_algorithm}";
738738
}
739739
if (defined $patch_mode_revision) {
740740
push @diff_cmd, $patch_mode_revision;

0 commit comments

Comments
 (0)