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

Re: first-class conflicts?

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 12, 2023, 23:25 UTC
Message-ID
<xmqqr0kumu56.fsf@gitster.g>
In-Reply-To
<20231112152143.GD35991@mit.edu>
"Theodore Ts'o" <tytso@mit.edu> writes:
Show 13 quoted lines
> On Sat, Nov 11, 2023 at 10:31:54AM +0900, Junio C Hamano wrote:
>> ... 
>> I wonder if it would help users to add a new configuration option
>> for those who want to live safer that tells "commit -a" to leave
>> unmerged paths alone and require the unmerged paths to be added
>> explicitly (which may have to extend to cover things like "add -u"
>> and "add .").
>> 
>> Perhaps not.  I often find myself doing "git add -u" after resolving
>> conflicts and re-reading the result, without an explicit pathspec.
>
> Maybe the configuration option would also forbit "git add -u" from
> adding diffs with conflict markers unless --force is added?

Historically we left it to pre-commit hooks, but I agree that protection at the time of "git add" may be more helpful.

I also alluded to being careful about "git add" with an overly vague pathspec (like "." to add everything addable under the sun), but I do not think it is possible to define "overly vague" in a way that satisfies everybody (would "git add \*.h" be still overly vague when 5% of your header files have conflicts in the merge you are concluding?) and keep the new users safe.

Unless the configuration forbids patterns and say "each and every individual path must be named to add and resolve conflicted paths", that is. Come to think of it, that may not be too bad.

Show 8 quoted lines
> I dunno.  I personally wouldn't use it myself, because I've always
> made a point of running "git diff", or "git status", and almost
> always, a command like "make -j16 && make -j16 check" (or an aliased
> equivalent) before commiting a merge.
>
> But that's because I'm a paranoid s.o.b. and in my long career, I've
> learned is that "you can't be paranoid enough", and "hope is not a
> strategy".  :-)

Being careful and paranoid is good ;-) I wouldn't use it myself, either, but the discussion started while trying to allay new users' worries about recording a half-resolved state by mistake, and in that context, I think it would have non-empty audiences.

Thanks.
Previous: Theodore Ts'oNext: Elijah Newren
Message 12 of 25 in “first-class conflicts?”
  1. Sandra SnanNov 6, 2023
  2. Dragan SimicNov 6, 2023
  3. Sandra SnanNov 6, 2023
  4. rsbecker@nexbridge.comNov 6, 2023
  5. Sandra SnanNov 6, 2023
  6. Phillip WoodNov 7, 2023
  7. Sandra SnanNov 7, 2023
  8. Theodore Ts'oNov 7, 2023
  9. Junio C HamanoNov 11, 2023
  10. Sandra SnanNov 11, 2023
  11. Theodore Ts'oNov 12, 2023
  12. Junio C HamanoNov 12, 2023
  13. Elijah NewrenNov 7, 2023
  14. Dragan SimicNov 7, 2023
  15. Sandra SnanNov 7, 2023
  16. Phillip WoodNov 7, 2023
  17. Martin von ZweigbergkNov 7, 2023
  18. Elijah NewrenNov 8, 2023
  19. Martin von ZweigbergkNov 8, 2023
  20. Elijah NewrenNov 10, 2023
  21. Martin von ZweigbergkNov 12, 2023
  22. phillip.wood123@gmail.comNov 9, 2023
  23. Elijah NewrenNov 8, 2023
  24. Phillip WoodNov 9, 2023
  25. Elijah NewrenNov 10, 2023

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.