Re: [PATCH] format-patch: make format.outputDirectory relative to worktree

2 messages, 2 authors, 2019-12-24 · open the first message on its own page

Re: [PATCH] format-patch: make format.outputDirectory relative to worktree

From: Junio C Hamano <hidden>
Date: 2019-12-24 19:26:33

Denton Liu [off-list ref] writes:
Currently, when format-patch outputs patches to the path specified by
the `format.outputDirectory` configuration variable, it is relative to
the current working directory. However, it would make more sense for the
path to be relative to the worktree if it exists so that patches will be
placed in one location even if a user were to change directories.
Would it make more sense?  If a user is deep in the hierarchy, after
running

	$ git format-patch master..

the next thing the user would want to do is to go to the directory
and give them final review and edit the patches before sending out.
That would involve going up some levels depending on where s/he is,
in other words, the location the patches are found would be different
and this change makes it a lot more cumbersome to go there with a
relative path.  The only people who benefit from the change is those
who have their working trees at very shallow hierarchy so that it is
not cumbersome for them to give the full path to the top of them.

So I think this cuts both ways, and "it would make more sense" is
overselling.  Besides, those who can easily give the full path to
the top of the working tree (because they are short) can spell that
short path to outputDirectory configuration variable just once and
be done with it, no?
Rewrite the output directory logic for format-patch so that it will be
relative to the worktree of the directory. An escape hatch is provided
for if the previous behaviour is desired by prepending "./" to the
variable.
Anything that forces existing users to change their existing
settings is not an escape hatch.  It merely is a regression with a
possible workaround.

So I dunno.  I probably would have accepted a patch that *adds*
outputDirectory configuration that behaves the way you are proposing
in this patch if we did not have the variable yet in the system
(i.e. three or four years ago), but I am not sure if it is a good
idea to change it after these years.

Re: [PATCH] format-patch: make format.outputDirectory relative to worktree

From: Denton Liu <hidden>
Date: 2019-12-24 22:05:51

Hi Junio,

On Tue, Dec 24, 2019 at 11:25:18AM -0800, Junio C Hamano wrote:
Denton Liu [off-list ref] writes:
quoted
Rewrite the output directory logic for format-patch so that it will be
relative to the worktree of the directory. An escape hatch is provided
for if the previous behaviour is desired by prepending "./" to the
variable.
Anything that forces existing users to change their existing
settings is not an escape hatch.  It merely is a regression with a
possible workaround.

So I dunno.  I probably would have accepted a patch that *adds*
outputDirectory configuration that behaves the way you are proposing
in this patch if we did not have the variable yet in the system
(i.e. three or four years ago), but I am not sure if it is a good
idea to change it after these years.
Perhaps instead of switching the default behaviour so that it's always
relative to the top of the worktree, we can add some sort of prefix to
indicate that we want this behaviour. Maybe `worktree:path/from/top` or
`^path/from/top` or something like this?

Thanks,

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