File: diff-stdin-test

package info (click to toggle)
tig 2.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,188 kB
  • sloc: ansic: 36,941; sh: 10,934; makefile: 394
file content (84 lines) | stat: -rwxr-xr-x 2,752 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh

. libtest.sh
. libgit.sh

steps '
	:save-display diff.screen
'

git_init

test_tig show <<EOF
commit 1b4c64b595aeb4de1d317d669faacd3c1d82f0b0
Author: Sven Wegener <sven.wegener@example.net>
Date:   Sun Jul 2 15:01:24 2017 +0200

    graph: Optimize initial and merge calculation
    
    The initial and merge flags do not depend on any column-specific
    information, so calculate them only once.
    
    Signed-off-by: Sven Wegener <sven.wegener@example.net>
---
 src/graph-v2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/graph-v2.c b/src/graph-v2.c
index 4cf3d9e..ced6838 100644
--- a/src/graph-v2.c
+++ b/src/graph-v2.c
@@ -683,6 +683,9 @@ graph_generate_symbols(struct graph_v2 *graph, struct graph_canvas *canvas)
 	struct graph_row *row = &graph->row;
 	struct graph_row *next_row = &graph->next_row;
 	struct graph_row *parents = &graph->parents;
+	int commits = commits_in_row(parents);
+	int initial = commits < 1;
+	int merge = commits > 1;
 	int pos;
 
 	for (pos = 0; pos < row->size; pos++) {
@@ -692,8 +695,8 @@ graph_generate_symbols(struct graph_v2 *graph, struct graph_canvas *canvas)
 
 		symbol->commit            = (pos == graph->position);
 		symbol->boundary          = (pos == graph->position && next_row->columns[pos].symbol.boundary);
-		symbol->initial           = (commits_in_row(parents) < 1);
-		symbol->merge             = (commits_in_row(parents) > 1);
+		symbol->initial           = initial;
+		symbol->merge             = merge;
 
 		symbol->continued_down    = continued_down(row, next_row, pos);
 		symbol->continued_up      = continued_down(prev_row, row, pos);
EOF

assert_equals 'diff.screen' <<EOF
commit 1b4c64b595aeb4de1d317d669faacd3c1d82f0b0
Author: Sven Wegener <sven.wegener@example.net>
Date:   Sun Jul 2 15:01:24 2017 +0200
 
    graph: Optimize initial and merge calculation
 
    The initial and merge flags do not depend on any column-specific
    information, so calculate them only once.
 
    Signed-off-by: Sven Wegener <sven.wegener@example.net>
---
 src/graph-v2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
 
diff --git a/src/graph-v2.c b/src/graph-v2.c
index 4cf3d9e..ced6838 100644
--- a/src/graph-v2.c
+++ b/src/graph-v2.c
@@ -683,6 +683,9 @@ graph_generate_symbols(struct graph_v2 *graph, struct graph_
        struct graph_row *row = &graph->row;
        struct graph_row *next_row = &graph->next_row;
        struct graph_row *parents = &graph->parents;
+       int commits = commits_in_row(parents);
+       int initial = commits < 1;
+       int merge = commits > 1;
        int pos;
 
        for (pos = 0; pos < row->size; pos++) {
[diff] 1b4c64b595aeb4de1d317d669faacd3c1d82f0b0 - line 1 of 39               71%
EOF