* [PATCH] Fix confusing behaviour of update-cache --refresh on unmerged paths.
@ 2005-04-18 6:09 Junio C Hamano
0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2005-04-18 6:09 UTC (permalink / raw)
To: torvalds; +Cc: git
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.
$ ls -al
total 16
drwxrwsr-x 3 junio src 4096 Apr 17 23:00 ./
drwxrwsr-x 10 junio src 4096 Apr 17 22:58 ../
drwxr-sr-x 3 junio src 4096 Apr 17 22:59 .git/
-rw-rw-r-- 1 junio src 363 Apr 17 23:00 TT
$ show-files --stage
100644 e14bafaadce6c34768ba2ff8b3c6419e8839e7d2 1 TT
100644 99ef1b30fc6d6ea186d6eac62619e1afd65ad64e 2 TT
100644 033b9385f7a29882a6b4b34f67b20e2304d3489d 3 TT
$ ../++linus/update-cache --refresh
TT: needs update
TT: needs update
TT: needs update
$ ../update-cache --refresh
TT: needs merge
Here is a fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
update-cache.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
update-cache.c: 5742c6ca084a7761ad728651d85509736e2ebc7c
--- update-cache.c
+++ update-cache.c 2005-04-17 22:58:06.000000000 -0700
@@ -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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-18 6:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-18 6:09 [PATCH] Fix confusing behaviour of update-cache --refresh on unmerged paths Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox