Skip to content

Commit 1bc992a

Browse files
Junio C HamanoLinus Torvalds
authored andcommitted
[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 <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6ad6d3d commit 1bc992a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

update-cache.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,18 @@ static void refresh_cache(void)
196196
int i;
197197

198198
for (i = 0; i < active_nr; i++) {
199-
struct cache_entry *ce = active_cache[i];
200-
struct cache_entry *new = refresh_entry(ce);
199+
struct cache_entry *ce, *new;
200+
ce = active_cache[i];
201+
if (ce_stage(ce)) {
202+
printf("%s: needs merge\n", ce->name);
203+
while ((i < active_nr) &&
204+
! strcmp(active_cache[i]->name, ce->name))
205+
i++;
206+
i--;
207+
continue;
208+
}
201209

210+
new = refresh_entry(ce);
202211
if (!new) {
203212
printf("%s: needs update\n", ce->name);
204213
continue;

0 commit comments

Comments
 (0)