{"thread":{"id":"16059","subject":"rebase, file permissions and removed file","startedAt":"2008-10-27T14:02:42Z","lastAt":"2008-10-27T17:12:54Z","messageCount":7,"participants":["Pascal Obry","Johannes Sixt","Samuel Tardieu"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"94048","messageId":"a2633edd0810270702x416bb659ke183b0cc6266071@mail.gmail.com","threadId":"16059","inReplyTo":null,"subject":"rebase, file permissions and removed file","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-10-27T14:02:42Z","receivedAt":"2008-10-27T14:02:42Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"In short,\n\n   - a branch is created\n   - a file is removed from master\n   - the same file has its permissions changed on the branch\n   - we rebase the branch on master\n   - how to resolve the conflict?\n\nFollowing is a script to reproduce the problem, see comment at the end.\n\nAny idea? Thanks.\n\n<<\n-- #!/bin/sh\n\nrm -fr repo\n\nmkdir repo\ncd repo\ngit init\n\ntouch file1 file2\nchmod a+x file*\ngit add .\ngit ci -m \"First rev\"\n\ngit checkout -b fixperms\nchmod a-x file1\ngit add file1\ngit ci -m \"Fix perm file1\"\n\ngit checkout master\ngit rm file1\ngit ci -m \"Remove file1\"\n\ngit checkout fixperms\n\ngit rebase master\n\n# At this point there is a conflict as expected\n# file1 has been removed on master, and file1 had its permissions changed\n# on fixperms branch.\n#\n# What I find confusing is that:\n#    $ git diff\n# and\n#    $ git diff --cached\n#\n# are reporting nothing.\n#\n# Ok, file1 has been removed, let's then remove it as it is right:\n#\n#   $ git rm file1\n#   fatal: pathspec 'file1' did not match any files\n#\n# Ok, so what's the proper way to fix that! What should I do to be able to\n# continue the rebase:\n#\n#   $ git rebase --continue\n>>\n\n--\n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"94050","messageId":"4905D276.9020308@viscovery.net","threadId":"16059","inReplyTo":"a2633edd0810270702x416bb659ke183b0cc6266071@mail.gmail.com","subject":"Re: rebase, file permissions and removed file","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-10-27T14:38:46Z","receivedAt":"2008-10-27T14:38:46Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Pascal Obry schrieb:\n> # At this point there is a conflict as expected\n> # file1 has been removed on master, and file1 had its permissions changed\n> # on fixperms branch.\n> #\n> # What I find confusing is that:\n> #    $ git diff\n> # and\n> #    $ git diff --cached\n> #\n> # are reporting nothing.\n> #\n> # Ok, file1 has been removed, let's then remove it as it is right:\n> #\n> #   $ git rm file1\n> #   fatal: pathspec 'file1' did not match any files\n> #\n> # Ok, so what's the proper way to fix that! What should I do to be able to\n> # continue the rebase:\n\nSince you don't have any content to lose, you can always just\n\n $ touch file1\n $ git add file1\n $ git rm file1\n\n-- Hannes\n"},{"id":"94052","messageId":"a2633edd0810270809w7fec93b2rc314cc025f41d41f@mail.gmail.com","threadId":"16059","inReplyTo":"4905D276.9020308@viscovery.net","subject":"Re: rebase, file permissions and removed file","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-10-27T15:09:57Z","receivedAt":"2008-10-27T15:09:57Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"On Mon, Oct 27, 2008 at 3:38 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Since you don't have any content to lose, you can always just\n>\n>  $ touch file1\n>  $ git add file1\n>  $ git rm file1\n\nDoes not work:\n\n$ git rebase --continue\nApplying: Fix perm file1\nNo changes - did you forget to use 'git add'?\n\nWhen you have resolved this problem run \"git rebase --continue\".\nIf you would prefer to skip this patch, instead run \"git rebase --skip\".\nTo restore the original branch and stop rebasing run \"git rebase --abort\".\n\n\n\nThe only solution I found is to abort the rebase, edit my topic branch (fixperms\nin this example) to remove file1 from the commit and redo the rebase... Not\nthat simple especially since there was many other commits on my topic branch.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"94053","messageId":"4905DC90.6050503@viscovery.net","threadId":"16059","inReplyTo":"a2633edd0810270809w7fec93b2rc314cc025f41d41f@mail.gmail.com","subject":"Re: rebase, file permissions and removed file","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-10-27T15:21:52Z","receivedAt":"2008-10-27T15:21:52Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Pascal Obry schrieb:\n> On Mon, Oct 27, 2008 at 3:38 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> Since you don't have any content to lose, you can always just\n>>\n>>  $ touch file1\n>>  $ git add file1\n>>  $ git rm file1\n> \n> Does not work:\n\nYes, it did! ;)\n\n> $ git rebase --continue\n> Applying: Fix perm file1\n> No changes - did you forget to use 'git add'?\n\nThis is an entirely different matter. My interpretation is that the\npermission change of file1 was the only change in this commit. Since this\nis no longer needed, you should run 'git rebase --skip'.\n\n-- Hannes\n"},{"id":"94055","messageId":"a2633edd0810270833q482260b4pf0ae11dcf2d4936f@mail.gmail.com","threadId":"16059","inReplyTo":"4905DC90.6050503@viscovery.net","subject":"Re: rebase, file permissions and removed file","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-10-27T15:33:22Z","receivedAt":"2008-10-27T15:33:22Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"On Mon, Oct 27, 2008 at 4:21 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Pascal Obry schrieb:\n>> On Mon, Oct 27, 2008 at 3:38 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>> Since you don't have any content to lose, you can always just\n>>>\n>>>  $ touch file1\n>>>  $ git add file1\n>>>  $ git rm file1\n>>\n>> Does not work:\n>\n> Yes, it did! ;)\n\nWell, on my side I add to use:\n\n   $ git rm --cached file1\n\nFor the last command.\n\n> This is an entirely different matter. My interpretation is that the\n> permission change of file1 was the only change in this commit. Since this\n> is no longer needed, you should run 'git rebase --skip'.\n\nNo no :) Too easy! I have plenty of other permission changes in my commit\nthat I do not want to loose!\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"94059","messageId":"2008-10-27-17-39-43+trackit+sam@rfc1149.net","threadId":"16059","inReplyTo":"a2633edd0810270833q482260b4pf0ae11dcf2d4936f@mail.gmail.com","subject":"Re: rebase, file permissions and removed file","fromName":"Samuel Tardieu","fromEmail":"sam@rfc1149.net","sentAt":"2008-10-27T16:39:43Z","receivedAt":"2008-10-27T16:39:43Z","isPatch":false,"sender":{"key":"sam@rfc1149.net","avatar":"https://avatars.githubusercontent.com/u/44656?v=4"},"body":">>>>> \"Pascal\" == Pascal Obry <pascal@obry.net> writes:\n\nPascal> I have plenty of other permission changes in my commit that I\nPascal> do not want to loose!\n\nWhy do you do a \"rebase\" in this case rather than a merge? Doesn't it\nmake little sense to record a permission change on a *deleted* file?\n\n  Sam\n-- \nSamuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/\n"},{"id":"94062","messageId":"4905F696.2080406@obry.net","threadId":"16059","inReplyTo":"2008-10-27-17-39-43+trackit+sam@rfc1149.net","subject":"Re: rebase, file permissions and removed file","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-10-27T17:12:54Z","receivedAt":"2008-10-27T17:12:54Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Samuel Tardieu a écrit :\n> Why do you do a \"rebase\" in this case rather than a merge? Doesn't it\n> make little sense to record a permission change on a *deleted* file?\n\nBecause this is in the context of git-svn, and I really want to rebase\nmy work before pushing it back to the Subversion repository.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"}]}