Filtering mode changes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Filtering mode changes

Stefan Näwe
Hi there.

Here's my story:

- I did some minor modifications to a repo that I want to 'give back'.
- I worked on my own branch (of course).
- I was stupid to edit the files (that live on a linux box) through a windows
  network share.
- When I created diffs (using 'git format-patch') to send send 'upstream', I
  noticed that the edited files got their executable bit set (old mode 100644 ->
  new mode 100755)
- I created another commit to undo the mode changes.

My question:

Is there a way to create clean diffs (between master and my branch) that don't
contain the 'double mode change' (from 644 to 755 to 644) ?

TIA

Stefan


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Filtering mode changes

Matt Pearson-3
On Fri, Aug 1, 2008 at 7:25 AM, Stefan Naewe <[hidden email]> wrote:

> Hi there.
>
> Here's my story:
>
> - I did some minor modifications to a repo that I want to 'give back'.
> - I worked on my own branch (of course).
> - I was stupid to edit the files (that live on a linux box) through a windows
>  network share.
> - When I created diffs (using 'git format-patch') to send send 'upstream', I
>  noticed that the edited files got their executable bit set (old mode 100644 ->
>  new mode 100755)
> - I created another commit to undo the mode changes.
>
> My question:
>
> Is there a way to create clean diffs (between master and my branch) that don't
> contain the 'double mode change' (from 644 to 755 to 644) ?
>

You probably want to use 'git rebase -i master' and the 'squash'
command to combine the changes into one. If multiple commits messed up
the permissions, use the 'edit' command and the rebase will stop after
the specified commits, allowing you to fix things up, then do 'git
commit --amend'. Use 'git rebase --continue' to continue fixing the
patches.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Filtering mode changes

Santi Béjar
In reply to this post by Stefan Näwe
On Fri, Aug 1, 2008 at 13:25, Stefan Naewe <[hidden email]> wrote:
> Hi there.
>
> Here's my story:
>
> - I did some minor modifications to a repo that I want to 'give back'.
> - I worked on my own branch (of course).
> - I was stupid to edit the files (that live on a linux box) through a windows
>  network share.

Then, you should set core.fileMode to false.

> - When I created diffs (using 'git format-patch') to send send 'upstream', I
>  noticed that the edited files got their executable bit set (old mode 100644 ->
>  new mode 100755)

You can just edit the patches and remove the "old/new mode" lines.

> - I created another commit to undo the mode changes.

You can use "git rebase -i" and edit (or squash) the revision before
generating the patch.

Santi
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html