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

Re: [PATCH] reset: Better warning message on git reset --mixed <paths>

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 15, 2010, 18:36 UTC
Message-ID
<7vr5hzg1u1.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTin3zyPvs3GjOt3=q6dOofFA2ba0sBAzt3=Ka1Wn@mail.gmail.com>

Regarding the various modes that are forbidden with "reset", I've been wondering if we can do things differently.

If you want to reset the index at selected paths, don't use any option, as nothing but --mixed makes sense. Hence we deprecated use of --mixed when used this way. But if _it_ makes sense, why deprecate it? What harm would it do if we took it silently?

IIRC, the reasoning that lead to the deprecation was that allowing --mixed may give a false impression to confused users that other mode options also might be usable with pathspec, e.g. "reset --soft [<commit>] <pathspec>". It obviously should barf loudly, as there is no way to move the HEAD to a named commit without touching the index and the worktree at only specified paths, but then the error message belongs to --soft, not --mixed.

Also "reset --hard [<commit>] -- <pathspec>" is forbidden in a repository with a working tree, but it is clear that what the user wanted to do with that unsupported command was what "checkout [<commit>] -- <pathspec>" would have done.

What if we:
 - change "reset --hard [<commit>] -- <pathspec>" to internally run the
   moral equivalent "checkout" without complaining;
 - change "reset --mixed [<commit>] -- <pathspec>" to do the same thing as
   it has always done without complaining; and
 - make sure "reset --soft [<commit>] -- <pathspec>" barfs loudly.
Do people see major downside?
Previous: Ævar Arnfjörð BjarmasonNext: Jonathan Nieder
Message 6 of 18 in “reset: Better warning message on git reset --mixed <paths>”
  1. reset: Better warning message on git reset --mixed <paths>Ævar Arnfjörð Bjarmason, Aug 14, 2010
  2. Jonathan NiederAug 14, 2010
  3. Junio C HamanoAug 15, 2010
  4. Miles BaderAug 15, 2010
  5. Ævar Arnfjörð BjarmasonAug 15, 2010
  6. Junio C HamanoAug 15, 2010
  7. Jonathan NiederAug 15, 2010
  8. Junio C HamanoAug 15, 2010
  9. Ævar Arnfjörð BjarmasonAug 15, 2010
  10. Junio C HamanoAug 15, 2010
  11. Miles BaderAug 16, 2010
  12. Ævar Arnfjörð BjarmasonAug 16, 2010
  13. Ralf EbertAug 15, 2010
  14. Jonathan NiederAug 16, 2010
  15. David FriesAug 15, 2010
  16. reset: Better warning message on git reset --mixed <paths>Ævar Arnfjörð Bjarmason, Aug 15, 2010
  17. Junio C HamanoAug 16, 2010
  18. Ævar Arnfjörð BjarmasonAug 16, 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.