Re: [PATCH v8 3/5] merge/pull: verify GPG signatures of commits being merged

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sebastian Götte <jaseg@xxxxxxxxxxxxxxxxxxx> writes:

> +	if (verify_signatures) {
> +		for (p = remoteheads; p; p = p->next) {
> +			struct commit *commit = p->item;
> +			char hex[41];
> +			struct signature_check signature_check;
> +			memset(&signature_check, 0, sizeof(signature_check));
> +
> +			check_commit_signature(commit, &signature_check);
> +
> +			strcpy(hex, find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
> +			switch(signature_check.result){
> +				case 'G':
> +					break;
> +				case 'B':
> +					die(_("Commit %s has a bad GPG signature allegedly by %s."), hex, signature_check.signer);
> +				default: /* 'N' */
> +					die(_("Commit %s does not have a GPG signature."), hex, hex);

Count %s and number and arguments.

> +			}

Style.

        switch (expr) {
	case 'G':
		do_something_for_G();
		break;
		...
	}

Also avoid overlong lines.

I'll squash in something like the following and push out the result
on 'pu' tonight.  Please check to see if I made silly mistakes while
doing so.

Thanks.

 builtin/merge.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/builtin/merge.c b/builtin/merge.c
index 7a33d03..e57c42c 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1245,16 +1245,18 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 			check_commit_signature(commit, &signature_check);
 
 			strcpy(hex, find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
-			switch(signature_check.result){
-				case 'G':
-					break;
-				case 'B':
-					die(_("Commit %s has a bad GPG signature allegedly by %s."), hex, signature_check.signer);
-				default: /* 'N' */
-					die(_("Commit %s does not have a GPG signature."), hex, hex);
+			switch (signature_check.result) {
+			case 'G':
+				break;
+			case 'B':
+				die(_("Commit %s has a bad GPG signature "
+				      "allegedly by %s."), hex, signature_check.signer);
+			default: /* 'N' */
+				die(_("Commit %s does not have a GPG signature."), hex);
 			}
 			if (verbosity >= 0 && signature_check.result == 'G')
-				printf(_("Commit %s has a good GPG signature by %s\n"), hex, signature_check.signer);
+				printf(_("Commit %s has a good GPG signature by %s\n"),
+				       hex, signature_check.signer);
 
 			free(signature_check.gpg_output);
 			free(signature_check.gpg_status);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]