Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile

2 messages, 2 authors, 2017-01-10 · open the first message on its own page

Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile

From: Junio C Hamano <hidden>
Date: 2017-01-10 20:23:50

Junio C Hamano [off-list ref] writes:
Richard Hansen [off-list ref] writes:
quoted
On 2017-01-10 01:58, Jeff King wrote:
...
quoted
What happens in a bare repository?

I'm guessing it's relative to the top-level of the repository,
I just tried it out and it's relative to $PWD.
That is understandable.  When the user says

    $ cmd -O $file

with any option -O that takes a filename, it is most natural if we
used $PWD/$file when $file is not absolute path.
Ahh, ignore me in the above.  The discussion is about the
configuration variable, and I agree that being relative to GIT_DIR
would have made more sense.  In fact taking it as relative to PWD
does not make any sense.

We should have been a lot more careful when we added 6d8940b562
("diff: add diff.orderfile configuration variable", 2013-12-18), but
it is too late to complain now.

A related tangent.  

I wonder if anything that uses git_config_pathname() should be
relative to GIT_DIR when it is not absolute.

Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile

From: Richard Hansen <hidden>
Date: 2017-01-10 22:01:28

On 2017-01-10 15:23, Junio C Hamano wrote:
Junio C Hamano [off-list ref] writes:
quoted
Richard Hansen [off-list ref] writes:
quoted
On 2017-01-10 01:58, Jeff King wrote:
...
quoted
What happens in a bare repository?

I'm guessing it's relative to the top-level of the repository,
I just tried it out and it's relative to $PWD.
That is understandable.  When the user says

    $ cmd -O $file

with any option -O that takes a filename, it is most natural if we
used $PWD/$file when $file is not absolute path.
Ahh, ignore me in the above.  The discussion is about the
configuration variable, and I agree that being relative to GIT_DIR
would have made more sense.  In fact taking it as relative to PWD
does not make any sense.
I'll stay silent regarding bare repositories then.
We should have been a lot more careful when we added 6d8940b562
("diff: add diff.orderfile configuration variable", 2013-12-18), but
it is too late to complain now.

A related tangent.

I wonder if anything that uses git_config_pathname() should be
relative to GIT_DIR when it is not absolute.
I think so.  (For bare repositories anyway; non-bare should be relative 
to GIT_WORK_TREE.)  Perhaps git_config_pathname() itself should convert 
relative paths to absolute so that every pathname setting automatically 
works without changing any calling code.

-Richard
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help