Skip to content

Commit

Permalink
add -i: add extra options at the right place in "diff" command line
Browse files Browse the repository at this point in the history
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 <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jun 23, 2013
1 parent 2cc0f53 commit e5c2909
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e5c2909

Please sign in to comment.