@matheusbsbs / matheus-bagliano / commits / 790fa0e297
Fork 0

update-index: make D/F conflict error a bit more verbose.

When you remove a directory D that has a tracked file D/F out of the way to create a file D and try to "git update-index --add D", it used to say "cannot add" which was not very helpful. This issues an extra error message to explain the situation before the final "fatal" message. Since D/F conflicts are relatively rare event, extra verbosity would not make things too noisy. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Dec 16, 2006 at 16:23 UTC 790fa0e297b41b9e8c98a77b58004c58408e5f7a
1 file changed +1 -1
read-cache.c
+1 -1
@@ -609,7 +609,7 @@ int add_cache_entry(struct cache_entry *ce, int option)
609 if (!skip_df_check &&
610 check_file_directory_conflict(ce, pos, ok_to_replace)) {
611 if (!ok_to_replace)
612 - return -1;
612 + return error("'%s' appears as both a file and as a directory", ce->name);
613 pos = cache_name_pos(ce->name, ntohs(ce->ce_flags));
614 pos = -pos-1;
615 }