From 67574c403f1e27660bbd0348b81b31adc9889b20 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 1 Jun 2005 11:38:07 -0700 Subject: [PATCH] diff: mode bits fixes The core GIT repository has trees that record regular file mode in 0664 instead of normalized 0644 pattern. Comparing such a tree with another tree that records the same file in 0644 pattern without content changes with git-diff-tree causes it to feed otherwise unmodified pairs to the diff_change() routine, which triggers a sanity check routine and barfs. This patch fixes the problem, along with the fix to another caller that uses unnormalized mode bits to call diff_change() routine in a similar way. Without this patch, you will see "fatal error" from diff-tree when you run git-deltafy-script on the core GIT repository itself. Signed-off-by: Junio C Hamano Signed-off-by: Linus Torvalds --- diff.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'diff.h') diff --git a/diff.h b/diff.h index 0f1ed5877a..3fcf7010e3 100644 --- a/diff.h +++ b/diff.h @@ -4,6 +4,10 @@ #ifndef DIFF_H #define DIFF_H +#define DIFF_FILE_CANON_MODE(mode) \ + (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \ + S_ISLNK(mode) ? S_IFLNK : S_IFDIR) + extern void diff_addremove(int addremove, unsigned mode, const unsigned char *sha1, -- cgit v1.2.1