Web lists-archives.com

Re: [BUG] All files in folder are moved when cherry-picking commit that moves fewer files




Hi,

On Wed, Feb 27, 2019 at 6:30 AM Phillip Wood <phillip.wood123@xxxxxxxxx> wrote:
>
> Hi Linus
>
> On 27/02/2019 12:47, Linus Nilsson wrote:
> > Hi
> >
> > I have found what I suspect to be a bug, or at least not desirable behavior in my case. In one branch, I have moved all files in a directory to another directory. The first directory is now empty in this branch (I haven't tested whether this is significant).
>
> I suspect that because you've moved all the files git thinks the
> directory has been renamed and that's why it moves a/file2 when fix is
> cherry-picked in the example below. I've cc'd Elijah as he knows more
> about how the directory rename detection works.

Yes, Phillip is correct.  If the branch you were
merging/cherry-picking still had any files at all in the original
directory, then no directory rename would be detected.  You can read
up more details about how it works at
https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/technical/directory-rename-detection.txt