Skip to contentSkip to conversation

git filter-branch and merging of signed tags

DISCUSSION Uwe Kleine-König 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

Consider I want to rewrite a commit that is a merge of a signed tag. In my case that's 064ca93f7ab927c2752d86fc5727716e340d737c that currently sits in linux-next:

	~/gsrc/linux$ git version
	git version 2.6.1
	~/gsrc/linux$ git checkout 064ca93f7ab927c2752d86fc5727716e340d737c
	~/gsrc/linux$ git cat-file commit HEAD
	tree 7086bbd51d06ebd0e3fcca70380d0a066efce6ef
	parent e44a01fa0e0aec2f3a21dadb9c030d14831d4258
	parent f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	author Arnd Bergmann <[email protected]> 1444139956 +0200
	committer Arnd Bergmann <[email protected]> 1444139956 +0200
	mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	 type commit
	 tag efm32-for-4.4-rc1
	 tagger Uwe Kleine-König <[email protected]> 1443549594 +0200
	 
	 efm32 cleanups for 4.4-rc1
	 
	 These are just two followup cleanups for commits that are in v3.17-rc1 and
	 waited in my private tree for application since that time.
	 -----BEGIN PGP SIGNATURE-----
	 
	 iQEcBAABCgAGBQJWCtIwAAoJEMH8FHityuwJFPYH/2LJpi0yUhI01s0D9U5rZgjl
	 8mLP70utAMaqXiGqP/O0ndH+za5TrrUTwDJE5jhAHru1Q6q62Ld2BfOR5+K8zlrP
	 4UDGBDj3ePJgEtbSsJYJIRT+AKque2GONbeGpJh2arPrNamWChKIz8HoGSgwdRlx
	 TvQuVFEa6C3ujP0ATM8x54f0vR4bYm9WmBS522DwZQY4JpGZC005A3Quw6fmFxPJ
	 vJRo1fE1d2OZ3Cuxb15m8PLtZw6sbMdMwgyirAFGrJsN9u/V6BzsSzH0s8suT7IP
	 WIohnmYtFSUfkQjaGrMl2wIpJSsIzettiXf9GrQDXSGZsQ4k7sW3U+qrcZ7ZUR4=
	 =ngv1
	 -----END PGP SIGNATURE-----

	Merge tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux into next/cleanup

	Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-Koenig:

	These are just two followup cleanups for commits that are in v3.17-rc1 and
	waited in my private tree for application since that time.

	* tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux:
	  ARM: efm32: switch to vendor,device compatible strings
	  ARM: efm32: switch to properly namespaced location property

OK, to fix my name in the commit log I do:

	 git filter-branch -f --msg-filter "sed 's/Kleine-Koenig/$(echo Kleine-K+APY-nig | iconv -f utf-7 -t utf-8)/'" HEAD ^HEAD^ ^HEAD^2

This destroys the mergetag, as now I have:

	~/gsrc/linux$ git cat-file commit HEAD
	tree 7086bbd51d06ebd0e3fcca70380d0a066efce6ef
	parent e44a01fa0e0aec2f3a21dadb9c030d14831d4258
	parent f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	author Arnd Bergmann <[email protected]> 1444139956 +0200
	committer Arnd Bergmann <[email protected]> 1444139956 +0200

	 efm32 cleanups for 4.4-rc1
	 
	 These are just two followup cleanups for commits that are in v3.17-rc1 and
	 waited in my private tree for application since that time.
	 -----BEGIN PGP SIGNATURE-----
	 
	 iQEcBAABCgAGBQJWCtIwAAoJEMH8FHityuwJFPYH/2LJpi0yUhI01s0D9U5rZgjl
	 8mLP70utAMaqXiGqP/O0ndH+za5TrrUTwDJE5jhAHru1Q6q62Ld2BfOR5+K8zlrP
	 4UDGBDj3ePJgEtbSsJYJIRT+AKque2GONbeGpJh2arPrNamWChKIz8HoGSgwdRlx
	 TvQuVFEa6C3ujP0ATM8x54f0vR4bYm9WmBS522DwZQY4JpGZC005A3Quw6fmFxPJ
	 vJRo1fE1d2OZ3Cuxb15m8PLtZw6sbMdMwgyirAFGrJsN9u/V6BzsSzH0s8suT7IP
	 WIohnmYtFSUfkQjaGrMl2wIpJSsIzettiXf9GrQDXSGZsQ4k7sW3U+qrcZ7ZUR4=
	 =ngv1
	 -----END PGP SIGNATURE-----

	Merge tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux into next/cleanup

	Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-König:

	These are just two followup cleanups for commits that are in v3.17-rc1 and
	waited in my private tree for application since that time.

	* tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux:
	  ARM: efm32: switch to vendor,device compatible strings
	  ARM: efm32: switch to properly namespaced location property

	~/gsrc/linux$ diff -u <(git cat-file commit HEAD) <(git cat-file commit 064ca93f7ab927c2752d86fc5727716e340d737c)
	--- /dev/fd/63	2015-11-02 09:02:17.310373539 +0100
	+++ /dev/fd/62	2015-11-02 09:02:17.310373539 +0100
	@@ -3,7 +3,11 @@
	 parent f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	 author Arnd Bergmann <[email protected]> 1444139956 +0200
	 committer Arnd Bergmann <[email protected]> 1444139956 +0200
	-
	+mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	+ type commit
	+ tag efm32-for-4.4-rc1
	+ tagger Uwe Kleine-König <[email protected]> 1443549594 +0200
	+ 
	  efm32 cleanups for 4.4-rc1
	  
	  These are just two followup cleanups for commits that are in v3.17-rc1 and
	@@ -21,7 +25,7 @@
	 
	 Merge tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux into next/cleanup
	 
	-Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-König:
	+Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-Koenig:
	 
	 These are just two followup cleanups for commits that are in v3.17-rc1 and
	 waited in my private tree for application since that time.

So now the PGP-Signature also appears in the regular commit log. So either remove the mergetag info completely or (preferably) keep it completely if the merged parent didn't change.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#1 lore raw

Uwe Kleine-König venit, vidit, dixit 02.11.2015 09:04:

Quoted 111 lines

Hello,

Consider I want to rewrite a commit that is a merge of a signed tag. In my case that's 064ca93f7ab927c2752d86fc5727716e340d737c that currently sits in linux-next:

	~/gsrc/linux$ git version
	git version 2.6.1
	~/gsrc/linux$ git checkout 064ca93f7ab927c2752d86fc5727716e340d737c
	~/gsrc/linux$ git cat-file commit HEAD
	tree 7086bbd51d06ebd0e3fcca70380d0a066efce6ef
	parent e44a01fa0e0aec2f3a21dadb9c030d14831d4258
	parent f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	author Arnd Bergmann <[email protected]> 1444139956 +0200
	committer Arnd Bergmann <[email protected]> 1444139956 +0200
	mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	 type commit
	 tag efm32-for-4.4-rc1
	 tagger Uwe Kleine-König <[email protected]> 1443549594 +0200
	 
	 efm32 cleanups for 4.4-rc1
	 
	 These are just two followup cleanups for commits that are in v3.17-rc1 and
	 waited in my private tree for application since that time.
	 -----BEGIN PGP SIGNATURE-----
	 
	 iQEcBAABCgAGBQJWCtIwAAoJEMH8FHityuwJFPYH/2LJpi0yUhI01s0D9U5rZgjl
	 8mLP70utAMaqXiGqP/O0ndH+za5TrrUTwDJE5jhAHru1Q6q62Ld2BfOR5+K8zlrP
	 4UDGBDj3ePJgEtbSsJYJIRT+AKque2GONbeGpJh2arPrNamWChKIz8HoGSgwdRlx
	 TvQuVFEa6C3ujP0ATM8x54f0vR4bYm9WmBS522DwZQY4JpGZC005A3Quw6fmFxPJ
	 vJRo1fE1d2OZ3Cuxb15m8PLtZw6sbMdMwgyirAFGrJsN9u/V6BzsSzH0s8suT7IP
	 WIohnmYtFSUfkQjaGrMl2wIpJSsIzettiXf9GrQDXSGZsQ4k7sW3U+qrcZ7ZUR4=
	 =ngv1
	 -----END PGP SIGNATURE-----

	Merge tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux into next/cleanup

	Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-Koenig:

	These are just two followup cleanups for commits that are in v3.17-rc1 and
	waited in my private tree for application since that time.

	* tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux:
	  ARM: efm32: switch to vendor,device compatible strings
	  ARM: efm32: switch to properly namespaced location property

OK, to fix my name in the commit log I do:

	 git filter-branch -f --msg-filter "sed 's/Kleine-Koenig/$(echo Kleine-K+APY-nig | iconv -f utf-7 -t utf-8)/'" HEAD ^HEAD^ ^HEAD^2

This destroys the mergetag, as now I have:

	~/gsrc/linux$ git cat-file commit HEAD
	tree 7086bbd51d06ebd0e3fcca70380d0a066efce6ef
	parent e44a01fa0e0aec2f3a21dadb9c030d14831d4258
	parent f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	author Arnd Bergmann <[email protected]> 1444139956 +0200
	committer Arnd Bergmann <[email protected]> 1444139956 +0200

	 efm32 cleanups for 4.4-rc1
	 
	 These are just two followup cleanups for commits that are in v3.17-rc1 and
	 waited in my private tree for application since that time.
	 -----BEGIN PGP SIGNATURE-----
	 
	 iQEcBAABCgAGBQJWCtIwAAoJEMH8FHityuwJFPYH/2LJpi0yUhI01s0D9U5rZgjl
	 8mLP70utAMaqXiGqP/O0ndH+za5TrrUTwDJE5jhAHru1Q6q62Ld2BfOR5+K8zlrP
	 4UDGBDj3ePJgEtbSsJYJIRT+AKque2GONbeGpJh2arPrNamWChKIz8HoGSgwdRlx
	 TvQuVFEa6C3ujP0ATM8x54f0vR4bYm9WmBS522DwZQY4JpGZC005A3Quw6fmFxPJ
	 vJRo1fE1d2OZ3Cuxb15m8PLtZw6sbMdMwgyirAFGrJsN9u/V6BzsSzH0s8suT7IP
	 WIohnmYtFSUfkQjaGrMl2wIpJSsIzettiXf9GrQDXSGZsQ4k7sW3U+qrcZ7ZUR4=
	 =ngv1
	 -----END PGP SIGNATURE-----

	Merge tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux into next/cleanup

	Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-König:

	These are just two followup cleanups for commits that are in v3.17-rc1 and
	waited in my private tree for application since that time.

	* tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux:
	  ARM: efm32: switch to vendor,device compatible strings
	  ARM: efm32: switch to properly namespaced location property

	~/gsrc/linux$ diff -u <(git cat-file commit HEAD) <(git cat-file commit 064ca93f7ab927c2752d86fc5727716e340d737c)
	--- /dev/fd/63	2015-11-02 09:02:17.310373539 +0100
	+++ /dev/fd/62	2015-11-02 09:02:17.310373539 +0100
	@@ -3,7 +3,11 @@
	 parent f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	 author Arnd Bergmann <[email protected]> 1444139956 +0200
	 committer Arnd Bergmann <[email protected]> 1444139956 +0200
	-
	+mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	+ type commit
	+ tag efm32-for-4.4-rc1
	+ tagger Uwe Kleine-König <[email protected]> 1443549594 +0200
	+ 
	  efm32 cleanups for 4.4-rc1
	  
	  These are just two followup cleanups for commits that are in v3.17-rc1 and
	@@ -21,7 +25,7 @@
	 
	 Merge tag 'efm32-for-4.4-rc1' of git://git.pengutronix.de/git/ukl/linux into next/cleanup
	 
	-Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-König:
	+Merge "efm32 cleanups for 4.4-rc1" from Uwe Kleine-Koenig:
	 
	 These are just two followup cleanups for commits that are in v3.17-rc1 and
	 waited in my private tree for application since that time.
Quoted 3 lines

So now the PGP-Signature also appears in the regular commit log. So either remove the mergetag info completely or (preferably) keep it completely if the merged parent didn't change.

Does your git include
a5a4b3f (filter-branch: remove multi-line headers in msg filter, 2015-10-08)? That takes care of the incomplete header tag parsing.

Should be in master by now, I think.

Keeping the mergetag signature would require some extra logic in filter-branch.

Michael

#2 lore raw

Hello Michael,

Quoted 7 lines · Michael J Gruber

Uwe Kleine-König venit, vidit, dixit 02.11.2015 09:04:

Quoted 2 lines
	~/gsrc/linux$ git version
	git version 2.6.1

Does your git include
a5a4b3f (filter-branch: remove multi-line headers in msg filter, 2015-10-08)? That takes care of the incomplete header tag parsing.

No, it does not. Thanks for the hint.

Quoted 4 lines

Should be in master by now, I think.

Keeping the mergetag signature would require some extra logic in filter-branch.

that I'd like to have :-). It seems I have to dig into that myself. (If someone is quicker than me, I promise not to be angry :-)

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |