From: Alex Henrie <alexhenrie24@gmail.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Alex Henrie <alexhenrie24@gmail.com>
Subject: [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit
Date: Fri, 22 Mar 2019 22:13:32 -0600 [thread overview]
Message-ID: <20190323041332.9743-1-alexhenrie24@gmail.com> (raw)
Having --pretty=medium as the default almost always makes the graph too
difficult to follow.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
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
next reply other threads:[~2019-03-23 4:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-23 4:13 Alex Henrie [this message]
2019-03-23 6:03 ` Abhisek Ghosh
2019-03-24 13:03 ` [PATCH] In `git log --graph`, default to --pretty=oneline --abbrev-commit Junio C Hamano
2019-03-24 18:58 ` Ævar Arnfjörð Bjarmason
2019-03-24 22:37 ` Alex Henrie
2019-03-25 1:17 ` Rafael Ascensão
2019-03-25 5:10 ` Alex Henrie
2019-03-25 5:16 ` Alex Henrie
[not found] ` <CACUQV59x-W+fCz_O5EnbZhjZ1CB2NhEQbkR8dAYMizAQGQ2SFA@mail.gmail.com>
2019-03-27 17:49 ` Alex Henrie
2019-04-01 10:45 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190323041332.9743-1-alexhenrie24@gmail.com \
--to=alexhenrie24@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).