Browse Source

remote.<name>.gcrypt-participants overwritten on pull

jigen 8 years ago
parent
commit
c55e1fdd9b
1 changed files with 21 additions and 1 deletions
  1. 21 1
      git-remote-gcrypt

+ 21 - 1
git-remote-gcrypt

@@ -337,6 +337,18 @@ PRIVENCRYPT()
 	rungpg --compress-algo none --trust-model=always -se "$@"
 }
 
+
+GET_RECIPIENTS()
+{
+    keys_id=$(rungpg --list-only --no-default-keyring --secret-keyring /dev/null \
+		     $1 2>&1 | awk -c '/gpg/{ gsub(",","",$8 ); print $8  }')
+    for k in $keys_id; do
+	fp=$(rungpg --with-colons --fingerprint $k | awk -F: -c '/^fpr/{print $10}')
+	fingerprints="$fingerprints $fp"
+	echo -n "$fp "
+    done
+}
+
 # $1 is the match for good signature, $2 is the textual signers list
 PRIVDECRYPT()
 {
@@ -466,7 +478,7 @@ read_config()
 ensure_connected()
 {
 	local manifest_= r_repoid= r_name= url_frag= r_sigmatch= r_signers= \
-		tmp_manifest=
+		tmp_manifest= r_participants=
 
 	if isnonnull "$Did_find_repo"
 	then
@@ -513,6 +525,10 @@ ensure_connected()
 	manifest_=$(PRIVDECRYPT "$r_sigmatch" "$r_signers" < "$tmp_manifest") &&
 		isnonnull "$manifest_" ||
 		echo_die "Failed to decrypt manifest!"
+
+	# Getting repository participants parsing GPG file recipients
+	r_participants=$(GET_RECIPIENTS "$tmp_manifest")
+	echo_info $r_participants
 	rm -f "$tmp_manifest"
 
 	filter_to @Refslist "$Hex40 *" "$manifest_"
@@ -540,6 +556,10 @@ ensure_connected()
 	fi
 
 	isnull "$r_name" || git config "remote.$r_name.gcrypt-id" "$r_repoid"
+	isnull "$r_participants" || (git config \
+					"remote.$r_name.gcrypt-participants" \
+					"$r_participants" && \
+		git config "remote.$r_name.gcrypt-publish-participants" true)
 }
 
 # $1 is the hash type (SHA256 etc)