Code

Merge branch 'jh/diff-index-line-abbrev'
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Jun 2010 18:16:56 +0000 (11:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Jun 2010 18:16:56 +0000 (11:16 -0700)
* jh/diff-index-line-abbrev:
  diff.c: Ensure "index $from..$to" line contains unambiguous SHA1s

Conflicts:
diff.c

1  2 
diff.c

diff --cc diff.c
index c82b605a942b8611c3eaf0e41a173185fdb40779,1aefa663752965169c8cc5e0e40147c956bc4917..b53b6ec8e2ced8c94c0353dddf07ca5c1dd79978
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -2430,13 -2419,15 +2430,13 @@@ static void fill_metainfo(struct strbu
                            (!fill_mmfile(&mf, two) && diff_filespec_is_binary(two)))
                                abbrev = 40;
                }
-               strbuf_addf(msg, "%sindex %.*s..%.*s", set,
-                           abbrev, sha1_to_hex(one->sha1),
-                           abbrev, sha1_to_hex(two->sha1));
 -              strbuf_addf(msg, "index %s..",
++              strbuf_addf(msg, "%sindex %s..", set,
+                           find_unique_abbrev(one->sha1, abbrev));
+               strbuf_addstr(msg, find_unique_abbrev(two->sha1, abbrev));
                if (one->mode == two->mode)
                        strbuf_addf(msg, " %06o", one->mode);
 -              strbuf_addch(msg, '\n');
 +              strbuf_addf(msg, "%s\n", reset);
        }
 -      if (msg->len)
 -              strbuf_setlen(msg, msg->len - 1);
  }
  
  static void run_diff_cmd(const char *pgm,