Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-17 Thread Duy Nguyen
On Fri, Apr 14, 2017 at 4:29 AM, Jeff King wrote: > On Wed, Apr 12, 2017 at 08:11:22PM +0700, Duy Nguyen wrote: > >> On Wed, Apr 12, 2017 at 8:01 PM, Jeff King wrote: >> > I dunno. Maybe I am missing some subtle case, but it's not clear to me >> > what the user

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-16 Thread Junio C Hamano
Jeff King writes: >> cwd with prefix. I was kinda hoping "super prefix" would solve it, but >> that one seems designed specifically for submodules. > > Ah, right. I think the issue is that "prefix" really serves two uses. > For things like command-line arguments, we use to find

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-13 Thread Jeff King
On Wed, Apr 12, 2017 at 08:11:22PM +0700, Duy Nguyen wrote: > On Wed, Apr 12, 2017 at 8:01 PM, Jeff King wrote: > > I dunno. Maybe I am missing some subtle case, but it's not clear to me > > what the user would be trying to do by having git stay in the original > > directory. > >

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-12 Thread Duy Nguyen
On Wed, Apr 12, 2017 at 8:01 PM, Jeff King wrote: > I dunno. Maybe I am missing some subtle case, but it's not clear to me > what the user would be trying to do by having git stay in the original > directory. Not sure if it really happens. But if we jump from worktree is inside

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-12 Thread Jeff King
On Wed, Apr 12, 2017 at 06:13:49PM +0700, Duy Nguyen wrote: > > Can't we model this after how setup_git_directory_gently() gives the > > subcommands a choice? While the majority of subcommands do not call > > the _gently() variant and die when we are not in a repository, the > > rest do use it

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-12 Thread Jeff King
On Wed, Apr 12, 2017 at 01:30:31PM +0700, Duy Nguyen wrote: > On Tue, Apr 11, 2017 at 12:13 AM, Jeff King wrote: > > On Mon, Apr 10, 2017 at 07:01:00PM +0700, Duy Nguyen wrote: > >> An alternative is, when you have found out you need to read .mailmap, > >> you call

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-12 Thread Duy Nguyen
On Wed, Apr 12, 2017 at 3:41 PM, Junio C Hamano wrote: > Duy Nguyen writes: > >>> I think this is much more than just .mailmap, though. For instance, I >>> have noticed a similar problem with .gitattributes: >> >> Urgh. assuming that we should not read

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-12 Thread Junio C Hamano
Duy Nguyen writes: >> I think this is much more than just .mailmap, though. For instance, I >> have noticed a similar problem with .gitattributes: > > Urgh. assuming that we should not read .gitattributes if there's no > worktree to read from (similar to the "defaults to .git"

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-12 Thread Duy Nguyen
On Tue, Apr 11, 2017 at 12:13 AM, Jeff King wrote: > On Mon, Apr 10, 2017 at 07:01:00PM +0700, Duy Nguyen wrote: >> An alternative is, when you have found out you need to read .mailmap, >> you call setup_work_tree() then, which prepares the worktree for you >> (including moving

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-10 Thread Jeff King
On Mon, Apr 10, 2017 at 07:01:00PM +0700, Duy Nguyen wrote: > > Similarly, if you replace "git add foo" with "git log", it still > > should work in the above, i.e. > > > > $ export GIT_DIR=~/myproject/.git GIT_WORK_TREE=~/myproject > > $ cd ~/myproject/../somewhere/else > > $ git log

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-10 Thread Duy Nguyen
On Mon, Apr 10, 2017 at 7:21 AM, Junio C Hamano wrote: > If your arrangement is even more exotic, e.g. you have these two > variables set, and then are running from OUTSIDE the working tree, > my knee-jerk reaction is that you should get your head examined, as > it is totally

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-09 Thread Junio C Hamano
Danny Sauer writes: > That's feedback I was looking for - what's the "right" way to get the > path to the file. My knee-jerk reaction is that you SHOULDN'T have to do anything special to "get the path". I do not have the code in front of me (this is my "down" week after

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-09 Thread Danny Sauer
On 4/9/2017 5:54 AM, Johannes Schindelin wrote: > Hi Danny, > > On Sat, 8 Apr 2017, Danny Sauer wrote: >> 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 }, >>

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-09 Thread Johannes Schindelin
Hi Danny, On Sat, 8 Apr 2017, Danny Sauer wrote: > 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. A laudable goal.

[PATCH] Make git log work for git CWD outside of work tree

2017-04-08 Thread Danny Sauer
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 --- Notes: I'm not