Skip to content

Commit dbd04eb

Browse files
committed
Merge branch 'dj/log-graph-with-no-walk'
"git log --graph --no-walk A B..." is a otcnflicting request that asks nonsense; no-walk tells us show discrete points in the history, while graph asks to draw connections between these discrete points. Forbid the combination. * dj/log-graph-with-no-walk: revision: forbid combining --graph and --no-walk
2 parents 257b204 + 695985f commit dbd04eb

File tree

6 files changed

+23
-7
lines changed

6 files changed

+23
-7
lines changed

Documentation/rev-list-options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ endif::git-rev-list[]
680680
given on the command line. Otherwise (if `sorted` or no argument
681681
was given), the commits are shown in reverse chronological order
682682
by commit time.
683+
Cannot be combined with `--graph`.
683684

684685
--do-walk::
685686
Overrides a previous `--no-walk`.
@@ -782,6 +783,7 @@ you would get an output like this:
782783
on the left hand side of the output. This may cause extra lines
783784
to be printed in between commits, in order for the graph history
784785
to be drawn properly.
786+
Cannot be combined with `--no-walk`.
785787
+
786788
This enables parent rewriting, see 'History Simplification' below.
787789
+

revision.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,6 +2339,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
23392339

23402340
if (revs->reflog_info && revs->graph)
23412341
die("cannot combine --walk-reflogs with --graph");
2342+
if (revs->no_walk && revs->graph)
2343+
die("cannot combine --no-walk with --graph");
23422344
if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
23432345
die("cannot use --grep-reflog without --walk-reflogs");
23442346

t/t4052-stat-output.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ do
9999
test_cmp "$expect" actual
100100
'
101101

102-
test "$cmd" != diff || continue
102+
case "$cmd" in diff|show) continue;; esac
103103

104104
test_expect_success "$cmd --graph $verb COLUMNS (big change)" '
105105
COLUMNS=200 git $cmd $args --graph >output
@@ -127,7 +127,7 @@ do
127127
test_cmp "$expect" actual
128128
'
129129

130-
test "$cmd" != diff || continue
130+
case "$cmd" in diff|show) continue;; esac
131131

132132
test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" '
133133
COLUMNS=40 git $cmd $args --graph >output
@@ -155,7 +155,7 @@ do
155155
test_cmp "$expect" actual
156156
'
157157

158-
test "$cmd" != diff || continue
158+
case "$cmd" in diff|show) continue;; esac
159159

160160
test_expect_success "$cmd --graph $verb statGraphWidth config" '
161161
git -c diff.statGraphWidth=26 $cmd $args --graph >output
@@ -196,7 +196,7 @@ do
196196
test_cmp expect actual
197197
'
198198

199-
test "$cmd" != diff || continue
199+
case "$cmd" in diff|show) continue;; esac
200200

201201
test_expect_success "$cmd --stat-width=width --graph with big change" '
202202
git $cmd $args --stat-width=40 --graph >output
@@ -236,7 +236,7 @@ do
236236
test_cmp expect actual
237237
'
238238

239-
test "$cmd" != diff || continue
239+
case "$cmd" in diff|show) continue;; esac
240240

241241
test_expect_success "$cmd --stat=width --graph with big change is balanced" '
242242
git $cmd $args --stat-width=60 --graph >output &&
@@ -270,7 +270,7 @@ do
270270
test_cmp "$expect" actual
271271
'
272272

273-
test "$cmd" != diff || continue
273+
case "$cmd" in diff|show) continue;; esac
274274

275275
test_expect_success "$cmd --graph $verb COLUMNS (long filename)" '
276276
COLUMNS=200 git $cmd $args --graph >output
@@ -299,7 +299,7 @@ do
299299
test_cmp "$expect" actual
300300
'
301301

302-
test "$cmd" != diff || continue
302+
case "$cmd" in diff|show) continue;; esac
303303

304304
test_expect_success COLUMNS_CAN_BE_1 \
305305
"$cmd --graph $verb prefix greater than COLUMNS (big change)" '

t/t4202-log.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,4 +887,8 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
887887
grep "^| | gpg: Good signature" actual
888888
'
889889

890+
test_expect_success 'log --graph --no-walk is forbidden' '
891+
test_must_fail git log --graph --no-walk
892+
'
893+
890894
test_done

t/t6014-rev-list-all.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ test_expect_success 'repack does not lose detached HEAD' '
3535
3636
'
3737

38+
test_expect_success 'rev-list --graph --no-walk is forbidden' '
39+
test_must_fail git rev-list --graph --no-walk HEAD
40+
'
41+
3842
test_done

t/t7007-show.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,8 @@ test_expect_success '--quiet suppresses diff' '
124124
test_cmp expect actual
125125
'
126126

127+
test_expect_success 'show --graph is forbidden' '
128+
test_must_fail git show --graph HEAD
129+
'
130+
127131
test_done

0 commit comments

Comments
 (0)