summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 616ab43)
raw | patch | inline | side by side (parent: 616ab43)
author | Dmitry Potapov <dpotapov@gmail.com> | |
Sat, 11 Oct 2008 16:39:37 +0000 (20:39 +0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 12 Oct 2008 19:36:19 +0000 (12:36 -0700) |
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 <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
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 <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-update-index.c | patch | blob | history | |
read-cache.c | patch | blob | history |
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 417f9724abdce3c49df316505eff1019126a5058..3a2291b03e23fbcf6b8dc6fffedd4d7dcf072aaa 100644 (file)
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
struct cache_entry *ce;
if (!verify_path(path))
- return -1;
+ return error("Invalid path '%s'", path);
len = strlen(path);
size = cache_entry_size(len);
diff --git a/read-cache.c b/read-cache.c
index d7900f33ea472e6781ba68b3943cb29ae0a1db34..6f344f345d09b36e379cbc8beb2c3992c6d5809c 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
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)) {