Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Apr 12, 2007
1 parent 6aead43 commit 199c45b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions Documentation/pretty-formats.txt
Expand Up @@ -117,6 +117,7 @@ The placeholders are:
- '%Cgreen': switch color to green
- '%Cblue': switch color to blue
- '%Creset': reset color
- '%m': left, right or boundary mark
- '%n': newline


Expand Down
16 changes: 13 additions & 3 deletions commit.c
Expand Up @@ -4,6 +4,8 @@
#include "pkt-line.h"
#include "utf8.h"
#include "interpolate.h"
#include "diff.h"
#include "revision.h"

int save_commit_buffer = 1;

Expand Down Expand Up @@ -808,7 +810,8 @@ static long format_commit_message(const struct commit *commit,
{ "%Cgreen" }, /* green */
{ "%Cblue" }, /* blue */
{ "%Creset" }, /* reset color */
{ "%n" } /* newline */
{ "%n" }, /* newline */
{ "%m" }, /* left/right/bottom */
};
enum interp_index {
IHASH = 0, IHASH_ABBREV,
Expand All @@ -824,14 +827,15 @@ static long format_commit_message(const struct commit *commit,
ISUBJECT,
IBODY,
IRED, IGREEN, IBLUE, IRESET_COLOR,
INEWLINE
INEWLINE,
ILEFT_RIGHT,
};
struct commit_list *p;
char parents[1024];
int i;
enum { HEADER, SUBJECT, BODY } state;

if (INEWLINE + 1 != ARRAY_SIZE(table))
if (ILEFT_RIGHT + 1 != ARRAY_SIZE(table))
die("invalid interp table!");

/* these are independent of the commit */
Expand All @@ -852,6 +856,12 @@ static long format_commit_message(const struct commit *commit,
interp_set_entry(table, ITREE_ABBREV,
find_unique_abbrev(commit->tree->object.sha1,
DEFAULT_ABBREV));
interp_set_entry(table, ILEFT_RIGHT,
(commit->object.flags & BOUNDARY)
? "-"
: (commit->object.flags & SYMMETRIC_LEFT)
? "<"
: ">");

parents[1] = 0;
for (i = 0, p = commit->parents;
Expand Down

0 comments on commit 199c45b

Please sign in to comment.