From 9e5da3d055c558fc6492d3b996736ff7e8d115c3 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 17 Jan 2019 11:27:11 -0500 Subject: add: use separate ADD_CACHE_RENORMALIZE flag Commit 9472935d81 (add: introduce "--renormalize", 2017-11-16) taught git-add to pass HASH_RENORMALIZE to add_to_index(), which then passes the flag along to index_path(). However, the flags taken by add_to_index() and the ones taken by index_path() are distinct namespaces. We cannot take HASH_* flags in add_to_index(), because they overlap with the ADD_CACHE_* flags we already take (in this case, HASH_RENORMALIZE conflicts with ADD_CACHE_IGNORE_ERRORS). We can solve this by adding a new ADD_CACHE_RENORMALIZE flag, and using it to set HASH_RENORMALIZE within add_to_index(). In order to make it clear that these two flags come from distinct sets, let's also change the name "newflags" in the function to "hash_flags". Reported-by: Dmitriy Smirnov Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/add.c') diff --git a/builtin/add.c b/builtin/add.c index 0b64bcdebe..95a7ec126e 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -137,7 +137,7 @@ static int renormalize_tracked_files(const struct pathspec *pathspec, int flags) continue; /* do not touch non blobs */ if (pathspec && !ce_path_match(&the_index, ce, pathspec, NULL)) continue; - retval |= add_file_to_cache(ce->name, flags | HASH_RENORMALIZE); + retval |= add_file_to_cache(ce->name, flags | ADD_CACHE_RENORMALIZE); } return retval; -- cgit v1.2.3