* SUMMARY When working in a local git repository and pushing commits to the WebKit svn directory, there are times when a "git svn rebase" will cause the ChangeLog entry for a locally committed patch to be merged incorrectly (e.g., not at the top of the ChangeLog file). * STEPS TO REPRODUCE 1. You push a patch from git to svn (using git svn dcommit). 2. You commit another patch locally to git, such that a new ChangeLog entry has the same "date header" as the previous one (which is already committed to svn). 3. Someone else commits a ChangeLog entry above the entry from Step 1. 4. You're ready to commit your second patch, so you run "git svn rebase" to pull in svn commits and rebase your patch. * RESULTS After running "git svn rebase", git merges the ChangeLog entry for your second patch somewhere in the "middle" of the ChangeLog file, not at the top as you expected. * WORKAROUND Currently, your only option is to manually edit the ChangeLog file to correct it.
Created attachment 23883 [details] Patch v1 Suggested patch.
Comment on attachment 23883 [details] Patch v1 The code/comments look good. Can you show an example usage of this new mode (what commands should the user type)? r=me. Thanks for fixing this!!
(In reply to comment #2) > (From update of attachment 23883 [details] [edit]) > The code/comments look good. Can you show an example usage of this new mode > (what commands should the user type)? Well, if it doesn't do what you expected, please re-open this bug! Basically, the -f|--fix-merge flag only works on the "last" git commit in the tree, so it assumes that you're going to do a "git commit --amend" after you run the command. (If you have a commit buried in a rebase, your best bet is to use "git rebase -i commit-hash^" and then run this command when you've paused on the errant merge.) * INITIAL STATE The HEAD commit in your git branch contains a mis-merged ChangeLog entry (or two). * STEPS 1. Run: resolve-ChangeLogs -f < ChangeLog1> [< ChangeLog2> ...] Example: ./WebKitTools/Scripts/resolve-ChangeLogs -f WebCore/Changelog WebKit/ChangeLog Note that the fixed ChangeLog files are automatically run through git-add. 2. Amend the commit: git commit --amend Note that you may want to fix up the commit message if it was also trashed. (Is there an easy way to tell git to regenerate the commit message so the commit-log-editor does it's magic again?) 3. You're done. I did notice that it doesn't print out a success message when it merges the file. I will change that before landing.
(In reply to comment #3) > I did notice that it doesn't print out a success message when it merges the > file. I will change that before landing. I also thought that there may be a better switch than "-f" (like -r|--remerge), but I was waiting for feedback that someone didn't like -f. :)
Committed r37047 I added code to output the status of the ChangeLog file after it was successfully updated, and added a couple missing lines of code. (I did a poor job merging the patch from another tree before I posted it here previously).
(In reply to comment #3) > Note that you may want to fix up the commit message if it was also trashed. When/how would the commit message get trashed? > (Is there an easy way to tell git to regenerate the commit message so the > commit-log-editor does it's magic again?) commit-log-editor only generates a ChangeLog template if the input file contains no existing commit message. So you'd have to make sure that the input file is empty or contains only comments. This might involve messing with .git/MERGE_MSG and other files. I don't know all the details.
(In reply to comment #6) > (In reply to comment #3) > > Note that you may want to fix up the commit message if it was also trashed. > > When/how would the commit message get trashed? Nevermind. I wasn't thinking when I wrote this. > > (Is there an easy way to tell git to regenerate the commit message so the > > commit-log-editor does it's magic again?) > > commit-log-editor only generates a ChangeLog template if the input file > contains no existing commit message. So you'd have to make sure that the input > file is empty or contains only comments. This might involve messing with > .git/MERGE_MSG and other files. I don't know all the details. I may have to research this some time. Hmm...looks like "man githooks" has some interesting information. I wonder if I can write a prepare-commit-msg hook that conditionally regenerates the changelog entry (when I want it regenerated :)?