From 4130b99571903fb93e4c6e0d6677be7b6b986426 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 26 May 2005 02:24:30 -0700 Subject: [PATCH] Diff updates to express type changes With the introduction of type 'T' in the diff-raw output, and the "apply-patch" program Linus has been quietly working on without much advertisement, it started to make sense to emit usable information in the "diff --git" patch output format as well. Earlier built-in diff driver punted and did not say anything about a symbolic link changing into a file or vice versa, but this version represents it as a pair of deletion and creation. It also fixes a minor problem dealing with old archive created with ancient git. The earlier code was reporting file mode change between 100664 and 100644 (we shouldn't). The linux-2.6 git tree has a good example that exposes this problem. A good test case is commit ce1dc02f76432a46db149241e015a4f782974623. Signed-off-by: Junio C Hamano Signed-off-by: Linus Torvalds --- diffcore.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'diffcore.h') diff --git a/diffcore.h b/diffcore.h index 092eecce23..ee1955bf38 100644 --- a/diffcore.h +++ b/diffcore.h @@ -48,6 +48,12 @@ struct diff_filepair { #define DIFF_PAIR_TYPE_CHANGED(p) \ ((S_IFMT & (p)->one->mode) != (S_IFMT & (p)->two->mode)) +#define DIFF_PAIR_MODE_CHANGED(p) ((p)->one->mode != (p)->two->mode) + +#define DIFF_FILE_CANON_MODE(mode) \ + (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \ + S_ISLNK(mode) ? S_IFLNK : S_IFDIR) + extern int diff_unmodified_pair(struct diff_filepair *); struct diff_queue_struct { -- cgit v1.2.3