diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-06-16 14:33:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-16 14:33:47 -0700 |
commit | dfb67594e964e63f20546361597c06432c73779d (patch) | |
tree | 3ea858127e139ee620a010f4ba82aa95b9fca77c /sha1_name.c | |
parent | Merge branch 'sb/test-bitmap-free-at-end' into maint (diff) | |
parent | dir: remove unused variable sb (diff) | |
download | tgif-dfb67594e964e63f20546361597c06432c73779d.tar.xz |
Merge branch 'rs/janitorial' into maint
Code clean-up.
* rs/janitorial:
dir: remove unused variable sb
clean: remove unused variable buf
use file_exists() to check if a file exists in the worktree
Diffstat (limited to 'sha1_name.c')
-rw-r--r-- | sha1_name.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sha1_name.c b/sha1_name.c index 6d10f052b5..6de8c87c8a 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -6,6 +6,7 @@ #include "tree-walk.h" #include "refs.h" #include "remote.h" +#include "dir.h" static int get_sha1_oneline(const char *, unsigned char *, struct commit_list *); @@ -1237,14 +1238,13 @@ static void diagnose_invalid_sha1_path(const char *prefix, const char *object_name, int object_name_len) { - struct stat st; unsigned char sha1[20]; unsigned mode; if (!prefix) prefix = ""; - if (!lstat(filename, &st)) + if (file_exists(filename)) die("Path '%s' exists on disk, but not in '%.*s'.", filename, object_name_len, object_name); if (errno == ENOENT || errno == ENOTDIR) { @@ -1271,7 +1271,6 @@ static void diagnose_invalid_index_path(int stage, const char *prefix, const char *filename) { - struct stat st; const struct cache_entry *ce; int pos; unsigned namelen = strlen(filename); @@ -1314,7 +1313,7 @@ static void diagnose_invalid_index_path(int stage, ce_stage(ce), filename); } - if (!lstat(filename, &st)) + if (file_exists(filename)) die("Path '%s' exists on disk, but not in the index.", filename); if (errno == ENOENT || errno == ENOTDIR) die("Path '%s' does not exist (neither on disk nor in the index).", |