提交 199c45bf 编写于 作者: J Junio C Hamano

Add %m to '--pretty=format:'

When used with '--boundary A...B', this shows the -/</> marker
you would get with --left-right option to 'git-log' family.
When symmetric diff is not used, everybody is shown to be on the
"right" branch.
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 6aead43d
...@@ -117,6 +117,7 @@ The placeholders are: ...@@ -117,6 +117,7 @@ The placeholders are:
- '%Cgreen': switch color to green - '%Cgreen': switch color to green
- '%Cblue': switch color to blue - '%Cblue': switch color to blue
- '%Creset': reset color - '%Creset': reset color
- '%m': left, right or boundary mark
- '%n': newline - '%n': newline
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "pkt-line.h" #include "pkt-line.h"
#include "utf8.h" #include "utf8.h"
#include "interpolate.h" #include "interpolate.h"
#include "diff.h"
#include "revision.h"
int save_commit_buffer = 1; int save_commit_buffer = 1;
...@@ -808,7 +810,8 @@ static long format_commit_message(const struct commit *commit, ...@@ -808,7 +810,8 @@ static long format_commit_message(const struct commit *commit,
{ "%Cgreen" }, /* green */ { "%Cgreen" }, /* green */
{ "%Cblue" }, /* blue */ { "%Cblue" }, /* blue */
{ "%Creset" }, /* reset color */ { "%Creset" }, /* reset color */
{ "%n" } /* newline */ { "%n" }, /* newline */
{ "%m" }, /* left/right/bottom */
}; };
enum interp_index { enum interp_index {
IHASH = 0, IHASH_ABBREV, IHASH = 0, IHASH_ABBREV,
...@@ -824,14 +827,15 @@ static long format_commit_message(const struct commit *commit, ...@@ -824,14 +827,15 @@ static long format_commit_message(const struct commit *commit,
ISUBJECT, ISUBJECT,
IBODY, IBODY,
IRED, IGREEN, IBLUE, IRESET_COLOR, IRED, IGREEN, IBLUE, IRESET_COLOR,
INEWLINE INEWLINE,
ILEFT_RIGHT,
}; };
struct commit_list *p; struct commit_list *p;
char parents[1024]; char parents[1024];
int i; int i;
enum { HEADER, SUBJECT, BODY } state; enum { HEADER, SUBJECT, BODY } state;
if (INEWLINE + 1 != ARRAY_SIZE(table)) if (ILEFT_RIGHT + 1 != ARRAY_SIZE(table))
die("invalid interp table!"); die("invalid interp table!");
/* these are independent of the commit */ /* these are independent of the commit */
...@@ -852,6 +856,12 @@ static long format_commit_message(const struct commit *commit, ...@@ -852,6 +856,12 @@ static long format_commit_message(const struct commit *commit,
interp_set_entry(table, ITREE_ABBREV, interp_set_entry(table, ITREE_ABBREV,
find_unique_abbrev(commit->tree->object.sha1, find_unique_abbrev(commit->tree->object.sha1,
DEFAULT_ABBREV)); DEFAULT_ABBREV));
interp_set_entry(table, ILEFT_RIGHT,
(commit->object.flags & BOUNDARY)
? "-"
: (commit->object.flags & SYMMETRIC_LEFT)
? "<"
: ">");
parents[1] = 0; parents[1] = 0;
for (i = 0, p = commit->parents; for (i = 0, p = commit->parents;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册