summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-01 06:22:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-02 10:24:46 (GMT)
commitb45563a229f5150271837cf487a91ddd8224fbd3 (patch)
treea0b363c225777490a4c22adaf280ea7ef69f7772 /cache.h
parent1c46ab1fada6eb449336a624995293cdd74f2b08 (diff)
downloadgit-b45563a229f5150271837cf487a91ddd8224fbd3.zip
git-b45563a229f5150271837cf487a91ddd8224fbd3.tar.gz
git-b45563a229f5150271837cf487a91ddd8224fbd3.tar.bz2
rename: Break filepairs with different types.
When we consider if a path has been totally rewritten, we did not touch changes from symlinks to files or vice versa. But a change that modifies even the type of a blob surely should count as a complete rewrite. While we are at it, modernise diffcore-break to be aware of gitlinks (we do not want to touch them). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index aaa135b..d0e7a71 100644
--- a/cache.h
+++ b/cache.h
@@ -192,6 +192,13 @@ enum object_type {
OBJ_MAX,
};
+static inline enum object_type object_type(unsigned int mode)
+{
+ return S_ISDIR(mode) ? OBJ_TREE :
+ S_ISGITLINK(mode) ? OBJ_COMMIT :
+ OBJ_BLOB;
+}
+
#define GIT_DIR_ENVIRONMENT "GIT_DIR"
#define GIT_WORK_TREE_ENVIRONMENT "GIT_WORK_TREE"
#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"