summaryrefslogtreecommitdiff
path: root/read-tree.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-05-15 13:51:07 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-05-15 13:51:07 -0700
commitf6fb133b84d4a3ff560f341f7879c6721b6fb0d7 (patch)
treea9b6af60422a32a86163c18623360d0d29f631c8 /read-tree.c
parentMerge branch 'se/tag' into next (diff)
parentread-tree --reset -u fix. (diff)
downloadtgif-f6fb133b84d4a3ff560f341f7879c6721b6fb0d7.tar.xz
Merge branch 'lt/oneway' into next
* lt/oneway: read-tree --reset -u fix.
Diffstat (limited to 'read-tree.c')
-rw-r--r--read-tree.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/read-tree.c b/read-tree.c
index 3f02339547..aa6172b52e 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -13,6 +13,7 @@
#include <sys/time.h>
#include <signal.h>
+static int reset = 0;
static int merge = 0;
static int update = 0;
static int index_only = 0;
@@ -419,6 +420,10 @@ static void verify_uptodate(struct cache_entry *ce)
return;
errno = 0;
}
+ if (reset) {
+ ce->ce_flags |= htons(CE_UPDATE);
+ return;
+ }
if (errno == ENOENT)
return;
die("Entry '%s' not uptodate. Cannot merge.", ce->name);
@@ -723,9 +728,12 @@ static int oneway_merge(struct cache_entry **src)
return deleted_entry(old, NULL);
}
if (old && same(old, a)) {
- struct stat st;
- if (lstat(old->name, &st) || ce_match_stat(old, &st, 1))
- old->ce_flags |= htons(CE_UPDATE);
+ if (reset) {
+ struct stat st;
+ if (lstat(old->name, &st) ||
+ ce_match_stat(old, &st, 1))
+ old->ce_flags |= htons(CE_UPDATE);
+ }
return keep_entry(old);
}
return merged_entry(a, NULL);
@@ -793,7 +801,7 @@ static struct cache_file cache_file;
int main(int argc, char **argv)
{
- int i, newfd, reset, stage = 0;
+ int i, newfd, stage = 0;
unsigned char sha1[20];
merge_fn_t fn = NULL;