4b3a8fd6e0fec22f9072ca0806f7fff4bef5a43f
1 Description: Fixed regression breaking the graph when path spec is specified.
2 (cf. upstream commit 5579a6ff047c0d1b319b5452a8443000921d7da1)
3 Author: Jonas Fonseca <fonseca@diku.dk>
5 diff --git a/git.h b/git.h
6 index 8179261..e237683 100644
7 --- a/git.h
8 +++ b/git.h
9 @@ -47,9 +47,8 @@
10 GIT_DIFF_INITIAL("", context_arg, space_arg, "/dev/null", new_name)
12 #define GIT_MAIN_LOG(diffargs, revargs, fileargs) \
13 - "git", "log", ENCODING_ARG, "--no-color", "--date=raw", \
14 + "git", "log", ENCODING_ARG, "--no-color", "--pretty=raw", "--parents", \
15 opt_commit_order_arg, (diffargs), (revargs), \
16 - "--pretty=format:commit %m%H %P%nauthor %an <%ae> %ad%ntitle %s", \
17 "--", (fileargs), NULL
19 #endif
20 diff --git a/tig.c b/tig.c
21 index 69c3a56..3b26ba1 100644
22 --- a/tig.c
23 +++ b/tig.c
24 @@ -6949,6 +6949,7 @@ main_read(struct view *view, char *line)
25 struct graph *graph = view->private;
26 enum line_type type;
27 struct commit *commit;
28 + static bool in_header;
30 if (!line) {
31 if (!view->lines && !view->prev)
32 @@ -6970,6 +6971,7 @@ main_read(struct view *view, char *line)
33 if (type == LINE_COMMIT) {
34 bool is_boundary;
36 + in_header = TRUE;
37 line += STRING_SIZE("commit ");
38 is_boundary = *line == '-';
39 if (is_boundary || !isalnum(*line))
40 @@ -6985,6 +6987,10 @@ main_read(struct view *view, char *line)
41 return TRUE;
42 commit = view->line[view->lines - 1].data;
44 + /* Empty line separates the commit header from the log itself. */
45 + if (*line == '\0')
46 + in_header = FALSE;
47 +
48 switch (type) {
49 case LINE_PARENT:
50 if (!graph->has_parents)
51 @@ -7002,7 +7008,15 @@ main_read(struct view *view, char *line)
52 if (commit->title[0])
53 break;
55 - line += STRING_SIZE("title ");
56 + /* Skip lines in the commit header. */
57 + if (in_header)
58 + break;
59 +
60 + /* Require titles to start with a non-space character at the
61 + * offset used by git log. */
62 + if (strncmp(line, " ", 4))
63 + break;
64 + line += 4;
65 /* Well, if the title starts with a whitespace character,
66 * try to be forgiving. Otherwise we end up with no title. */
67 while (isspace(*line))