Re: [PATCH] setup: do not create $X/gitdir unnecessarily when accessing git file $X

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] setup: do not create $X/gitdir unnecessarily when accessing git file $X

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:07:09

Jeff King [off-list ref] writes:
[2] I suspect this code should use write_file_gently(). What happens if
    I have a read-only linked checkout?
Or you may not be the owner of the repository, you think you are
doing a read-only operation, and you silently end up creating a file
that cannot be written by the repository owner?

Honestly, I think this whole "just in case the user moved without
telling us, we sneakily fix things without telling the user" should
just go away.  This is not the first incidence of a tool trying to
be overly clever and pretend to know better than the end user biting
us, is it?

Re: [PATCH] setup: do not create $X/gitdir unnecessarily when accessing git file $X

From: Jeff King <hidden>
Date: 2016-06-15 23:07:09

On Mon, Nov 02, 2015 at 12:51:16PM -0800, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
[2] I suspect this code should use write_file_gently(). What happens if
    I have a read-only linked checkout?
Or you may not be the owner of the repository, you think you are
doing a read-only operation, and you silently end up creating a file
that cannot be written by the repository owner?

Honestly, I think this whole "just in case the user moved without
telling us, we sneakily fix things without telling the user" should
just go away.  This is not the first incidence of a tool trying to
be overly clever and pretend to know better than the end user biting
us, is it?
I have to admit, that was my gut feeling, too, but I do not know enough
about the problem it is solving to say whether it is a good tradeoff.
Unfortunately 23af91d102e1efaff33b77ab7746356835a3d600 did not have much
discussion. I didn't dig into the mailing list, though. I was hoping Duy
could summarize it. :)

-Peff

Re: [PATCH] setup: do not create $X/gitdir unnecessarily when accessing git file $X

From: Duy Nguyen <hidden>
Date: 2016-06-15 23:07:09

(resend)

On Mon, Nov 2, 2015 at 9:51 PM, Junio C Hamano [off-list ref] wrote:
Jeff King [off-list ref] writes:
quoted
[2] I suspect this code should use write_file_gently(). What happens if
    I have a read-only linked checkout?
I can't hide anything from you guys can I? :) My first attempt was
move this update logic back to setup_..._gentle where it should
belong, but it got complicated because read_file_gently was buried too
deep and there was no easy way to get the information out.

I can try again, or..
Or you may not be the owner of the repository, you think you are
doing a read-only operation, and you silently end up creating a file
that cannot be written by the repository owner?

Honestly, I think this whole "just in case the user moved without
telling us, we sneakily fix things without telling the user" should
just go away.  This is not the first incidence of a tool trying to
be overly clever and pretend to know better than the end user biting
us, is it?
The whole prune strategy is a bit messy trying to cover all cases
while still keeping out of the user's way. Perhaps if we implement
"git worktree mv", or even "worktree fixup" so the user can do it
manually (back when the prune strategy commit was implemented, there
was no git-worktree), then we don't need this magic any more.

So, which way to go?

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