From: Junio C Hamano Date: Sun, 17 Apr 2005 17:02:21 +0000 (-0700) Subject: [PATCH] Better error message from checkout-cache for unmerged files. X-Git-Tag: v0.99~852 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=a38800fde24a44b12a9ed14852339466de1cb9c9;p=git.git [PATCH] Better error message from checkout-cache for unmerged files. The checkout-cache command says "file is not in the cache" when an unmerged path is given. This patch adds code to distinguish the unmerged and the nonexistent cases and gives an appropriate error message. Signed-off-by: Junio C Hamano Signed-off-by: Linus Torvalds --- diff --git a/checkout-cache.c b/checkout-cache.c index b909f5d9..1c257666 100644 --- a/checkout-cache.c +++ b/checkout-cache.c @@ -121,8 +121,15 @@ static int checkout_file(const char *name) { int pos = cache_name_pos(name, strlen(name)); if (pos < 0) { - if (!quiet) - fprintf(stderr, "checkout-cache: %s is not in the cache\n", name); + if (!quiet) { + pos = -pos - 1; + fprintf(stderr, + "checkout-cache: %s is %s.\n", + name, + (pos < active_nr && + !strcmp(active_cache[pos]->name, name)) ? + "unmerged" : "not in the cache"); + } return -1; } return checkout_entry(active_cache[pos]);