merge: remove drop_save() in favor of remove_merge_branch_state()
[gitweb.git] / pretty.c
index e89b89248e823f8c86bfd29ad82eb8c05b3cb840..0ab45d10d702373e212fb36e4fa66feb26669ee7 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -1085,6 +1085,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
        struct commit_list *p;
        const char *arg;
        int ch;
+       char **slot;
 
        /* these are independent of the commit */
        switch (placeholder[0]) {
@@ -1195,6 +1196,14 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
                load_ref_decorations(NULL, DECORATE_SHORT_REFS);
                format_decorations_extended(sb, commit, c->auto_color, "", ", ", "");
                return 1;
+       case 'S':               /* tag/branch like --source */
+               if (!(c->pretty_ctx->rev && c->pretty_ctx->rev->sources))
+                       return 0;
+               slot = revision_sources_at(c->pretty_ctx->rev->sources, commit);
+               if (!(slot && *slot))
+                       return 0;
+               strbuf_addstr(sb, *slot);
+               return 1;
        case 'g':               /* reflog info */
                switch(placeholder[1]) {
                case 'd':       /* reflog selector */
@@ -1499,6 +1508,9 @@ static size_t userformat_want_item(struct strbuf *sb, const char *placeholder,
        case 'N':
                w->notes = 1;
                break;
+       case 'S':
+               w->source = 1;
+               break;
        }
        return 0;
 }