summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 70cc3d3)
raw | patch | inline | side by side (parent: 70cc3d3)
author | Elijah Newren <newren@gmail.com> | |
Fri, 12 Aug 2011 05:19:59 +0000 (23:19 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 14 Aug 2011 21:19:35 +0000 (14:19 -0700) |
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>
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>
merge-recursive.c | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index 99c38d55140604f2287835afca82c91d2bb29a60..a30e5a4449afb99a1e364d6b44c575cf784254e5 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
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));
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)