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

[PATCH 0/5] Better error messages for checkout and merge.

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Aug 9, 2010, 14:19 UTC
Message-ID
<1281363602-27856-1-git-send-email-Matthieu.Moy@imag.fr>
This is a resurection of an old patch serie by Diane Gasselin:
http://thread.gmane.org/gmane.comp.version-control.git/149173/focus=149186

In short, when you have several untracked files that conflict with a merge or checkout, Git currently reports just the first. After this patch serie, it reports things like:

error: Your local changes to the following files would be overwritten by checkout:
	rep/two
	rep/one
Please, commit your changes or stash them before you can switch branches.

most of the job is done by "unpack_trees: group error messages by type", but this needed a bit of preparation to be implementable cleanly.

Compared to previous version, there are many small cleanups, and:
* unpack_trees_options was a struct, it's now an array. This makes the
  code much cleaner whenever one tries to do clever things with it.
  That's patch "Turn unpack_trees_options.msgs into an array + enum".
* A message was previously a type + an action ("removed" or
  "overwritten"). The type now encompasses the action. This duplicates
  a few lines in the declaration of the error messages, but again
  makes the rest of the code much simpler. That's patch
  "merge-recursive: distinguish "removed" and "overwritten" messages"
* The info on whether traverse_trees should stop at the first error
  was stored in info->data, with a very fragile cast to
  (unpack_trees_options *). I added one more field in the info
  structure to get rid of this cast.
Diane Gasselin (2):
  merge-recursive: porcelain messages for checkout
  t7609: test merge and checkout error messages
Matthieu Moy (3):
  Turn unpack_trees_options.msgs into an array + enum
  merge-recursive: distinguish "removed" and "overwritten" messages
  unpack_trees: group error messages by type
 Documentation/technical/api-tree-walking.txt |    2 +
 builtin/checkout.c                           |    3 +-
 builtin/merge.c                              |    3 +-
 merge-recursive.c                            |   62 +++++++----
 merge-recursive.h                            |    7 +-
 t/t3030-merge-recursive.sh                   |    2 +-
 t/t3400-rebase.sh                            |    3 +-
 t/t3404-rebase-interactive.sh                |    3 +-
 t/t7609-merge-co-error-msgs.sh               |  125 ++++++++++++++++++++++
 tree-walk.c                                  |   11 ++-
 tree-walk.h                                  |    1 +
 unpack-trees.c                               |  148 ++++++++++++++++++++------
 unpack-trees.h                               |   34 ++++--
 13 files changed, 332 insertions(+), 72 deletions(-)
 create mode 100755 t/t7609-merge-co-error-msgs.sh
-- 
1.7.2.1.52.g95e25.dirty
Next: Matthieu Moy
Message 1 of 16 in “Better error messages for checkout and merge.”
  1. 0/5 Better error messages for checkout and merge.Matthieu Moy, Aug 9, 2010
  2. 1/5 Turn unpack_trees_options.msgs into an array + enumMatthieu Moy, Aug 9, 2010
  3. Junio C HamanoAug 9, 2010
  4. Matthieu MoyAug 9, 2010
  5. 1/5 Turn unpack_trees_options.msgs into an array + enumMatthieu Moy, Aug 11, 2010
  6. 2/5 merge-recursive: porcelain messages for checkoutMatthieu Moy, Aug 11, 2010
  7. 3/5 merge-recursive: distinguish "removed" and "overwritten" messagesMatthieu Moy, Aug 11, 2010
  8. 4/5 unpack_trees: group error messages by typeMatthieu Moy, Aug 11, 2010
  9. 5/5 t7609: test merge and checkout error messagesMatthieu Moy, Aug 11, 2010
  10. 2/5 merge-recursive: porcelain messages for checkoutMatthieu Moy, Aug 9, 2010
  11. Junio C HamanoAug 9, 2010
  12. Matthieu MoyAug 9, 2010
  13. Ævar Arnfjörð BjarmasonAug 9, 2010
  14. 3/5 merge-recursive: distinguish "removed" and "overwritten" messagesMatthieu Moy, Aug 9, 2010
  15. 4/5 unpack_trees: group error messages by typeMatthieu Moy, Aug 9, 2010
  16. 5/5 t7609: test merge and checkout error messagesMatthieu Moy, Aug 9, 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.