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

Re: [PATCH v2 2/2] Porcelain scripts: Rewrite cryptic "needs update" error message

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 3, 2010, 23:34 UTC
Message-ID
<7vhbh2etqo.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20101001051426.GF20098@kytes>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> This is one of the concerns I had while creating this iteration. What
> do you suggest? Should we limit the number of paths listed like this?

Personally, I do not think you should list any paths. If the program states clearly that it does not like to see a dirty working tree (or a dirty working tree is likely to be a mistake by a forgetful user), the user already has enough tools such as "git status" and "git diff" to figure out which ones are dirty.

> - If it's an "edit", "squash" or "fixup" interactive rebase step, the
>   staged changes are automatically committed to the current commit:
>   you don't have to explicity commit --amend.

It might be somewhat irritating to see "you haven't committed the amend" against "rebase --continue" after running "git add" or "git add -p" to shape what should be the final commit, and that is why the codepath runs "commit --amend" for the user, but I personally think this is an attempt to help users that is ill-thought-out. The codepath stops when there are changes to the working tree files that are not added, to avoid mistakes by a forgetful user, but what if the change the user forgot to add was an addition of a new file?

Also, this is one special case that the user has to remember.

It is too late to change this now, but it would have been a lot nicer if we insisted that the "commit --amend" is always done by the user, and never automatically by "rebase-i --continue" codepath.

> - If it's a "reword" step, staged changes/ dirty working tree don't
>   mean anything. The use should simply stash everything and continue
>   in this case.
Why would "reword" involve _any_ local changes?
> I suppose I can come up with a way to check which path was taken and
> print more targeted advice. Will do in the next iteration.

In general, I am mildly against giving advices like "commit or stash", especially when the program does not know the workflow the end user in each situation is using better than the end user.

Previous: Ramkumar Ramachandra
Message 19 of 19 in “Eliminate cryptic "needs update" error message”
  1. 0/2 Eliminate cryptic "needs update" error messageRamkumar Ramachandra, Sep 30, 2010
  2. 1/2 sh-setup: Write a new require_clean_work_tree functionRamkumar Ramachandra, Sep 30, 2010
  3. Junio C HamanoSep 30, 2010
  4. Ramkumar RamachandraOct 1, 2010
  5. Jonathan NiederOct 1, 2010
  6. Ramkumar RamachandraOct 1, 2010
  7. Jonathan NiederOct 1, 2010
  8. Ramkumar RamachandraOct 1, 2010
  9. Jonathan NiederOct 1, 2010
  10. Sverre RabbelierOct 1, 2010
  11. 0/2 Eliminate cryptic "needs update" error messageRamkumar Ramachandra, Oct 2, 2010
  12. 1/2 sh-setup: Write a new require_clean_work_tree functionRamkumar Ramachandra, Oct 2, 2010
  13. Ramkumar RamachandraOct 2, 2010
  14. SubmittingPatches: Document some extra tags used in commit messagesRamkumar Ramachandra, Oct 2, 2010
  15. Junio C HamanoOct 1, 2010
  16. 2/2 Porcelain scripts: Rewrite cryptic "needs update" error messageRamkumar Ramachandra, Sep 30, 2010
  17. Junio C HamanoSep 30, 2010
  18. Ramkumar RamachandraOct 1, 2010
  19. Junio C HamanoOct 3, 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.