[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 <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Junio C Hamano
2005-06-01 11:38:07 -07:00
committed by Linus Torvalds
parent 81bb573ed8
commit 67574c403f
5 changed files with 17 additions and 15 deletions

View File

@ -88,7 +88,7 @@ int main(int argc, const char **argv)
for (i = 0; i < entries; i++) {
struct stat st;
unsigned int oldmode, mode;
unsigned int oldmode;
struct cache_entry *ce = active_cache[i];
int changed;
@ -116,10 +116,8 @@ int main(int argc, const char **argv)
continue;
oldmode = ntohl(ce->ce_mode);
mode = (S_ISLNK(st.st_mode) ? S_IFLNK :
S_IFREG | ce_permissions(st.st_mode));
show_modified(oldmode, mode, ce->sha1, null_sha1,
show_modified(oldmode, DIFF_FILE_CANON_MODE(st.st_mode),
ce->sha1, null_sha1,
ce->name);
}
diffcore_std((1 < argc) ? argv + 1 : NULL,