Merge branch 'mg/gpg-richer-status'
authorJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2016 20:14:45 +0000 (13:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2016 20:14:45 +0000 (13:14 -0700)
The GPG verification status shown in "%G?" pretty format specifier
was not rich enough to differentiate a signature made by an expired
key, a signature made by a revoked key, etc. New output letters
have been assigned to express them.

* mg/gpg-richer-status:
gpg-interface: use more status letters

1  2 
Documentation/pretty-formats.txt
pretty.c
index 69c289dd0cdb2b344b7051d25c4889b824e21f9c,179c9389aa37bf54bc38ad1798ea8029f211b435..3bcee2ddb1244c7ef52888d1de2654a688f6702f
@@@ -143,8 -143,14 +143,14 @@@ ifndef::git-rev-list[
  - '%N': commit notes
  endif::git-rev-list[]
  - '%GG': raw verification message from GPG for a signed commit
- - '%G?': show "G" for a good (valid) signature, "B" for a bad signature,
-   "U" for a good signature with unknown validity and "N" for no signature
+ - '%G?': show "G" for a good (valid) signature,
+   "B" for a bad signature,
+   "U" for a good signature with unknown validity,
+   "X" for a good signature that has expired,
+   "Y" for a good signature made by an expired key,
+   "R" for a good signature made by a revoked key,
+   "E" if the signature cannot be checked (e.g. missing key)
+   and "N" for no signature
  - '%GS': show the name of the signer for a signed commit
  - '%GK': show the key used to sign a signed commit
  - '%gD': reflog selector, e.g., `refs/stash@{1}` or
  - '%Cgreen': switch color to green
  - '%Cblue': switch color to blue
  - '%Creset': reset color
 -- '%C(...)': color specification, as described in color.branch.* config option;
 +- '%C(...)': color specification, as described under Values in the
 +  "CONFIGURATION FILE" section of linkgit:git-config[1];
    adding `auto,` at the beginning will emit color only when colors are
    enabled for log output (by `color.diff`, `color.ui`, or `--color`, and
    respecting the `auto` settings of the former if we are going to a
diff --combined pretty.c
index 0c3149524059bd46c3c6d70bd774df0aaa65f976,f98b271069c8c184e4381dfbb4fc976707227279..37b2c3b1f9954d79bf799a3af979e8c337698b79
+++ b/pretty.c
@@@ -544,13 -544,15 +544,13 @@@ static void add_merge_info(const struc
        strbuf_addstr(sb, "Merge:");
  
        while (parent) {
 -              struct commit *p = parent->item;
 -              const char *hex = NULL;
 +              struct object_id *oidp = &parent->item->object.oid;
 +              strbuf_addch(sb, ' ');
                if (pp->abbrev)
 -                      hex = find_unique_abbrev(p->object.oid.hash, pp->abbrev);
 -              if (!hex)
 -                      hex = oid_to_hex(&p->object.oid);
 +                      strbuf_add_unique_abbrev(sb, oidp->hash, pp->abbrev);
 +              else
 +                      strbuf_addstr(sb, oid_to_hex(oidp));
                parent = parent->next;
 -
 -              strbuf_addf(sb, " %s", hex);
        }
        strbuf_addch(sb, '\n');
  }
@@@ -1070,7 -1072,7 +1070,7 @@@ static size_t format_commit_one(struct 
        case 'C':
                if (starts_with(placeholder + 1, "(auto)")) {
                        c->auto_color = want_color(c->pretty_ctx->color);
 -                      if (c->auto_color)
 +                      if (c->auto_color && sb->len)
                                strbuf_addstr(sb, GIT_COLOR_RESET);
                        return 7; /* consumed 7 bytes, "C(auto)" */
                } else {
                        switch (c->signature_check.result) {
                        case 'G':
                        case 'B':
+                       case 'E':
                        case 'U':
                        case 'N':
+                       case 'X':
+                       case 'Y':
+                       case 'R':
                                strbuf_addch(sb, c->signature_check.result);
                        }
                        break;