X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=update-cache.c;h=3d1fd2be7593ac832e40c3f64b207d2bf5318e39;hb=78938b0d8a95b09d94af214fdb6b5f053a5edb98;hp=1fcc59a9c005e154c09731f25b7a99389dca2733;hpb=638ccfdf0eeabf3d985426308b2a82db6207ae28;p=git.git diff --git a/update-cache.c b/update-cache.c index 1fcc59a9..3d1fd2be 100644 --- a/update-cache.c +++ b/update-cache.c @@ -53,7 +53,11 @@ static int add_file_to_cache(char *path) 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); @@ -321,6 +325,7 @@ int main(int argc, char **argv) { int i, newfd, entries, has_errors = 0; int allow_options = 1; + const char *prefix = setup_git_directory(); newfd = hold_index_file_for_update(&cache_file, get_index_file()); if (newfd < 0) @@ -381,6 +386,7 @@ int main(int argc, char **argv) } die("unknown option %s", path); } + path = prefix_path(prefix, prefix ? strlen(prefix) : 0, path); if (!verify_path(path)) { fprintf(stderr, "Ignoring path %s\n", argv[i]); continue; @@ -391,7 +397,7 @@ int main(int argc, char **argv) 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))