msysgit git-am can't apply it's own git format-patch sequence
Posted
by
Andrian Nord
on Stack Overflow
See other posts from Stack Overflow
or by Andrian Nord
Published on 2012-10-12T15:25:07Z
Indexed on
2012/10/12
15:37 UTC
Read the original article
Hit count: 333
I'm using msysgit git on windows to operate on central svn repository. I'm using git as I want to have it's awesome little local branches for everything and rebasing on each other.
I also need to update from central repo often, so using separate svn/git is not an option.
Problem is - git svn --help
(man page) says that it is not a good idea to use git merge
into master branch (which is set to track from svn's trunk) from local branches, as this will ruin the party and git svn dcommit
would not work anymore.
I know that it's not exactly true and you may use git merge
if you are merging from
branch which was properly rebased on master prior merge, but I'm trying to make it safer and actually use git format-patch
and git am
. We are using code review, so I'm making patches anyway. I also knew about git cherry-pick
, but I want to just git am /reviewed/patches/dir/*
without actually recalling what commits was corresponding to this patches (without reading patches, that is).
So, what's wrong with git svn
and git am
? It's simple - git am
for a few very hard points is doing CRLF into LF conversion for patches supplied (git-mailsplit
is doing this, to be precise), if not rebasing. git format-patch
is also producing proper (LF-ended) patches.
As my repo is mostly CRLF (and it should remain so), patches are, obviously, failing due to wrong EOL. Converting diffs to CRLF and somehow hacking git am
to prevent it from conversion is not working, too. It will fail if any file was removed or deleted - git apply
will complain about expected /dev/null (but he got /dev/null^M
).
And if I'm applying it with git am --ignore-space-change --ignore-whitespace
that it will
commit LF endings straight to the index, which is also weird. I don't know if it will preserve over commiting into svn (via git svn dcommit
) and checking it out and I don't want to try out.
Of course, it's still possible to try hacking around patches to convert only actual diffs, but this is too much hacks for simple task.
So, I wonder, is there really no established way to produce patches and apply them to the same repo on the same system? It just feels weird that msysgit can't apply it's own patches.
© Stack Overflow or respective owner