Skip to contentSkip to conversation

Patman breaks git-log during git-rebase

U-Boot Masahiro Yamada 2 participants 5 messages Jun 2, 2014 – Jun 13, 2014

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

Hi Masahiro,

Quoted 11 lines · Masahiro Yamada

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

#2 lore raw

Hi Simon,

Quoted 18 lines · On Mon, 2 Jun 2014 20:28:48 -0600 Simon Glass <[email protected]> wrote:

Hi Masahiro,

Quoted 11 lines · Masahiro Yamada

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.

Quoted 6 lines

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 at 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 <[email protected]>
Date:   Wed Jun 4 17:15:55 2014 +0900

Test commit 2

commit 74a2b72c0d4201fc478e530b886c3ab3791a703e

Author: Masahiro Yamada <[email protected]>
Date:   Wed Jun 4 17:04:57 2014 +0900

Test commit 1

This is log. Blah Blah.

Series-to: u-boot at 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 at 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 <[email protected]>
Date:   Wed Jun 4 17:04:57 2014 +0900

Test commit 1

This is log. Blah Blah.
Some additional log.

Best Regards
Masahiro Yamada

#3 lore raw

Hi Masahiro,

Quoted 26 lines · Masahiro Yamada

Hi Simon,

Quoted 21 lines · On Mon, 2 Jun 2014 20:28:48 -0600 Simon Glass <[email protected]> wrote:

Hi Masahiro,

Quoted 11 lines · Masahiro Yamada

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.

Quoted 6 lines
Quoted 3 lines

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.

Quoted 77 lines

[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 at 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 <[email protected]>
Date:   Wed Jun 4 17:15:55 2014 +0900

Test commit 2

commit 74a2b72c0d4201fc478e530b886c3ab3791a703e

Author: Masahiro Yamada <[email protected]>
Date:   Wed Jun 4 17:04:57 2014 +0900

Test commit 1

This is log. Blah Blah.

Series-to: u-boot at 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 at lists.denx.de
Series-version: 2
Series-changes: 2
- Blah Blah

Quoted 7 lines

[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.

Quoted 8 lines

git log

commit 7bfec19aebaaefba9f7062e909fa38c071191b71

Author: Masahiro Yamada <[email protected]>
Date:   Wed Jun 4 17:04:57 2014 +0900
Quoted 7 lines

Test commit 1

This is log. Blah Blah.
Some additional log.

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

#4 lore raw

Hi Simon,

Quoted 4 lines
Quoted 2 lines

[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.

Quoted 11 lines

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