summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a1d4aa7)
raw | patch | inline | side by side (parent: a1d4aa7)
author | Amos Waterland <apw@rossby.metr.ou.edu> | |
Thu, 1 Sep 2005 14:13:50 +0000 (09:13 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 2 Sep 2005 04:45:00 +0000 (21:45 -0700) |
If somebody tries to run `git update-cache foo', where foo is a new
file, git dies with a rather cryptic error message:
fatal: Unable to add foo to database
This trivial patch makes git explain what probably went wrong. It is
not a perfect diagnosis of all error paths, but for 90% of the cases it
should provide the user with the clue they need.
[jc: I ended up wording slightly differently, and fixed another
confusing error message I noticed while reviewing the code.]
Signed-off-by: Amos Waterland <apw@rossby.metr.ou.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
file, git dies with a rather cryptic error message:
fatal: Unable to add foo to database
This trivial patch makes git explain what probably went wrong. It is
not a perfect diagnosis of all error paths, but for 90% of the cases it
should provide the user with the clue they need.
[jc: I ended up wording slightly differently, and fixed another
confusing error message I noticed while reviewing the code.]
Signed-off-by: Amos Waterland <apw@rossby.metr.ou.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
update-cache.c | patch | blob | history |
diff --git a/update-cache.c b/update-cache.c
index 63815ed658e9c2007938309458444b218c330d68..3d1fd2be7593ac832e40c3f64b207d2bf5318e39 100644 (file)
--- a/update-cache.c
+++ b/update-cache.c
if (allow_remove)
return remove_file_from_cache(path);
}
- return error("open(\"%s\"): %s", path, strerror(errno));
+ if (0 == status)
+ return error("%s: is a directory", path);
+ else
+ return error("lstat(\"%s\"): %s", path,
+ strerror(errno));
}
namelen = strlen(path);
size = cache_entry_size(namelen);
continue;
}
if (add_file_to_cache(path))
- die("Unable to add %s to database", path);
+ die("Unable to add %s to database; maybe you want to use --add option?", path);
}
if (write_cache(newfd, active_cache, active_nr) ||
commit_index_file(&cache_file))