Attached is an updated version of the patch.

This fixes a bug in the previous patch which would cause git-dpm-tag to fail 
when trying to re-tag the same upstream commit, because the annotated tag is a 
different object to the commit that it points to.

X

Ximin Luo:
> Hi, attached is a patch that implements this.
> 
> I was lazy, the patch is a bit lacking because it forces the tag to be signed 
> and no longer allows unsigned tags. However personally I don't see an issue 
> with that, in the context of Debian anyway.
> 
> X
> 
> On Thu, 7 Jan 2016 22:26:42 +0300 Dmitry Shachnev <mity...@debian.org> wrote:
>> Package: git-dpm
>> Version: 0.9.1-1
>> Severity: wishlist
>>
>> It would be nice if git-dpm tag command supported signed tags.
>>
>> Maybe make it possible to pass arbitrary arguments to git tag?
>>
>> --
>> Dmitry Shachnev
> 


-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
--- a/git-dpm	2016-12-12 11:49:59.049343163 +0100
+++ b/git-dpm	2016-12-12 11:50:23.099963581 +0100
@@ -2457,6 +2457,7 @@
 ##:function settag notsilent =gitcheck
 function settag() { # name newvalue force
 	local oldrev
+	local msg="$1"; shift
 
 	if test x"$1" = x"NONE" ; then
 		return 0
@@ -2466,8 +2467,8 @@
 		if $notsilent ; then
 			echo "Creating new tag '$1'..."
 		fi
-		gitcmd tag "$1" "$2"
-	elif [ x"$oldrev" = x"$2" ] ; then
+		gitcmd tag -asm "$msg" "$1" "$2"
+	elif [ x"$oldrev" = x"$2" -o x"$(git rev-list -n1 "$oldrev")" = x"$2" ] ; then
 		if $notsilent ; then
 			echo "'$1' already up to date"
 		else
@@ -2477,7 +2478,7 @@
 		if $notsilent ; then
 			echo "Replacing tag '$1'..."
 		fi
-		gitcmd tag -f "$1" "$2"
+		gitcmd tag -asm "$msg" -f "$1" "$2"
 	else
 		printerror "tag '$1' already exists and differs!"
 		return 1
@@ -2701,9 +2702,9 @@
 	debiantag="$(createtagname "$debiantag" "debian" \
 			"${nameprefix}debian$epoch-$version")" || return 1
 
-	settag "$upstreamtag" "$control_upstream" "$dorefreshupstream" || return 1
-	settag "$patchedtag" "$control_patched" "$dorefresh" || return 1
-	settag "$debiantag" "$DEBIANREV" "$dorefresh" || return 1
+	settag "$packagename upstream release $uversion" "$upstreamtag" "$control_upstream" "$dorefreshupstream" || return 1
+	settag "$packagename patched upstream for Debian release $version" "$patchedtag" "$control_patched" "$dorefresh" || return 1
+	settag "$packagename Debian release $version" "$debiantag" "$DEBIANREV" "$dorefresh" || return 1
 }
 
 ##:function do_reftag =subcommand
@@ -2856,9 +2857,9 @@
 	debiantag="$(createtagname "$debiantag" "debian" \
 			"${nameprefix}debian$epoch-$version")" || return 1
 
-	settag  "$upstreamtag" "$control_upstream" "$dorefreshupstream" || return 1
-	settag  "$patchedtag" "$control_patched" "$dorefresh" || return 1
-	settag  "$debiantag" "$totag" "$dorefresh" || return 1
+	settag "$packagename upstream release $uversion" "$upstreamtag" "$control_upstream" "$dorefreshupstream" || return 1
+	settag "$packagename patched upstream for Debian release $version" "$patchedtag" "$control_patched" "$dorefresh" || return 1
+	settag "$packagename Debian release $version" "$debiantag" "$totag" "$dorefresh" || return 1
 }
 
 ############ common stuff ###############

Reply via email to