diff --quiet: disable optimization when --diff-filter=X is used
[gitweb.git] / log-tree.c
index 56a34885924f32559f6829c43a24541cb0fea1ac..6f73c17d74bee326a40505b29bba762bade2451e 100644 (file)
@@ -25,6 +25,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
        struct object *obj = parse_object(sha1);
        if (!obj)
                return 0;
+       refname = prettify_refname(refname);
        add_name_decoration("", refname, obj);
        while (obj->type == OBJ_TAG) {
                obj = ((struct tag *)obj)->tagged;
@@ -187,17 +188,12 @@ void get_patch_filename(struct commit *commit, int nr, const char *suffix,
 
        strbuf_addf(buf, commit ? "%04d-" : "%d", nr);
        if (commit) {
+               int max_len = start_len + FORMAT_PATCH_NAME_MAX - suffix_len;
+
                format_commit_message(commit, "%f", buf, DATE_NORMAL);
-               /*
-                * Replace characters at the end with the suffix if the
-                * filename is too long
-                */
-               if (buf->len + suffix_len > FORMAT_PATCH_NAME_MAX + start_len)
-                       strbuf_splice(buf,
-                               start_len + FORMAT_PATCH_NAME_MAX - suffix_len,
-                               suffix_len, suffix, suffix_len);
-               else
-                       strbuf_addstr(buf, suffix);
+               if (max_len < buf->len)
+                       strbuf_setlen(buf, max_len);
+               strbuf_addstr(buf, suffix);
        }
 }
 
@@ -325,7 +321,8 @@ void show_log(struct rev_info *opt)
        }
 
        /*
-        * If use_terminator is set, add a newline at the end of the entry.
+        * If use_terminator is set, we already handled any record termination
+        * at the end of the last record.
         * Otherwise, add a diffopt.line_termination character before all
         * entries but the first.  (IOW, as a separator between entries)
         */