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

Re: [RFC?] Telling git about more complex relationships between commits (Was: Re: FFmpeg considering GIT)

From
Johan Herland <johan@herland.net>
Date
May 5, 2007, 12:49 UTC
Message-ID
<200705051449.45447.johan@herland.net>
In-Reply-To
<20070504221152.GF4033@steel.home>
On Saturday 05 May 2007, Alex Riesen wrote:
Show 9 quoted lines
> Johan Herland, Fri, May 04, 2007 13:53:10 +0200:
> > As for "Reverts", the commit pointed to should already be in your
> > history, since you cannot revert something that hasn't already been
> > applied at an earlier point in your history. In other words, the
> > reverted commit will automatically be included in your "git gc
> > --prune" or "git clone" regardless of the "Reverts" fields, since
> > "Reverts" can only point to an ancestor.
>
> So it becomes useless after rebase

Only if rebase also rebases the commit pointed to by "Reverts" (the reverted commit). And even in that case, it should be possible for rebase to detect the "Reverts" relationship and rewrite it properly, or - if people want to - skip both the reverted and the reverting commit in the rebase process.

Show 6 quoted lines
> > As for "Cherry-Pick", it's a fairly weak relationship that
> > shouldn't affect anything except to give a hint to merge, blame,
> > and similar tools.
>
> In which case, just put it in the message part of commit (in fact, it
> was there for some time. And was mostly useless, and got dropped).

Ok. If merging branches which have had cherry-picks between them is such a rare occurrence that there is no point in adding hints for merge (to do better conflict resolution), blame (to see who _really_ wrote the piece of code that was cherry-picked by someone else), etc. then there is indeed no justification for the "Cherry-Pick" header field.

> And how exactly do you think the tools _can_ use this hint?
> Especially merge, which should be absolutely certain about what
> inputs and hints gets.

When merging two branches where one branch has a commit that is later reverted, and the other branch has cherry-picked the first/reverted commit, but not the second/reverting: With these hints, git can now ask the user a more intelligent question like "The following commit was reverted in one of the branches. Do you want to keep it or revert it?". The current alternative seems to be to auto-choose one or the other (in my testing, the reverting commit was dropped in the merge). Will git always make the correct decision? If git is always correct, then what I suggest is obviously useless.

Show 6 quoted lines
> And what use is it for blame? How do you prioritze the hint? Is it
> more important than the history (which describes each and every
> line), or less? If the hint is more important, than how (and how
> often) do you tell the user that the hint was not found (because the
> commit is long pruned) and the tool switched back to looking into
> history.
Consider the following scenario:
====
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in .git/
$ git config user.name "User A"
$ cat >f <<\EOF
foo
bar
baz
EOF
$ git add f && git commit -m "User A: foo, bar, baz"
Created initial commit bb0203aabb4936d95dca30f946cb1d849df59f24
 1 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 f
$ git config user.name "User B"
$ cat >f <<\EOF
foo
barf
baz
EOF
$ git commit -a -m "User B: bar -> barf"
Created commit 5ced0ccaba0bf4a982dc2cdd792a1a0e7b1883eb
 1 files changed, 1 insertions(+), 1 deletions(-)
$ git config user.name "User C"
$ git revert HEAD
Created commit 38da1083ae4677000f8bb70729f474f358c71a3e
 1 files changed, 1 insertions(+), 1 deletions(-)
====
At this point, what output do we _really_ want from "git blame f"?

Currently we get: ==== ^bb0203a (User A 2007-05-05 12:25:44 +0200 1) foo 38da1083 (User C 2007-05-05 12:28:00 +0200 2) bar ^bb0203a (User A 2007-05-05 12:25:44 +0200 3) baz ====

Can you categorically say that there is no use for the following output? (even if you need to pass an option to "git blame" to get it): ==== ^bb0203a (User A 2007-05-05 12:25:44 +0200 1) foo ^bb0203a (User A 2007-05-05 12:25:44 +0200 1) bar ^bb0203a (User A 2007-05-05 12:25:44 +0200 3) baz ====

> It's useless.

Maybe. At least some of the fields I proposed are probably useless. But I don't think we should throw away the core idea unless we can show that _all_ fields are useless.

Have fun!
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Alex RiesenNext: Alex Riesen
Message 12 of 66 in “FFmpeg considering GIT”
  1. Panagiotis IssarisMay 2, 2007
  2. Jakub NarebskiMay 2, 2007
  3. Petr BaudisMay 3, 2007
  4. Jakub NarebskiMay 4, 2007
  5. [RFC?] Telling git about more complex relationships between commits (Was: Re: FFmpeg considering GIT)Johan Herland, May 4, 2007
  6. Alex RiesenMay 4, 2007
  7. Andy ParkinsMay 4, 2007
  8. Andrew RuderMay 4, 2007
  9. Johan HerlandMay 4, 2007
  10. Johan HerlandMay 4, 2007
  11. Alex RiesenMay 4, 2007
  12. Johan HerlandMay 5, 2007
  13. Alex RiesenMay 5, 2007
  14. Johan HerlandMay 5, 2007
  15. Petr BaudisMay 4, 2007
  16. Johan HerlandMay 4, 2007
  17. Martin LanghoffMay 3, 2007
  18. Uwe Kleine-KönigMay 3, 2007
  19. Petr BaudisMay 3, 2007
  20. david@lang.hmMay 3, 2007
  21. Petr BaudisMay 3, 2007
  22. Michael NiedermayerMay 4, 2007
  23. Andy ParkinsMay 4, 2007
  24. Johannes SixtMay 4, 2007
  25. Florian WeimerMay 4, 2007
  26. Nicolas PitreMay 4, 2007
  27. Carl WorthMay 4, 2007
  28. Johan HerlandMay 4, 2007
  29. Michael NiedermayerMay 4, 2007
  30. Linus TorvaldsMay 5, 2007
  31. Karl HasselströmMay 5, 2007
  32. Linus TorvaldsMay 5, 2007
  33. Linus TorvaldsMay 5, 2007
  34. Linus TorvaldsMay 5, 2007
  35. Junio C HamanoMay 6, 2007
  36. Paul MackerrasMay 7, 2007
  37. Karl HasselströmMay 7, 2007
  38. Johan HerlandMay 7, 2007
  39. Alex RiesenMay 7, 2007
  40. Marco CostalbaMay 8, 2007
  41. Paul MackerrasMay 9, 2007
  42. Marco CostalbaMay 9, 2007
  43. Robin RosenbergMay 9, 2007
  44. Jan HudecMay 9, 2007
  45. Fredrik KuivinenMay 9, 2007
  46. Jan HudecMay 9, 2007
  47. Marco CostalbaMay 10, 2007
  48. Jan HudecMay 10, 2007
  49. Jan HudecMay 7, 2007
  50. Gábor FarkasMay 7, 2007
  51. Randal L. SchwartzMay 7, 2007
  52. Junio C HamanoMay 7, 2007
  53. Shawn O. PearceMay 8, 2007
  54. Jeff KingMay 8, 2007
  55. Karl HasselströmMay 6, 2007
  56. Karl HasselströmMay 6, 2007
  57. Linus TorvaldsMay 6, 2007
  58. Marco CostalbaMay 6, 2007
  59. Karl HasselströmMay 6, 2007
  60. Marco CostalbaMay 6, 2007
  61. Karl HasselströmMay 6, 2007
  62. Marco CostalbaMay 6, 2007
  63. Karl HasselströmMay 6, 2007
  64. Karl HasselströmMay 6, 2007
  65. Pavel RoskinMay 9, 2007
  66. Gábor FarkasMay 8, 2007

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.