Subject: Re: New directory lost by git am

From: Phillip Susi <[email-masked]>
Date: Wed, 05 Mar 2014 11:47:12 -0500

On 3/5/2014 11:34 AM, Jeff King wrote:
> I don't think those steps are necessary for Chris's example. When
> he switches back to the master branch, git removes the subdirectory
> (the file is tracked in "temp" but not "master", so we remove it
> when switching branches, and then the directory is empty, so we
> clean it up, too). You can verify with an extra "ls" after the
> checkout but before the "am".

Right.

>>> * "git apply" parsed patches that add new files, generated by 
>>> programs other than Git, incorrectly.  This is an old breakage
>>> in v1.7.11.
>>> 
>>> Does that sound like your problem? If you can I'd suggest 
>>> updating, ideally to the recent 1.9.0 release but if you're
>>> feeling conservative try 1.8.3.4.
>> 
>> Vaguely, except for the "other than git" part.  This patch was 
>> generated by git-format-patch ( I didn't think apply handled
>> patches that weren't ).
> 
> I can't get Chris's script to fail on any version of git. Can you
> show us an example of a patch that does not behave (or better yet,
> a reproduction recipe to generate the patch with "format-patch")?

AHA!  It requires a conflict.  There were simple conflicts in the NEWS
file so I applied the patch with git am --reject and fixed up the
NEWS, and ran git am --resolved.  The git am --reject fails to add the
new directory to the index.