summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2015-05-19 23:44:23 +0200
committerJunio C Hamano <gitster@pobox.com>2015-05-20 13:49:10 -0700
commitdbe44faadb87f88e092f3dac387f96070268137a (patch)
treec110408d6bae73334427aaec8010bdb2e754e69d /merge-recursive.c
parentaaa7e0d7f8f003c0c8ab34f959083f6d191d44ca (diff)
downloadgit-dbe44faadb87f88e092f3dac387f96070268137a.tar.gz
use file_exists() to check if a file exists in the worktree
Call file_exists() instead of open-coding it. That's shorter, simpler and the intent becomes clearer. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 1c9c30db6c..44d85bea4b 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -611,7 +611,6 @@ static char *unique_path(struct merge_options *o, const char *path, const char *
{
struct strbuf newpath = STRBUF_INIT;
int suffix = 0;
- struct stat st;
size_t base_len;
strbuf_addf(&newpath, "%s~", path);
@@ -620,7 +619,7 @@ static char *unique_path(struct merge_options *o, const char *path, const char *
base_len = newpath.len;
while (string_list_has_string(&o->current_file_set, newpath.buf) ||
string_list_has_string(&o->current_directory_set, newpath.buf) ||
- lstat(newpath.buf, &st) == 0) {
+ file_exists(newpath.buf)) {
strbuf_setlen(&newpath, base_len);
strbuf_addf(&newpath, "_%d", suffix++);
}