X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=read-tree.c;h=aa6172b52eeadb4f118e5145c182270342a70bf0;hb=aedb8995f841949ce29e05ea7e5c03c2d5466089;hp=7c830312c403c328dc278d57fecb8d4381cbf2c3;hpb=5fd51c77faeb362a5429061e595371b7a1c46c02;p=git.git diff --git a/read-tree.c b/read-tree.c index 7c830312c..aa6172b52 100644 --- a/read-tree.c +++ b/read-tree.c @@ -13,6 +13,7 @@ #include #include +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,6 +728,12 @@ static int oneway_merge(struct cache_entry **src) return deleted_entry(old, NULL); } if (old && same(old, a)) { + 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); @@ -790,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;