path: root/read-cache.c
diff options
authorDmitry Potapov <>2008-10-11 16:39:37 (GMT)
committerShawn O. Pearce <>2008-10-12 19:36:19 (GMT)
commit7e7abea96b8140c592a46293f5e33aae0683c7ac (patch)
tree316f1572ee0d7e51bae66b88a61a4120f1e34616 /read-cache.c
parent616ab43737558b4e589104432a16cf9f331ac457 (diff)
print an error message for invalid path
If verification of path failed, it is always better to print an error message saying this than relying on the caller function to print a meaningful error message (especially when the callee already prints error message for another situation). Because the callers of add_index_entry_with_check() did not print any error message, it resulted that the user would not notice the problem when checkout of an invalid path failed. Signed-off-by: Dmitry Potapov <> Signed-off-by: Shawn O. Pearce <>
Diffstat (limited to 'read-cache.c')
1 files changed, 4 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index d7900f3..6f344f3 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -608,8 +608,10 @@ struct cache_entry *make_cache_entry(unsigned int mode,
int size, len;
struct cache_entry *ce;
- if (!verify_path(path))
+ if (!verify_path(path)) {
+ error("Invalid path '%s'", path);
return NULL;
+ }
len = strlen(path);
size = cache_entry_size(len);
@@ -893,7 +895,7 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
if (!ok_to_add)
return -1;
if (!verify_path(ce->name))
- return -1;
+ return error("Invalid path '%s'", ce->name);
if (!skip_df_check &&
check_file_directory_conflict(istate, ce, pos, ok_to_replace)) {