git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v6 4/4] reset: use "unpack_trees()" directly instead of "git read-tree"

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 1, 2010, 05:14 UTC
Message-ID
<7vtyv6o18q.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20091230055448.4475.64716.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
Show 17 quoted lines
> But in 9e8ecea (Add 'merge' mode to 'git reset', 2008-12-01) there is
> the following:
>
> "
>      - if the index has unmerged entries, "--merge" will currently
>        simply refuse to reset ("you need to resolve your current index
>        first"). You'll need to use "--hard" or similar in this case.
>
>        This is sad, because normally a unmerged index means that the
>        working tree file should have matched the source tree, so the
>        correct action is likely to make --merge reset such a path to
>        the target (like --hard), regardless of dirty state in-tree or
>        in-index. But that's not how read-tree has ever worked, so..
> "
>
> So the new behavior looks better according to the original
> implementation of "git reset --merge".

This is not really an improvement.. You are swapping an breakage with a different breakage of a riskier kind.

At least disallowing means that the user _is notified_ and has to manually deal with the situation. Pretending it succeeded by resetting only the index while still leaving the conflicted state in the work tree intact is a bit worse in that sense.

Show 10 quoted lines
> diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
> index c9044c9..b40999f 100644
> --- a/Documentation/git-reset.txt
> +++ b/Documentation/git-reset.txt
> @@ -122,7 +122,7 @@ entries:
>         X       U     A    B     --soft  (disallowed)
>                                  --mixed  X       B     B
>                                  --hard   B       B     B
> -                                --merge (disallowed)
> +                                --merge  X       B     B

IOW, I think the result should be "B B B" instead of "X B B" in this case.

Previous: Christian CouderNext: Junio C Hamano
Message 10 of 14 in “"git reset --merge" related improvements”
  1. 0/4 "git reset --merge" related improvementsChristian Couder, Dec 30, 2009
  2. 1/4 reset: improve mixed reset error message when in a bare repoChristian Couder, Dec 30, 2009
  3. 2/4 Documentation: reset: add some tables to describe the different optionsChristian Couder, Dec 30, 2009
  4. Junio C HamanoJan 1, 2010
  5. Christian CouderJan 2, 2010
  6. 3/4 reset: add a few tests for "git reset --merge"Christian Couder, Dec 30, 2009
  7. Junio C HamanoJan 1, 2010
  8. Christian CouderJan 2, 2010
  9. 4/4 reset: use "unpack_trees()" directly instead of "git read-tree"Christian Couder, Dec 30, 2009
  10. Junio C HamanoJan 1, 2010
  11. Junio C HamanoJan 1, 2010
  12. Christian CouderJan 2, 2010
  13. Linus TorvaldsJan 1, 2010
  14. Junio C HamanoJan 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.