Subject: Re: [PATCH 02/11] reset_head(): fix checkout

From: Junio C Hamano <[email-masked]>
Date: Mon, 04 Oct 2021 09:13:01 -0700

Phillip Wood <[email-masked]> writes:

>> Sorry, but it is not quite clear what exactly is "fix checkout" in
>> the context of this change, even with the above paragraph that
>> describes the internals but not any end-user visible effect.
>
> "git checkout" refuses to overwrite untracked files but reset_head()
> does when checking out a branch.

By the name of the function, I would have expected that would be the
intended behaviour, though.  Isn't it emulating "reset --hard" that
was used when the calling commands were implemented as scripts?

What I am wondering is if the overwriting behaviour is annoying for
some callers but is essential for other callers, and unless we tell
readers that we vetted all the callers and everybody wants to keep
the paths overwritten from the tree-ish in the working tree that are
not in the index, I feel uneasy to add a label "fix" to such a change
to a callee used from multiple code paths.

> files. However such a test would pass on top of 
> en/remaving-untracked-fixes without the fix in this patch. I cannot
> think of a way to specifically test that unpack_tree_opts.reset == 0 
> unless RESET_HEAD_HARD is given after en/removing-untracked-fixes is
> merged.

Meaning that this fix is redundant, as the other topic has already
been cooking and well in the process of graduating?

Thanks.