Merge branch 'jk/pretty-empty-format'
authorJunio C Hamano <gitster@pobox.com>
Tue, 2 Sep 2014 20:25:03 +0000 (13:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Sep 2014 20:25:04 +0000 (13:25 -0700)
"git log --pretty/format=" with an empty format string did not mean
the more obvious "No output whatsoever" but "Use default format",
which was counterintuitive.

* jk/pretty-empty-format:
pretty: make empty userformats truly empty
pretty: treat "--format=" as an empty userformat
revision: drop useless string offset when parsing "--pretty"

1  2 
combine-diff.c
diff --combined combine-diff.c
index 60cb4f81f9788efeff21d05d48f2183e94765385,1a1e6598e242f28106b3b371efa3d4c09fa13cfe..91edce58e15b82428fcc5f3b006e23bf5380d38c
  #include "sha1-array.h"
  #include "revision.h"
  
 +static int compare_paths(const struct combine_diff_path *one,
 +                        const struct diff_filespec *two)
 +{
 +      if (!S_ISDIR(one->mode) && !S_ISDIR(two->mode))
 +              return strcmp(one->path, two->path);
 +
 +      return base_name_compare(one->path, strlen(one->path), one->mode,
 +                               two->path, strlen(two->path), two->mode);
 +}
 +
  static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr, int n, int num_parent)
  {
        struct diff_queue_struct *q = &diff_queued_diff;
@@@ -62,7 -52,7 +62,7 @@@
        i = 0;
        while ((p = *tail) != NULL) {
                cmp = ((i >= q->nr)
 -                     ? -1 : strcmp(p->path, q->queue[i]->two->path));
 +                     ? -1 : compare_paths(p, q->queue[i]->two));
  
                if (cmp < 0) {
                        /* p->path not in q->queue[]; drop it */
@@@ -1407,7 -1397,8 +1407,8 @@@ void diff_tree_combined(const unsigned 
                show_log(rev);
  
                if (rev->verbose_header && opt->output_format &&
-                   opt->output_format != DIFF_FORMAT_NO_OUTPUT)
+                   opt->output_format != DIFF_FORMAT_NO_OUTPUT &&
+                   !commit_format_is_empty(rev->commit_format))
                        printf("%s%c", diff_line_prefix(opt),
                               opt->line_termination);
        }