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

Re: [RFC/PATCH 0/9] commit: more focused advice in the no-changes-staged case

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 25, 2010, 08:54 UTC
Message-ID
<AANLkTilnQhsopnuAf0nja8Qq63VrOlt0_uCJrqYv5X-v@mail.gmail.com>
In-Reply-To
<20100725005443.GA18370@burratino>
On Sun, Jul 25, 2010 at 00:54, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 57 quoted lines
> Hi,
>
> When last seen[1], this series was a single patch in very rough form,
> but there have been almost no functional changes since then.
>
> The patches suppress most output when “git commit” is run without
> stages changed.  So instead of
>
>        $ git commit
>        # On branch master
>        # Changed but not updated:
>        #   (use "git add <file>..." to update what will be committed)
>        #   (use "git checkout -- <file>..." to discard changes in working directory)
>        #
>        #       modified:   dir1/modified
>        #
>        # Untracked files:
>        #   (use "git add <file>..." to include in what will be committed)
>        #
>        #       actual
>        #       dir1/untracked
>        #       dir2/modified
>        #       dir2/untracked
>        #       expect
>        #       output
>        #       untracked
>        no changes added to commit (use "git add" and/or "git commit -a")
>
> which may cause a newcomer to panic, you get
>
>        $ git commit
>        no changes added to commit (use "git add" and/or "git commit -a")
>
> which would just cause her to scratch her head or say “oh, right!”
> instead.  Hopefully these patches will at least provide a reminder to
> improve the various "no changes" advice messages.
>
> Ideas for future work:
>
>  - add some tests
>  - give the full traditional output if -a or any paths were passed on
>   the command line.
>
> Most of the patches are code clarity improvements which is not
> strictly related to this topic.
>
> Patch 6 cleans up the most obvious script to add tests for this in,
> though I have not added any tests to it.
>
> Patch 8 changes commit --dry-run output in a more modest way, to
> print the same advice Jeff added to commit proper last month.  I
> suspect this is a good change, but input from people who script
> around commit --dry-run would be welcome.
>
> Patch 9 is the advertised patch.  It should be self-explanatory.
>
> Thoughts?

Firstly. Acked-by on patches 1-8, they're some much needed cleanup. Especially fixing the hairy wt-status.c code and the test fixes.

I'm not so sure about 9/9. Every time I make this mistake with "git commit" I find it helpful to be able to just look up to see what I need to stage. But perhaps the wall of text can be confusing to newbies, I don't have a strong opinion on whether it should be included or not.

As an aside, isn't this sort of thing (i.e. long notices/help messages) usually hidden behind advice.* nowadays?

With the stripped down message nothing tells you how to find out what to add, which the old message did just by including the "git status" output.

Anyway, meh, I don't know :)
Previous: Jonathan NiederNext: Thomas Rast
Message 20 of 38 in “commit: more focused advice in the no-changes-staged case”
  1. 0/9 commit: more focused advice in the no-changes-staged caseJonathan Nieder, Jul 25, 2010
  2. 1/9 wt-status: split wt_status_print into digestible piecesJonathan Nieder, Jul 25, 2010
  3. 2/9 wt-status: split off a function for printing submodule summaryJonathan Nieder, Jul 25, 2010
  4. 3/9 commit: split off a function to fetch the default log messageJonathan Nieder, Jul 25, 2010
  5. 4/9 commit: split commit -s handling into its own functionJonathan Nieder, Jul 25, 2010
  6. 5/9 commit: split off the piece that writes statusJonathan Nieder, Jul 25, 2010
  7. 6/9 t7508 (status): modernize styleJonathan Nieder, Jul 25, 2010
  8. Ævar Arnfjörð BjarmasonJul 25, 2010
  9. 7/9 commit: give empty-commit avoidance code its own functionJonathan Nieder, Jul 25, 2010
  10. 8/9 commit --dry-run: give advice on empty amendJonathan Nieder, Jul 25, 2010
  11. 9/9 commit: suppress status summary when no changes stagedJonathan Nieder, Jul 25, 2010
  12. Thomas RastAug 11, 2010
  13. Jonathan NiederAug 11, 2010
  14. t6040 (branch tracking): check “status” instead of “commit”Jonathan Nieder, Aug 11, 2010
  15. Ævar Arnfjörð BjarmasonAug 12, 2010
  16. Ævar Arnfjörð BjarmasonAug 11, 2010
  17. Jonathan NiederAug 11, 2010
  18. Ævar Arnfjörð BjarmasonAug 12, 2010
  19. Jonathan NiederAug 12, 2010
  20. Ævar Arnfjörð BjarmasonJul 25, 2010
  21. Thomas RastJul 25, 2010
  22. Making error messages stand out (Re: [RFC/PATCH 0/9] commit: more focused advice in the no-changes-staged case)Jonathan Nieder, Jul 29, 2010
  23. Sverre RabbelierJul 30, 2010
  24. 0/4 Re: Making error messages stand outJonathan Nieder, Aug 11, 2010
  25. 1/4 Eliminate “Finished cherry-pick/revert” messageJonathan Nieder, Aug 11, 2010
  26. 2/4 Introduce advise() to print hintsJonathan Nieder, Aug 11, 2010
  27. 3/4 cherry-pick/revert: Use error() for failure messageJonathan Nieder, Aug 11, 2010
  28. 4/4 cherry-pick/revert: Use advise() for hintsJonathan Nieder, Aug 11, 2010
  29. Nguyen Thai Ngoc DuyAug 11, 2010
  30. Matthieu MoyAug 11, 2010
  31. Nguyen Thai Ngoc DuyAug 11, 2010
  32. Sverre RabbelierAug 11, 2010
  33. tests: fix syntax error in "Use advise() for hints" testÆvar Arnfjörð Bjarmason, Aug 18, 2010
  34. Jonathan NiederAug 19, 2010
  35. Ævar Arnfjörð BjarmasonAug 19, 2010
  36. Raja R HarinathAug 20, 2010
  37. Ævar Arnfjörð BjarmasonAug 20, 2010
  38. Junio C HamanoAug 20, 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.