push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'
[gitweb.git] / combine-diff.c
index 35c817bb2c52399c6eaaebb23dc6c3ba05c0ea2b..35d41cd56d2ddb8df416e5e422552ec473294055 100644 (file)
@@ -989,14 +989,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
        free(sline);
 }
 
-#define COLONS "::::::::::::::::::::::::::::::::"
-
 static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
 {
        struct diff_options *opt = &rev->diffopt;
-       int i, offset;
-       const char *prefix;
-       int line_termination, inter_name_termination;
+       int line_termination, inter_name_termination, i;
        const char *line_prefix = diff_line_prefix(opt);
 
        line_termination = opt->line_termination;
@@ -1007,19 +1003,18 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
        if (rev->loginfo && !rev->no_commit_id)
                show_log(rev);
 
+
        if (opt->output_format & DIFF_FORMAT_RAW) {
                printf("%s", line_prefix);
-               offset = strlen(COLONS) - num_parent;
-               if (offset < 0)
-                       offset = 0;
-               prefix = COLONS + offset;
+
+               /* As many colons as there are parents */
+               for (i = 0; i < num_parent; i++)
+                       putchar(':');
 
                /* Show the modes */
-               for (i = 0; i < num_parent; i++) {
-                       printf("%s%06o", prefix, p->parent[i].mode);
-                       prefix = " ";
-               }
-               printf("%s%06o", prefix, p->mode);
+               for (i = 0; i < num_parent; i++)
+                       printf("%06o ", p->parent[i].mode);
+               printf("%06o", p->mode);
 
                /* Show sha1's */
                for (i = 0; i < num_parent; i++)