From: Danny Sauer <danny@dannysauer.com>
To: git@vger.kernel.org, danny@dannysauer.com
Subject: [PATCH] Make git log work for git CWD outside of work tree
Date: Sat, 8 Apr 2017 21:21:28 -0500 [thread overview]
Message-ID: <20170409022128.21337-1-danny@dannysauer.com> (raw)
Make git log's `--use-mailmap` argument works if the GIT_DIR & GIT_WORK_TREE
env vars are set and git is run from outside of work tree. Without the
NEED_WORK_TREE set on the log subcommand, .mailmap is silently not found.
Signed-off-by: Danny Sauer <danny@dannysauer.com>
---
Notes:
I'm not entirely sure if this is the best way to fix it, as my git
internals knowledge is pretty weak. But this /seems/ reasonable to me, and
passes all of the current test cases. If there's a more appropriate way to
make `--use-mailmap` work properly when `git log` is run outside of the
tree, I'd be excited about the opportunity to learn. :)
git.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git.c b/git.c
index 8ff44f0..e147f01 100644
--- a/git.c
+++ b/git.c
@@ -440,7 +440,7 @@ static struct cmd_struct commands[] = {
{ "init", cmd_init_db },
{ "init-db", cmd_init_db },
{ "interpret-trailers", cmd_interpret_trailers, RUN_SETUP_GENTLY },
- { "log", cmd_log, RUN_SETUP },
+ { "log", cmd_log, RUN_SETUP | NEED_WORK_TREE },
{ "ls-files", cmd_ls_files, RUN_SETUP | SUPPORT_SUPER_PREFIX },
{ "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
{ "ls-tree", cmd_ls_tree, RUN_SETUP },
--
2.7.4
next reply other threads:[~2017-04-09 2:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-09 2:21 Danny Sauer [this message]
2017-04-09 10:54 ` [PATCH] Make git log work for git CWD outside of work tree Johannes Schindelin
2017-04-09 14:15 ` Danny Sauer
2017-04-10 0:21 ` Junio C Hamano
2017-04-10 12:01 ` Duy Nguyen
2017-04-10 17:13 ` Jeff King
2017-04-12 6:30 ` Duy Nguyen
2017-04-12 8:41 ` Junio C Hamano
2017-04-12 11:13 ` Duy Nguyen
2017-04-12 13:01 ` Jeff King
2017-04-12 13:11 ` Duy Nguyen
2017-04-13 21:29 ` Jeff King
2017-04-17 0:41 ` Junio C Hamano
2017-04-17 10:29 ` Duy Nguyen
2017-04-12 12:53 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170409022128.21337-1-danny@dannysauer.com \
--to=danny@dannysauer.com \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).