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

Re: Summer of Code project ideas due this Friday

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 10, 2011, 22:58 UTC
Message-ID
<7v8vwm37nk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110310214206.GA15828@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Yes, I don't want to see cleanly merged parts. And "--cc" already does
> what I want by not showing them.
Are you sure about that?

What "--cc" would show largely depends on what you have in your working tree. If your two branches fixed the same bug with very different approaches, you may resolve the conflict favouring what one side did while discarding everything the other side did. The file in your work tree might be the same as "git checkout --ours $that_path" after a mergy operation. "diff --cc" won't show anything to you in such a case.

Show 14 quoted lines
> So my thinking was more along the lines of:
>
>   1. Get "git diff HEAD file" and store its hunks.
>
>   2. Get "git diff --cc file" and stores its hunks.
>
>   3. For each hunk in (1), if it does not have an analagous hunk in (2),
>      mark it for staging without asking the user.
>
>   4. For the remaining hunks in (1), show the user the analagous --cc
>      hunk from (2), and mark the hunk from (1) for staging if requested.
>
>   5. Create the final patch from the marked hunks, apply it to
>      HEAD:file, and put that in the index.

Actually, the largest problem I see in the above approach is _when_ you perform the first two steps, not the details of the later steps.

The user has complete freedom outside our control between the time the mergy operation leaves conflicts in the index and the time "add -p" is invoked (except obviously the user cannot do any "add" to register the resolution for the whole file to the index, as there won't be any per-hunk resolution recording left to do by "add -p").

And as I repeatedly said, grabbing "--cc file" must be done before the user starts mucking with the file in the working tree for the approach to be any useful.

>> [discussion of how this could be done right]
>
> That description makes sense to me, but is way overkill for my workflow.

Obviously I don't think so. I'd rather consider what it does an absolute minimum (not the part that it stores in an index extension, but the part that the reference it uses to compare against the working tree file is a original, mechanical merge result). By the way, I just relized that an index extension similar to PRSF might be a way to properly give index log similar to the reflog you wanted to have the other day---every time you "git add", you record the previous state of the index entry there, so that it can be replayed in reverse.

Show 5 quoted lines
> Which really I could do with:
>
>   for i in `git diff-files --name-only --diff-filter=U`; do
>     git diff --cc $i
>     echo 'OK?'

As you already know, I disagree the usefulness of this approach (see the "Are you sure about that?" discussion), hence I doubt the usefulness of "have it integrated into the "git add -p" loop".

Previous: Jeff KingNext: Jeff King
Message 23 of 63 in “Google Summer of Code 2011”
  1. Shawn PearceMar 3, 2011
  2. Jeff KingMar 3, 2011
  3. Shawn PearceMar 3, 2011
  4. Jeff KingMar 3, 2011
  5. Jakub NarebskiMar 3, 2011
  6. Jeff KingMar 9, 2011
  7. Jeff KingMar 9, 2011
  8. Shawn PearceMar 9, 2011
  9. Jeff KingMar 9, 2011
  10. Shawn PearceMar 9, 2011
  11. Summer of Code project ideas due this FridayJeff King, Mar 9, 2011
  12. Jonathan NiederMar 10, 2011
  13. Jeff KingMar 10, 2011
  14. Shawn PearceMar 10, 2011
  15. Alexander MiselerMar 10, 2011
  16. Thomas RastMar 10, 2011
  17. Santi BéjarMar 10, 2011
  18. Jeff KingMar 10, 2011
  19. Junio C HamanoMar 10, 2011
  20. Jeff KingMar 10, 2011
  21. Junio C HamanoMar 10, 2011
  22. Jeff KingMar 10, 2011
  23. Junio C HamanoMar 10, 2011
  24. Jeff KingMar 10, 2011
  25. Thomas RastMar 11, 2011
  26. Jakub NarebskiMar 10, 2011
  27. Thomas RastMar 11, 2011
  28. History surgery with fast-import (Re: Summer of Code project ideas due this Friday)Jonathan Nieder, Mar 12, 2011
  29. Ramkumar RamachandraMar 13, 2011
  30. Nguyen Thai Ngoc DuyMar 10, 2011
  31. Jeff KingMar 10, 2011
  32. Alexander MiselerMar 10, 2011
  33. Jeff KingMar 10, 2011
  34. Alexander MiselerMar 11, 2011
  35. Alexander MiselerMar 12, 2011
  36. Alexander MiselerMar 11, 2011
  37. Ilari LiusvaaraMar 11, 2011
  38. Nguyen Thai Ngoc DuyMar 11, 2011
  39. Alexander MiselerMar 11, 2011
  40. Nguyen Thai Ngoc DuyMar 11, 2011
  41. Sam VilainMar 11, 2011
  42. Alexander MiselerMar 12, 2011
  43. Ævar Arnfjörð BjarmasonMar 11, 2011
  44. code.sculptor@gmail.comMar 11, 2011
  45. Jakub NarebskiMar 17, 2011
  46. Heiko VoigtMar 22, 2011
  47. J.H.Mar 22, 2011
  48. Pat ThoytsMar 25, 2011
  49. Jakub NarebskiMar 25, 2011
  50. Ramkumar RamachandraMar 3, 2011
  51. Jonathan NiederMar 3, 2011
  52. Sverre RabbelierMar 7, 2011
  53. Ramkumar RamachandraMar 8, 2011
  54. Sverre RabbelierMar 8, 2011
  55. Jens LehmannMar 3, 2011
  56. Christian CouderMar 5, 2011
  57. Sam VilainMar 6, 2011
  58. Heiko VoigtMar 7, 2011
  59. Fredrik GustafssonMar 7, 2011
  60. Heiko VoigtMar 9, 2011
  61. Fredrik GustafssonMar 9, 2011
  62. Heiko VoigtMar 10, 2011
  63. Thomas RastMar 9, 2011

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.