submodule: submodule_move_head omits old argument in forced case
[gitweb.git] / pretty.c
index 94eab5c89ee1a1fa696b9fc491a5846008a2a255..f7ce4902301490d73bdd79bd396cf7bbe5f893ea 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -1056,6 +1056,24 @@ static size_t parse_padding_placeholder(struct strbuf *sb,
        return 0;
 }
 
+static int match_placeholder_arg(const char *to_parse, const char *candidate,
+                                const char **end)
+{
+       const char *p;
+
+       if (!(skip_prefix(to_parse, candidate, &p)))
+               return 0;
+       if (*p == ',') {
+               *end = p + 1;
+               return 1;
+       }
+       if (*p == ')') {
+               *end = p;
+               return 1;
+       }
+       return 0;
+}
+
 static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
                                const char *placeholder,
                                void *context)
@@ -1168,11 +1186,11 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
                strbuf_addstr(sb, get_revision_mark(NULL, commit));
                return 1;
        case 'd':
-               load_ref_decorations(DECORATE_SHORT_REFS);
+               load_ref_decorations(NULL, DECORATE_SHORT_REFS);
                format_decorations(sb, commit, c->auto_color);
                return 1;
        case 'D':
-               load_ref_decorations(DECORATE_SHORT_REFS);
+               load_ref_decorations(NULL, DECORATE_SHORT_REFS);
                format_decorations_extended(sb, commit, c->auto_color, "", ", ", "");
                return 1;
        case 'g':               /* reflog info */
@@ -1285,11 +1303,16 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
 
        if (skip_prefix(placeholder, "(trailers", &arg)) {
                struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT;
-               while (*arg == ':') {
-                       if (skip_prefix(arg, ":only", &arg))
-                               opts.only_trailers = 1;
-                       else if (skip_prefix(arg, ":unfold", &arg))
-                               opts.unfold = 1;
+               if (*arg == ':') {
+                       arg++;
+                       for (;;) {
+                               if (match_placeholder_arg(arg, "only", &arg))
+                                       opts.only_trailers = 1;
+                               else if (match_placeholder_arg(arg, "unfold", &arg))
+                                       opts.unfold = 1;
+                               else
+                                       break;
+                       }
                }
                if (*arg == ')') {
                        format_trailers_from_commit(sb, msg + c->subject_off, &opts);