threads / discuss / 40706

git filter-branch and merging of signed tags

Subject: git filter-branch and merging of signed tags

## tl;dr

3 messages between Nov 2, 2015 and Nov 2, 2015.

replies: 2people: 2as markdown or json

Uwe Kleine-König· Nov 2, 2015, 08:04 UTC · lore
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 <arnd@arndb.de> 1444139956 +0200
	committer Arnd Bergmann <arnd@arndb.de> 1444139956 +0200
	mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	 type commit
	 tag efm32-for-4.4-rc1
	 tagger Uwe Kleine-König <uwe@kleine-koenig.org> 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 <arnd@arndb.de> 1444139956 +0200
	committer Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de> 1444139956 +0200
	 committer Arnd Bergmann <arnd@arndb.de> 1444139956 +0200
	-
	+mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
	+ type commit
	+ tag efm32-for-4.4-rc1
	+ tagger Uwe Kleine-König <uwe@kleine-koenig.org> 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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Michael J Gruber· Nov 2, 2015, 16:21 UTC · re: Uwe Kleine-König · lore

Re: git filter-branch and merging of signed tags

Uwe Kleine-König venit, vidit, dixit 02.11.2015 09:04:
Show 114 quoted 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 <arnd@arndb.de> 1444139956 +0200
> 	committer Arnd Bergmann <arnd@arndb.de> 1444139956 +0200
> 	mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
> 	 type commit
> 	 tag efm32-for-4.4-rc1
> 	 tagger Uwe Kleine-König <uwe@kleine-koenig.org> 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 <arnd@arndb.de> 1444139956 +0200
> 	committer Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de> 1444139956 +0200
> 	 committer Arnd Bergmann <arnd@arndb.de> 1444139956 +0200
> 	-
> 	+mergetag object f719a0d6a8541b383c506aaa4b4fa6b4109669f4
> 	+ type commit
> 	+ tag efm32-for-4.4-rc1
> 	+ tagger Uwe Kleine-König <uwe@kleine-koenig.org> 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.

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
Uwe Kleine-König· Nov 2, 2015, 17:13 UTC · re: Michael J Gruber · lore

Re: git filter-branch and merging of signed tags

Hello Michael,
On Mon, Nov 02, 2015 at 05:21:03PM +0100, Michael J Gruber wrote:
Show 7 quoted lines
> Uwe Kleine-König venit, vidit, dixit 02.11.2015 09:04:
> > 	~/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.
> 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

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

← back to recent threads