|
|
|
@ -1664,11 +1664,12 @@ static void diagnose_invalid_oid_path(const char *prefix,
@@ -1664,11 +1664,12 @@ static void diagnose_invalid_oid_path(const char *prefix,
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Must be called only when :stage:filename doesn't exist. */ |
|
|
|
|
static void diagnose_invalid_index_path(struct index_state *istate, |
|
|
|
|
static void diagnose_invalid_index_path(struct repository *r, |
|
|
|
|
int stage, |
|
|
|
|
const char *prefix, |
|
|
|
|
const char *filename) |
|
|
|
|
{ |
|
|
|
|
struct index_state *istate = r->index; |
|
|
|
|
const struct cache_entry *ce; |
|
|
|
|
int pos; |
|
|
|
|
unsigned namelen = strlen(filename); |
|
|
|
@ -1708,7 +1709,7 @@ static void diagnose_invalid_index_path(struct index_state *istate,
@@ -1708,7 +1709,7 @@ static void diagnose_invalid_index_path(struct index_state *istate,
|
|
|
|
|
ce_stage(ce), filename); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (file_exists(filename)) |
|
|
|
|
if (repo_file_exists(r, filename)) |
|
|
|
|
die("Path '%s' exists on disk, but not in the index.", filename); |
|
|
|
|
if (is_missing_file_error(errno)) |
|
|
|
|
die("Path '%s' does not exist (neither on disk nor in the index).", |
|
|
|
@ -1814,7 +1815,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
@@ -1814,7 +1815,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
|
|
|
|
|
pos++; |
|
|
|
|
} |
|
|
|
|
if (only_to_die && name[1] && name[1] != '/') |
|
|
|
|
diagnose_invalid_index_path(repo->index, stage, prefix, cp); |
|
|
|
|
diagnose_invalid_index_path(repo, stage, prefix, cp); |
|
|
|
|
free(new_path); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|