@matheusbsbs / matheus-bagliano / commits / 6d6776cb49
Fork 0

read-tree --reset -u fix.

The previous commit makes -u to mean "I do want to remove the local changes, just update it from the read tree" only for one-way merge. It makes sense to have it depend on the "--reset" flag instead. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed May 15, 2006 at 08:09 UTC 6d6776cb497ea7fbf5fe43912dbe3286f76c9933
1 file changed +12 -4
read-tree.c
+12 -4
@@ -12,6 +12,7 @@
12 #include <sys/time.h>
13 #include <signal.h>
14
15 +static int reset = 0;
16 static int merge = 0;
17 static int update = 0;
18 static int index_only = 0;
@@ -416,6 +417,10 @@ static void verify_uptodate(struct cache_entry *ce)
417 return;
418 errno = 0;
419 }
420 + if (reset) {
421 + ce->ce_flags |= htons(CE_UPDATE);
422 + return;
423 + }
424 if (errno == ENOENT)
425 return;
426 die("Entry '%s' not uptodate. Cannot merge.", ce->name);
@@ -686,9 +691,12 @@ static int oneway_merge(struct cache_entry **src)
691 if (!a)
692 return deleted_entry(old, NULL);
693 if (old && same(old, a)) {
689 - struct stat st;
690 - if (lstat(old->name, &st) || ce_match_stat(old, &st, 1))
691 - old->ce_flags |= htons(CE_UPDATE);
694 + if (reset) {
695 + struct stat st;
696 + if (lstat(old->name, &st) ||
697 + ce_match_stat(old, &st, 1))
698 + old->ce_flags |= htons(CE_UPDATE);
699 + }
700 return keep_entry(old);
701 }
702 return merged_entry(a, NULL);
@@ -722,7 +730,7 @@ static struct cache_file cache_file;
730
731 int main(int argc, char **argv)
732 {
725 - int i, newfd, reset, stage = 0;
733 + int i, newfd, stage = 0;
734 unsigned char sha1[20];
735 merge_fn_t fn = NULL;
736