summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-09-09 02:32:24 -0700
committerJunio C Hamano <gitster@pobox.com>2007-09-09 02:32:24 -0700
commit57543a254c6aef8fca5556e25a9fa6dd5622b037 (patch)
tree022b6895b107d5c81e6b9a4f211c06ca5f1c17c0 /diff.c
parentd05ec5a064e402475ab48617213f2a619a2fabc5 (diff)
parent7b02b85a66fee6b357e02f9e70dd0baa0fd24308 (diff)
downloadgit-57543a254c6aef8fca5556e25a9fa6dd5622b037.tar.gz
Merge branch 'maint'
* maint: git-svn: understand grafts when doing dcommit git-diff: don't squelch the new SHA1 in submodule diffs git-svn: fix "Malformed network data" with svn:// servers (cvs|svn)import: Ask git-tag to overwrite old tags. Documentation / grammer nit
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 0d30d05263..1aca5df522 100644
--- a/diff.c
+++ b/diff.c
@@ -3144,6 +3144,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;
@@ -3175,10 +3191,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 {
/*