@ -6,6 +6,7 @@
@@ -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,
@@ -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,
@@ -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,
@@ -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).",