Re: Rewriting references to existing commits in commit messages with filter-branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Rast <trast <at> student.ethz.ch> writes:

> 
> Vadim Zeitlin <vz-git <at> zeitlins.org> writes:
> 
> > Lawrence Mitchell <wence <at> gmx.li> writes:
> >
> >> Vadim Zeitlin wrote:
> >> 
> >> [...]
> >> 
> >> > git filter-branch --msg-filter svnmsg2git --tag-name-filter cat -- --all
> >> 
> >> git rev-list lists by default in chronological order.  Do you
> >> want to pass --topo-order as one of the rev-list options?
> >
> >  Thanks, this looked like a good idea but reading git-filter-branch code it
> > seems to already do it, at
> > https://github.com/git/git/blob/master/git-filter-branch.sh#L269 you can see
> > that it does "git rev-list --reverse --topo-order ...".
> 
> Try overring that with --date-order (you may have to patch the source).

 Thanks for the hint, this was indeed the solution. And there is actually no
need to patch the source because, considering the way git-filter-branch.sh is
written, the user-specified parameters come after the hard-coded --topo-order
and it seems that --date-order overrides it if it comes after it. So I just had
to use

git filter-branch --msg-filter svnmsg2git --tag-name-filter cat -- --date-order
--all

instead of my original command. The only remaining question I have is why isn't
--date-order the default? At least when using message filter, it seems to me
that we always want to rewrite commits in chronological order to deal with
possible back references (even when not migrating from svn, commit messages can
still refer to previous commits, like e.g. the ones created by "git revert" do
and they need to be updated when rewriting history). So why not use it in
git-filter-branch.sh?


 BTW, the explanation for the new errors I was getting with --date-order was
that I had some artificial commits generated by cvs2svn in the history of this
repository which had _exactly_ the same date as the previous commit and
--date-order sorted them in the wrong order for some reason. I got round this by
simply checking for the specific form of the message (which is "This commit was
generated by cvs2svn to compensate for changes in rNNNNN, which included commits
to RCS files with non-trunk default branches.") and replacing "rNNNNN" with "the
previous commit" in this particular case in order to avoid the problem.

 Thanks again for your help!
VZ

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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]