Having --pretty=medium as the default almost always makes the graph too difficult to follow. Signed-off-by: Alex Henrie <alexhenrie24@xxxxxxxxx> --- builtin/log.c | 5 +++++ t/t4052-stat-output.sh | 14 +++++++------- t/t4202-log.sh | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index ab859f5904..4fca910fee 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -199,6 +199,11 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, memset(&w, 0, sizeof(w)); userformat_find_requirements(NULL, &w); + if (rev->graph && !fmt_pretty && !rev->pretty_given && !rev->show_signature) { + rev->abbrev_commit = 1; + rev->commit_format = CMIT_FMT_ONELINE; + } + if (!rev->show_notes_given && (!rev->pretty_given || w.notes)) rev->show_notes = 1; if (rev->show_notes) diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index 28c053849a..b44776efe3 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -144,7 +144,7 @@ done <<\EOF ignores expect72 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat respects expect200 show --stat -respects expect200 log -1 --stat +respects expect200 log -1 --pretty=medium --stat EOF cat >expect40 <<'EOF' @@ -172,7 +172,7 @@ done <<\EOF ignores expect72 format-patch -1 --stdout respects expect40 diff HEAD^ HEAD --stat respects expect40 show --stat -respects expect40 log -1 --stat +respects expect40 log -1 --pretty=medium --stat EOF cat >expect40 <<'EOF' @@ -200,7 +200,7 @@ done <<\EOF ignores expect72 format-patch -1 --stdout respects expect40 diff HEAD^ HEAD --stat respects expect40 show --stat -respects expect40 log -1 --stat +respects expect40 log -1 --pretty=medium --stat EOF @@ -247,7 +247,7 @@ done <<\EOF format-patch -1 --stdout diff HEAD^ HEAD --stat show --stat -log -1 --stat +log -1 --pretty=medium --stat EOF test_expect_success 'preparation for long filename tests' ' @@ -281,7 +281,7 @@ done <<\EOF format-patch -1 --stdout diff HEAD^ HEAD --stat show --stat -log -1 --stat +log -1 --pretty=medium --stat EOF cat >expect72 <<'EOF' @@ -315,7 +315,7 @@ done <<\EOF ignores expect72 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat respects expect200 show --stat -respects expect200 log -1 --stat +respects expect200 log -1 --pretty=medium --stat EOF cat >expect1 <<'EOF' @@ -345,7 +345,7 @@ done <<\EOF ignores expect72 format-patch -1 --stdout respects expect1 diff HEAD^ HEAD --stat respects expect1 show --stat -respects expect1 log -1 --stat +respects expect1 log -1 --pretty=medium --stat EOF cat >expect <<'EOF' diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 819c24d10e..7cf9f15cec 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -39,6 +39,20 @@ test_expect_success setup ' ' +test_expect_success 'default log format' ' + + git log --pretty=medium > expect && + git log > actual && + test_cmp expect actual +' + +test_expect_success 'default log --graph format' ' + + git log --graph --pretty=oneline --abbrev-commit > expect && + git log --graph > actual && + test_cmp expect actual +' + printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect test_expect_success 'pretty' ' -- 2.21.0