From: Junio C Hamano Date: Mon, 28 Jul 2008 01:21:19 GMT Subject: Re: [PATCH] t/t7001-mv.sh: Propose ability to use git-mv on conflicting entries Message-ID: <7vzlo2x0q8.fsf@gitster.siamese.dyndns.org> In-Reply-To: <7v4p6ayfmw.fsf@gitster.siamese.dyndns.org> Junio C Hamano writes: >> +# Rationale: I cannot git mv around a conflicted file. This is unnecessary >> +# restriction in case another part of conflict resolution requires me to >> +# move the file around. > > Yes, I would agree this is a reasonable thing to support. Something like > this patch, perhaps. > ... Just in case if somebody is inclined to test the patch and polish it into a shape good enough for inclusion... > @@ -177,7 +177,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix) > } else > bad = "Cannot overwrite"; > } > - } else if (cache_name_pos(src, length) < 0) > + } else if (((pos = cache_name_pos(src, length)) < 0) && > + strcmp(active_cache[-1 - pos]->name, src)) There is a bug here; "-1 - pos" needs to be checked against active_nr before strcmp().