# rebase, file permissions and removed file

7 messages from 2008-10-27 to 2008-10-27. Participants: Pascal Obry, Johannes Sixt, Samuel Tardieu.
Thread: https://gitlist.dev/t/16059

## Pascal Obry, 2008-10-27 14:02

Subject: rebase, file permissions and removed file
Message-ID: <a2633edd0810270702x416bb659ke183b0cc6266071@mail.gmail.com>
URL: https://gitlist.dev/e/a2633edd0810270702x416bb659ke183b0cc6266071%40mail.gmail.com

```
In short,

   - a branch is created
   - a file is removed from master
   - the same file has its permissions changed on the branch
   - we rebase the branch on master
   - how to resolve the conflict?

Following is a script to reproduce the problem, see comment at the end.

Any idea? Thanks.

<<
-- #!/bin/sh

rm -fr repo

mkdir repo
cd repo
git init

touch file1 file2
chmod a+x file*
git add .
git ci -m "First rev"

git checkout -b fixperms
chmod a-x file1
git add file1
git ci -m "Fix perm file1"

git checkout master
git rm file1
git ci -m "Remove file1"

git checkout fixperms

git rebase master

# At this point there is a conflict as expected
# file1 has been removed on master, and file1 had its permissions changed
# on fixperms branch.
#
# What I find confusing is that:
#    $ git diff
# and
#    $ git diff --cached
#
# are reporting nothing.
#
# Ok, file1 has been removed, let's then remove it as it is right:
#
#   $ git rm file1
#   fatal: pathspec 'file1' did not match any files
#
# Ok, so what's the proper way to fix that! What should I do to be able to
# continue the rebase:
#
#   $ git rebase --continue
>>

--

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

```

## Johannes Sixt, 2008-10-27 14:38

Subject: Re: rebase, file permissions and removed file
Message-ID: <4905D276.9020308@viscovery.net>
URL: https://gitlist.dev/e/4905D276.9020308%40viscovery.net
In-Reply-To: <a2633edd0810270702x416bb659ke183b0cc6266071@mail.gmail.com>

```
Pascal Obry schrieb:
> # At this point there is a conflict as expected
> # file1 has been removed on master, and file1 had its permissions changed
> # on fixperms branch.
> #
> # What I find confusing is that:
> #    $ git diff
> # and
> #    $ git diff --cached
> #
> # are reporting nothing.
> #
> # Ok, file1 has been removed, let's then remove it as it is right:
> #
> #   $ git rm file1
> #   fatal: pathspec 'file1' did not match any files
> #
> # Ok, so what's the proper way to fix that! What should I do to be able to
> # continue the rebase:

Since you don't have any content to lose, you can always just

 $ touch file1
 $ git add file1
 $ git rm file1

-- Hannes

```

## Pascal Obry, 2008-10-27 15:09

Subject: Re: rebase, file permissions and removed file
Message-ID: <a2633edd0810270809w7fec93b2rc314cc025f41d41f@mail.gmail.com>
URL: https://gitlist.dev/e/a2633edd0810270809w7fec93b2rc314cc025f41d41f%40mail.gmail.com
In-Reply-To: <4905D276.9020308@viscovery.net>

```
On Mon, Oct 27, 2008 at 3:38 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Since you don't have any content to lose, you can always just
>
>  $ touch file1
>  $ git add file1
>  $ git rm file1

Does not work:

$ git rebase --continue
Applying: Fix perm file1
No changes - did you forget to use 'git add'?

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".



The only solution I found is to abort the rebase, edit my topic branch (fixperms
in this example) to remove file1 from the commit and redo the rebase... Not
that simple especially since there was many other commits on my topic branch.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

```

## Johannes Sixt, 2008-10-27 15:21

Subject: Re: rebase, file permissions and removed file
Message-ID: <4905DC90.6050503@viscovery.net>
URL: https://gitlist.dev/e/4905DC90.6050503%40viscovery.net
In-Reply-To: <a2633edd0810270809w7fec93b2rc314cc025f41d41f@mail.gmail.com>

```
Pascal Obry schrieb:
> On Mon, Oct 27, 2008 at 3:38 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
>> Since you don't have any content to lose, you can always just
>>
>>  $ touch file1
>>  $ git add file1
>>  $ git rm file1
> 
> Does not work:

Yes, it did! ;)

> $ git rebase --continue
> Applying: Fix perm file1
> No changes - did you forget to use 'git add'?

This is an entirely different matter. My interpretation is that the
permission change of file1 was the only change in this commit. Since this
is no longer needed, you should run 'git rebase --skip'.

-- Hannes

```

## Pascal Obry, 2008-10-27 15:33

Subject: Re: rebase, file permissions and removed file
Message-ID: <a2633edd0810270833q482260b4pf0ae11dcf2d4936f@mail.gmail.com>
URL: https://gitlist.dev/e/a2633edd0810270833q482260b4pf0ae11dcf2d4936f%40mail.gmail.com
In-Reply-To: <4905DC90.6050503@viscovery.net>

```
On Mon, Oct 27, 2008 at 4:21 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Pascal Obry schrieb:
>> On Mon, Oct 27, 2008 at 3:38 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
>>> Since you don't have any content to lose, you can always just
>>>
>>>  $ touch file1
>>>  $ git add file1
>>>  $ git rm file1
>>
>> Does not work:
>
> Yes, it did! ;)

Well, on my side I add to use:

   $ git rm --cached file1

For the last command.

> This is an entirely different matter. My interpretation is that the
> permission change of file1 was the only change in this commit. Since this
> is no longer needed, you should run 'git rebase --skip'.

No no :) Too easy! I have plenty of other permission changes in my commit
that I do not want to loose!

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

```

## Samuel Tardieu, 2008-10-27 16:39

Subject: Re: rebase, file permissions and removed file
Message-ID: <2008-10-27-17-39-43+trackit+sam@rfc1149.net>
URL: https://gitlist.dev/e/2008-10-27-17-39-43%2Btrackit%2Bsam%40rfc1149.net
In-Reply-To: <a2633edd0810270833q482260b4pf0ae11dcf2d4936f@mail.gmail.com>

```
>>>>> "Pascal" == Pascal Obry <pascal@obry.net> writes:

Pascal> I have plenty of other permission changes in my commit that I
Pascal> do not want to loose!

Why do you do a "rebase" in this case rather than a merge? Doesn't it
make little sense to record a permission change on a *deleted* file?

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/

```

## Pascal Obry, 2008-10-27 17:12

Subject: Re: rebase, file permissions and removed file
Message-ID: <4905F696.2080406@obry.net>
URL: https://gitlist.dev/e/4905F696.2080406%40obry.net
In-Reply-To: <2008-10-27-17-39-43+trackit+sam@rfc1149.net>

```
Samuel Tardieu a écrit :
> Why do you do a "rebase" in this case rather than a merge? Doesn't it
> make little sense to record a permission change on a *deleted* file?

Because this is in the context of git-svn, and I really want to rebase
my work before pushing it back to the Subversion repository.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

```
