aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-09-10 11:32:58 -0700
committerJunio C Hamano <gitster@pobox.com>2007-09-10 11:32:58 -0700
commitddb95de33e99d547c3b533aea12f18c9e4dd649e (patch)
treeb9d745e3dc1cdd91b0bc938ce104808b2f2db42a /diff.c
parent5242bcbb638f031818e9ebd4467c8e55d5a06bfb (diff)
parent6972ab7ae10a205bbc05b98408a36403915a9c39 (diff)
downloadgit-ddb95de33e99d547c3b533aea12f18c9e4dd649e.tar.gz
git-ddb95de33e99d547c3b533aea12f18c9e4dd649e.tar.xz
Merge branch 'master' into ph/strbuf
* master: archive - leakfix for format_subst() Make --no-thin the default in git-push to save server resources fix doc for --compression argument to pack-objects git-tag -s must fail if gpg cannot sign the tag. git-svn: understand grafts when doing dcommit git-diff: don't squelch the new SHA1 in submodule diffs Define NO_MEMMEM on Darwin as it lacks the function git-svn: fix "Malformed network data" with svn:// servers (cvs|svn)import: Ask git-tag to overwrite old tags. git-rebase: fix -C option git-rebase: support --whitespace=<option> Documentation / grammer nit archive: rename attribute specfile to export-subst archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR" (take 2) add memmem() Remove unused function convert_sha1_file() archive: specfile support (--pretty=format: in archive files) Export format_commit_message()
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/diff.c b/diff.c
index c054b234b..26d7bb96b 100644
--- a/diff.c
+++ b/diff.c
@@ -3135,6 +3135,22 @@ static void diffcore_apply_filter(const char *filter)
*q = outq;
}
+/* Check whether two filespecs with the same mode and size are identical */
+static int diff_filespec_is_identical(struct diff_filespec *one,
+ struct diff_filespec *two)
+{
+ if (S_ISGITLINK(one->mode)) {
+ diff_fill_sha1_info(one);
+ diff_fill_sha1_info(two);
+ return !hashcmp(one->sha1, two->sha1);
+ }
+ if (diff_populate_filespec(one, 0))
+ return 0;
+ if (diff_populate_filespec(two, 0))
+ return 0;
+ return !memcmp(one->data, two->data, one->size);
+}
+
static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
{
int i;
@@ -3166,10 +3182,7 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
diff_populate_filespec(p->one, 1) ||
diff_populate_filespec(p->two, 1) ||
(p->one->size != p->two->size) ||
-
- diff_populate_filespec(p->one, 0) || /* (2) */
- diff_populate_filespec(p->two, 0) ||
- memcmp(p->one->data, p->two->data, p->one->size))
+ !diff_filespec_is_identical(p->one, p->two)) /* (2) */
diff_q(&outq, p);
else {
/*