From: Junio C Hamano Date: Mon, 18 Apr 2005 17:42:48 +0000 (-0700) Subject: [PATCH] Fix confusing behaviour of update-cache --refresh on unmerged paths. X-Git-Tag: v0.99~835 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1bc992acacf5961e65d9fdddeb8561284e708c74;p=git.git [PATCH] Fix confusing behaviour of update-cache --refresh on unmerged paths. The "update-cache --refresh" command attempts refresh_entry() on unmerged path, which results in as many "needs update" messages as there are unmerged stages for that path. This does not do any harm to the working directory, but it is confusing. Here is a fix. Signed-off-by: Junio C Hamano Signed-off-by: Linus Torvalds --- diff --git a/update-cache.c b/update-cache.c index 7c3a1435..68d2f95c 100644 --- a/update-cache.c +++ b/update-cache.c @@ -196,9 +196,18 @@ static void refresh_cache(void) int i; for (i = 0; i < active_nr; i++) { - struct cache_entry *ce = active_cache[i]; - struct cache_entry *new = refresh_entry(ce); + struct cache_entry *ce, *new; + ce = active_cache[i]; + if (ce_stage(ce)) { + printf("%s: needs merge\n", ce->name); + while ((i < active_nr) && + ! strcmp(active_cache[i]->name, ce->name)) + i++; + i--; + continue; + } + new = refresh_entry(ce); if (!new) { printf("%s: needs update\n", ce->name); continue;