[U-Boot] [Patman Bug Report] Patman breaks git-log during git-rebase

Hi Simon,
I found an odd behavior of Patman.
If I run Patman during "git rebase -i", Patman rewrites git-log, stripping all the Patman-tags. (I lost some important tags such as "Series-changes".)
I think git-log should be read-only during Patman operation. I can't understand why Patman needs to directly edit git-log. Is this a fixable problem?
Best Regards Masahiro Yamada

Hi Masahiro,
On 2 June 2014 01:44, Masahiro Yamada yamada.m@jp.panasonic.com wrote:
Hi Simon,
I found an odd behavior of Patman.
If I run Patman during "git rebase -i", Patman rewrites git-log, stripping all the Patman-tags. (I lost some important tags such as "Series-changes".)
I think git-log should be read-only during Patman operation. I can't understand why Patman needs to directly edit git-log. Is this a fixable problem?
Probably you shouldn't do that. For me patman normally complains that it can't find patches to process, and stops.
Can you give me the repeat steps? I think I have seen this before but I'm not sure how to make it.
Also, patman never edits commits. I wonder if patman is moving you to the wrong commit somehow. Try 'git reflog' to find something to get back to.
Regards, Simon

Hi Simon,
On Mon, 2 Jun 2014 20:28:48 -0600 Simon Glass sjg@chromium.org wrote:
Hi Masahiro,
On 2 June 2014 01:44, Masahiro Yamada yamada.m@jp.panasonic.com wrote:
Hi Simon,
I found an odd behavior of Patman.
If I run Patman during "git rebase -i", Patman rewrites git-log, stripping all the Patman-tags. (I lost some important tags such as "Series-changes".)
I think git-log should be read-only during Patman operation. I can't understand why Patman needs to directly edit git-log. Is this a fixable problem?
Probably you shouldn't do that. For me patman normally complains that it can't find patches to process, and stops.
Can you give me the repeat steps? I think I have seen this before but I'm not sure how to make it.
Also, patman never edits commits. I wonder if patman is moving you to the wrong commit somehow. Try 'git reflog' to find something to get back to.
Please try this procedure:
[1] Let's start our topic branch
git checkout -b test master
[2] Add some commits on the topic branch
echo a >> README git add README git commit
Input the commit message like this: ----->8----- Test commit 1
This is log. Blah Blah.
Series-to: u-boot@lists.denx.de Series-version: 2 Series-changes: 2 - Blah Blah -----8<-----
echo b >> README git add README git commit -m "Test commit 2"
[3] Now we have two commits on the branch. Git-log is like this
git log commit cedf7627e215135b594cd40b87b8f4a9b80375a6 Author: Masahiro Yamada yamada.m@jp.panasonic.com Date: Wed Jun 4 17:15:55 2014 +0900
Test commit 2
commit 74a2b72c0d4201fc478e530b886c3ab3791a703e Author: Masahiro Yamada yamada.m@jp.panasonic.com Date: Wed Jun 4 17:04:57 2014 +0900
Test commit 1
This is log. Blah Blah.
Series-to: u-boot@lists.denx.de Series-version: 2 Series-changes: 2 - Blah Blah
[4] Run "git rebase -i"
git rebase -i master
[5] Edit the first one
e 74a2b72 test commit 1 pick cedf762 Test commit 2
[6] Run "git commit --amend" and edit the git-log
git commit --amend
Test commit 1
This is log. Blah Blah. Some additional log. <----- Add
Series-to: u-boot@lists.denx.de Series-version: 2 Series-changes: 2 - Blah Blah
[7] Run patman
tools/patman/patman -t -c 1
[8] Cansel the patman and check the git-log and you will find Patman tags are gone!!
git log
commit 7bfec19aebaaefba9f7062e909fa38c071191b71 Author: Masahiro Yamada yamada.m@jp.panasonic.com Date: Wed Jun 4 17:04:57 2014 +0900
Test commit 1
This is log. Blah Blah. Some additional log.
Signed-off-by: Masahiro Yamada yamada.m@jp.panasonic.com
Best Regards Masahiro Yamada

Hi Masahiro,
On 4 June 2014 04:32, Masahiro Yamada yamada.m@jp.panasonic.com wrote:
Hi Simon,
On Mon, 2 Jun 2014 20:28:48 -0600 Simon Glass sjg@chromium.org wrote:
Hi Masahiro,
On 2 June 2014 01:44, Masahiro Yamada yamada.m@jp.panasonic.com wrote:
Hi Simon,
I found an odd behavior of Patman.
If I run Patman during "git rebase -i", Patman rewrites git-log, stripping all the Patman-tags. (I lost some important tags such as "Series-changes".)
I think git-log should be read-only during Patman operation. I can't understand why Patman needs to directly edit git-log. Is this a fixable problem?
Probably you shouldn't do that. For me patman normally complains that it can't find patches to process, and stops.
Can you give me the repeat steps? I think I have seen this before but I'm not sure how to make it.
Also, patman never edits commits. I wonder if patman is moving you to the wrong commit somehow. Try 'git reflog' to find something to get back to.
Please try this procedure:
Thanks for the steps.
[1] Let's start our topic branch
git checkout -b test master
[2] Add some commits on the topic branch
echo a >> README git add README git commit
Input the commit message like this: ----->8----- Test commit 1
This is log. Blah Blah.
Series-to: u-boot@lists.denx.de Series-version: 2 Series-changes: 2
- Blah Blah
-----8<-----
echo b >> README git add README git commit -m "Test commit 2"
[3] Now we have two commits on the branch. Git-log is like this
git log commit cedf7627e215135b594cd40b87b8f4a9b80375a6 Author: Masahiro Yamada yamada.m@jp.panasonic.com Date: Wed Jun 4 17:15:55 2014 +0900
Test commit 2
commit 74a2b72c0d4201fc478e530b886c3ab3791a703e Author: Masahiro Yamada yamada.m@jp.panasonic.com Date: Wed Jun 4 17:04:57 2014 +0900
Test commit 1 This is log. Blah Blah. Series-to: u-boot@lists.denx.de Series-version: 2 Series-changes: 2 - Blah Blah
[4] Run "git rebase -i"
git rebase -i master
[5] Edit the first one
e 74a2b72 test commit 1 pick cedf762 Test commit 2
[6] Run "git commit --amend" and edit the git-log
git commit --amend
Test commit 1
This is log. Blah Blah. Some additional log. <----- Add
Series-to: u-boot@lists.denx.de Series-version: 2 Series-changes: 2
- Blah Blah
[7] Run patman
tools/patman/patman -t -c 1
[8] Cansel the patman and check the git-log and you will find Patman tags are gone!!
By cancel I guess you mean to press 'q' when it asks to send the first email?
In that case I end up on an 'undefined' branch. It doesn't have any commits. I then need to do 'git rebase --abort' to get things back to normal, but in that case yes I have lost my changes.
git log
commit 7bfec19aebaaefba9f7062e909fa38c071191b71 Author: Masahiro Yamada yamada.m@jp.panasonic.com Date: Wed Jun 4 17:04:57 2014 +0900
Test commit 1 This is log. Blah Blah. Some additional log. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
If you give the -a flag it will avoid trying to apply the patches, and the problem does not happen.
The problem is that when patman applies the patches it checks out a new branch, uses 'git am' to apply the patches one by one, and then tries to go back to the old branch. Since the branch is called 'undefined' these doesn't really work. It seems that 'undefined' is created by git and is persistent after it is created. It's a bit odd but I may be missing something.
Anyway I think I can put in a check for the 'undefined' branch and avoid this.
Regards, Simon

Hi Simon,
[8] Cansel the patman and check the git-log and you will find Patman tags are gone!!
By cancel I guess you mean to press 'q' when it asks to send the first email?
Yes.
If you give the -a flag it will avoid trying to apply the patches, and the problem does not happen.
The problem is that when patman applies the patches it checks out a new branch, uses 'git am' to apply the patches one by one, and then tries to go back to the old branch. Since the branch is called 'undefined' these doesn't really work. It seems that 'undefined' is created by git and is persistent after it is created. It's a bit odd but I may be missing something.
Anyway I think I can put in a check for the 'undefined' branch and avoid this.
Sorry, I don't have this level of understanding of how Patman works, but... anyway -a option worked for me and I'm happy.
Thanks!
Best Regards Masahiro Yamada
participants (2)
-
Masahiro Yamada
-
Simon Glass