Teach git-diff-files the new option --no-index
With this flag and given two paths, git-diff-files behaves as a GNU diff
lookalike (plus the git goodies like --check, colour, etc.). This flag
is also available in git-diff. It also works outside of a git repository.
In addition, if git-diff{,-files} is called without revision or stage
parameter, and with exactly two paths at least one of which is not tracked,
the default is --no-index.
So, you can now say
git diff /etc/inittab /etc/fstab
and it actually works!
This also unifies the duplicated argument parsing between cmd_diff_files()
and builtin_diff_files().
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
committed by
Junio C Hamano
parent
f5a9264769
commit
d516c2d119
3
diff.c
3
diff.c
@ -2406,7 +2406,8 @@ static void diff_resolve_rename_copy(void)
|
||||
p->status = DIFF_STATUS_RENAMED;
|
||||
}
|
||||
else if (hashcmp(p->one->sha1, p->two->sha1) ||
|
||||
p->one->mode != p->two->mode)
|
||||
p->one->mode != p->two->mode ||
|
||||
is_null_sha1(p->one->sha1))
|
||||
p->status = DIFF_STATUS_MODIFIED;
|
||||
else {
|
||||
/* This is a "no-change" entry and should not
|
||||
|
||||
Reference in New Issue
Block a user