@matheusbsbs / matheus-bagliano / commits / 7fcda9201e
Fork 0

log: do not print ellipses with --abbrev-commit

'git log --abbrev-commit' added an ellipsis to all commit names that were abbreviated. This was particularly annoying if you wanted to cut&paste the sha1 from the terminal, since selecting by word would pick up '...' too. So use find_unique_abbrev() instead of diff_unique_abbrev() in all log-related commit sha1 printing routines, and also change the formatting of the 'Merge: parent1 parent2' line output via pretty_print_commit(). Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Rast committed Feb 13, 2009 at 23:10 UTC 7fcda9201e192413c2e63fe35ce6664dbc81705d
16 files changed +19 -21
log-tree.c
+4 -4
@@ -48,7 +48,7 @@ static void show_parents(struct commit *commit, int abbrev)
48 struct commit_list *p;
49 for (p = commit->parents; p ; p = p->next) {
50 struct commit *parent = p->item;
51 - printf(" %s", diff_unique_abbrev(parent->object.sha1, abbrev));
51 + printf(" %s", find_unique_abbrev(parent->object.sha1, abbrev));
52 }
53 }
54
@@ -280,7 +280,7 @@ void show_log(struct rev_info *opt)
280 putchar('>');
281 }
282 }
283 - fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
283 + fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
284 if (opt->print_parents)
285 show_parents(commit, abbrev_commit);
286 show_decorations(opt, commit);
@@ -348,13 +348,13 @@ void show_log(struct rev_info *opt)
348 putchar('>');
349 }
350 }
351 - fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),
351 + fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit),
352 stdout);
353 if (opt->print_parents)
354 show_parents(commit, abbrev_commit);
355 if (parent)
356 printf(" (from %s)",
357 - diff_unique_abbrev(parent->object.sha1,
357 + find_unique_abbrev(parent->object.sha1,
358 abbrev_commit));
359 show_decorations(opt, commit);
360 printf("%s", diff_get_color_opt(&opt->diffopt, DIFF_RESET));
pretty.c
+1 -3
@@ -210,15 +210,13 @@ static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb,
210 while (parent) {
211 struct commit *p = parent->item;
212 const char *hex = NULL;
213 - const char *dots;
213 if (abbrev)
214 hex = find_unique_abbrev(p->object.sha1, abbrev);
215 if (!hex)
216 hex = sha1_to_hex(p->object.sha1);
218 - dots = (abbrev && strlen(hex) != 40) ? "..." : "";
217 parent = parent->next;
218
221 - strbuf_addf(sb, " %s%s", hex, dots);
219 + strbuf_addf(sb, " %s", hex);
220 }
221 strbuf_addch(sb, '\n');
222 }
t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --patch-with-stat --summary master -- dir/
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--patch-with-stat_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --patch-with-stat master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--patch-with-stat_master_--_dir_
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --patch-with-stat master -- dir/
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --root --cc --patch-with-stat --summary master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--root_--patch-with-stat_--summary_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --root --patch-with-stat --summary master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--root_--patch-with-stat_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --root --patch-with-stat master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --root -c --patch-with-stat --summary master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--root_-p_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --root -p master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_--root_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log --root master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_-p_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log -p master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.log_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git log master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.show_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git show master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git whatchanged --root --cc --patch-with-stat --summary master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6
t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master
+1 -1
@@ -1,6 +1,6 @@
1 $ git whatchanged --root -c --patch-with-stat --summary master
2 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3 -Merge: 9a6d494... c7a2ab9...
3 +Merge: 9a6d494 c7a2ab9
4 Author: A U Thor <author@example.com>
5 Date: Mon Jun 26 00:04:00 2006 +0000
6