aboutsummaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2011-08-11 23:19:59 -0600
committerJunio C Hamano <gitster@pobox.com>2011-08-14 14:19:35 -0700
commitaacb82de3ff8ae7b0a9e4cfec16c1807b6c315ef (patch)
treef0d7c42d885f3eec2a693e110b8901f46f966491 /merge-recursive.c
parent70cc3d36eba58f8bf177c91d82781fb727a9a4fa (diff)
downloadgit-aacb82de3ff8ae7b0a9e4cfec16c1807b6c315ef.tar.gz
git-aacb82de3ff8ae7b0a9e4cfec16c1807b6c315ef.tar.xz
merge-recursive: Split was_tracked() out of would_lose_untracked()
Checking whether a filename was part of stage 0 or stage 2 is code that we would like to be able to call from a few other places without also lstat()-ing the file to see if it exists in the working copy. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 99c38d551..a30e5a444 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -621,7 +621,7 @@ static int dir_in_way(const char *path, int check_working_copy)
return check_working_copy && !lstat(path, &st) && S_ISDIR(st.st_mode);
}
-static int would_lose_untracked(const char *path)
+static int was_tracked(const char *path)
{
int pos = cache_name_pos(path, strlen(path));
@@ -638,11 +638,16 @@ static int would_lose_untracked(const char *path)
switch (ce_stage(active_cache[pos])) {
case 0:
case 2:
- return 0;
+ return 1;
}
pos++;
}
- return file_exists(path);
+ return 0;
+}
+
+static int would_lose_untracked(const char *path)
+{
+ return !was_tracked(path) && file_exists(path);
}
static int make_room_for_path(const char *path)