{"thread":{"id":"10462","subject":"git apply fails to apply a renamed file in a new directory","startedAt":"2007-10-25T18:07:37Z","lastAt":"2007-10-25T21:41:19Z","messageCount":4,"participants":["Sam Ravnborg","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"57206","messageId":"20071025180737.GA13829@uranus.ravnborg.org","threadId":"10462","inReplyTo":null,"subject":"git apply fails to apply a renamed file in a new directory","fromName":"Sam Ravnborg","fromEmail":"sam@ravnborg.org","sentAt":"2007-10-25T18:07:37Z","receivedAt":"2007-10-25T18:07:37Z","isPatch":false,"sender":{"key":"sam@ravnborg.org","avatar":"https://gravatar.com/avatar/168a912606ed0742d840bb365e3cc21db390c36531a58341dc7a069cc1f15f62?d=mp&s=160"},"body":"I just stumbled on what looks like a simple bug in git apply.\nI had following diff:\n\ndiff --git a/arch/i386/defconfig b/arch/x86/configs/i386_defconfig\nsimilarity index 100%\nrename from arch/i386/defconfig\nrename to arch/x86/configs/i386_defconfig\ndiff --git a/arch/x86_64/defconfig b/arch/x86/configs/x86_64_defconfig\nsimilarity index 100%\nrename from arch/x86_64/defconfig\nrename to arch/x86/configs/x86_64_defconfig\n-- \n1.5.3.4.1157.g0e74-dirty\n\nWhen trying to apply this diff using:\ngit apply -p1 < .../patch\n\nI noticed that the two defconfig files were deleted as expected,\nbut the renamed versions did not appear in the arch/x86/configs/\ndirectory.\nThe configs/ directory did not exist and was not created.\nWithout looking at git apply I assume that the rename failed because\nit is not prepared to rename a file to a directory that does not exist.\n\nBuried in other stuff so I did not take a look myself..\n\n\tSam\n"},{"id":"57240","messageId":"20071025213038.GC11308@steel.home","threadId":"10462","inReplyTo":"20071025180737.GA13829@uranus.ravnborg.org","subject":"Re: git apply fails to apply a renamed file in a new directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-25T21:30:38Z","receivedAt":"2007-10-25T21:30:38Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Sam Ravnborg, Thu, Oct 25, 2007 20:07:37 +0200:\n> I just stumbled on what looks like a simple bug in git apply.\n> I had following diff:\n> \n> diff --git a/arch/i386/defconfig b/arch/x86/configs/i386_defconfig\n> similarity index 100%\n> rename from arch/i386/defconfig\n> rename to arch/x86/configs/i386_defconfig\n> diff --git a/arch/x86_64/defconfig b/arch/x86/configs/x86_64_defconfig\n> similarity index 100%\n> rename from arch/x86_64/defconfig\n> rename to arch/x86/configs/x86_64_defconfig\n> -- \n> 1.5.3.4.1157.g0e74-dirty\n> \n> When trying to apply this diff using:\n> git apply -p1 < .../patch\n\nworks here. Don't use -p1, it is assumed\n"},{"id":"57241","messageId":"20071025213523.GD11308@steel.home","threadId":"10462","inReplyTo":"20071025213038.GC11308@steel.home","subject":"Re: git apply fails to apply a renamed file in a new directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-25T21:35:23Z","receivedAt":"2007-10-25T21:35:23Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Alex Riesen, Thu, Oct 25, 2007 23:30:38 +0200:\n> Sam Ravnborg, Thu, Oct 25, 2007 20:07:37 +0200:\n> > I just stumbled on what looks like a simple bug in git apply.\n> > I had following diff:\n> > \n> > diff --git a/arch/i386/defconfig b/arch/x86/configs/i386_defconfig\n> > similarity index 100%\n> > rename from arch/i386/defconfig\n> > rename to arch/x86/configs/i386_defconfig\n> > diff --git a/arch/x86_64/defconfig b/arch/x86/configs/x86_64_defconfig\n> > similarity index 100%\n> > rename from arch/x86_64/defconfig\n> > rename to arch/x86/configs/x86_64_defconfig\n> > -- \n> > 1.5.3.4.1157.g0e74-dirty\n\n.1157...-dirty. Your git looks heavily modified. Could you try with a\nsomething like master of kernel.org?\n\nMine is based off d90a7fda355c251b8ffdd79617fb083c18245ec2\n(builtin-fetch got merged).\n\n> > When trying to apply this diff using:\n> > git apply -p1 < .../patch\n> \n> works here. Don't use -p1, it is assumed\n> \n"},{"id":"57243","messageId":"20071025214119.GC15292@uranus.ravnborg.org","threadId":"10462","inReplyTo":"20071025213523.GD11308@steel.home","subject":"Re: git apply fails to apply a renamed file in a new directory","fromName":"Sam Ravnborg","fromEmail":"sam@ravnborg.org","sentAt":"2007-10-25T21:41:19Z","receivedAt":"2007-10-25T21:41:19Z","isPatch":false,"sender":{"key":"sam@ravnborg.org","avatar":"https://gravatar.com/avatar/168a912606ed0742d840bb365e3cc21db390c36531a58341dc7a069cc1f15f62?d=mp&s=160"},"body":"On Thu, Oct 25, 2007 at 11:35:23PM +0200, Alex Riesen wrote:\n> Alex Riesen, Thu, Oct 25, 2007 23:30:38 +0200:\n> > Sam Ravnborg, Thu, Oct 25, 2007 20:07:37 +0200:\n> > > I just stumbled on what looks like a simple bug in git apply.\n> > > I had following diff:\n> > > \n> > > diff --git a/arch/i386/defconfig b/arch/x86/configs/i386_defconfig\n> > > similarity index 100%\n> > > rename from arch/i386/defconfig\n> > > rename to arch/x86/configs/i386_defconfig\n> > > diff --git a/arch/x86_64/defconfig b/arch/x86/configs/x86_64_defconfig\n> > > similarity index 100%\n> > > rename from arch/x86_64/defconfig\n> > > rename to arch/x86/configs/x86_64_defconfig\n> > > -- \n> > > 1.5.3.4.1157.g0e74-dirty\n> \n> .1157...-dirty. Your git looks heavily modified. Could you try with a\n> something like master of kernel.org?\nI guess I still have Linus' rename stuff added - will update.\n\n> \n> Mine is based off d90a7fda355c251b8ffdd79617fb083c18245ec2\n> (builtin-fetch got merged).\n> \n> > > When trying to apply this diff using:\n> > > git apply -p1 < .../patch\n> > \n> > works here. Don't use -p1, it is assumed\n> > \n\nIt seems to be a picnic[*] bug - at least I cannot reproduce it.\nSorry for the noise but thanks for testing.\n\n[*] Problem In Chair Not In Computer\n\n\n\tSam\n"}]}