On Mon, 15 May 2006, Linus Torvalds wrote: > > Ack. On the other hand, I wonder if it might not make sense to have this > part potentially depend on the "--reset" flag. > > That way you wouldn't even have to apologize for it. Ie, something like this.. This should allow a two-way or three-way merge to akso ignore any dirty state when you use "--reset", because they use "verify_uptodate()", which now would set the CD_UPDATE flag on the ce rather than complain about it being different (if it survives the merge, of course - often it won't, but then we won't care). This is all totally untested, of course. Linus ---- diff --git a/read-tree.c b/read-tree.c index 7c83031..f2d674c 100644 --- a/read-tree.c +++ b/read-tree.c @@ -13,6 +13,7 @@ #include "cache-tree.h" #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 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,11 @@ static int oneway_merge(struct cache_ent 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 +800,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; - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html