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

Re: [RFH] filter-branch: ancestor detection weirdness

From
Thomas Rast <trast@student.ethz.ch>
Date
Aug 8, 2008, 18:37 UTC
Message-ID
<200808082037.49918.trast@student.ethz.ch>
In-Reply-To
<alpine.DEB.1.00.0808081632580.24820@pacific.mpi-cbg.de.mpi-cbg.de>
Johannes Schindelin wrote:
Show 16 quoted lines
> On Fri, 8 Aug 2008, Thomas Rast wrote:
> 
> > I think a more careful use of rev-list -1 is actually a correct and easy 
> > way to figure out an ancestor.
> 
> I have not looked at your patch closely, or at your explanation, but I am 
> really certain that every attempt to replace the --boundary with a -1 must 
> fail.
> 
> Let me show you why I think that.  Just look at this history:
> 
> A - B - C
>   /
> D
> 
> Where all commits except B touch the inside directory.  Two options:

'rev-list' "solves" this problem for us. At the point where we are rewriting the branch pointers, commits have already been rewritten to whatever 'git rev-list --parents -- $subdir' told us to make them. I think there are only two cases for its output:

(a) Both A and D bring the same subdirectory contents.  'rev-list
    --parents -- $subdir' drops one side of the merge during pruning.
    It does not look past the merge to see whether the contents were
    arrived at via different changesets.  Thus the history becomes
      A' -- C'
      D'
    and even that only if D was reachable by a different ref,
    otherwise D' is simply dropped.
(b) A and D bring different $subdir contents.  Then the merge is
    interesting and remains.  History is now
      A' -- B' -- C'
           /
      D' -/

Neither of those cases is a problem for the -1 strategy. A branch 'topic' pointing to B will be rewritten to (a) A' and (b) B'.

IOW, either the merge remains and there is no problem, or the side branches vanish too and there is no problem. rev-list never "forward simplifies" merges; it merely tries to prune away commits on the incoming side of the merge until all its parents are interesting.

Either that, or I missed something obvious. I think I'll have to come up with a better commit message...

- Thomas
-- 
Thomas Rast
trast@student.ethz.ch
Previous: Johannes SchindelinNext: Thomas Rast
Message 16 of 35 in “git filter-branch --subdirectory-filter, still a mistery”
  1. Jan WielemakerAug 6, 2008
  2. Jan WielemakerAug 7, 2008
  3. Thomas RastAug 7, 2008
  4. Jan WielemakerAug 7, 2008
  5. Thomas RastAug 7, 2008
  6. filter-branch: be more helpful when an annotated tag changesThomas Rast, Aug 7, 2008
  7. filter-branch: add option --delete-unchangedThomas Rast, Aug 8, 2008
  8. Johannes SchindelinAug 9, 2008
  9. Jan WielemakerAug 11, 2008
  10. Felipe ContrerasSep 14, 2008
  11. [RFH] filter-branch: ancestor detection weirdnessThomas Rast, Aug 7, 2008
  12. Johannes SchindelinAug 8, 2008
  13. Thomas RastAug 8, 2008
  14. filter-branch: fix ancestor discovery for --subdirectory-filterThomas Rast, Aug 8, 2008
  15. Johannes SchindelinAug 8, 2008
  16. Thomas RastAug 8, 2008
  17. filter-branch: fix ref rewriting with --subdirectory-filterThomas Rast, Aug 8, 2008
  18. Johannes SchindelinAug 9, 2008
  19. Junio C HamanoAug 9, 2008
  20. Thomas RastAug 9, 2008
  21. Thomas RastAug 9, 2008
  22. filter-branch: use --simplify-mergesThomas Rast, Aug 10, 2008
  23. Junio C HamanoAug 12, 2008
  24. Junio C HamanoAug 12, 2008
  25. Thomas RastAug 12, 2008
  26. Junio C HamanoAug 12, 2008
  27. Petr BaudisAug 12, 2008
  28. Junio C HamanoAug 12, 2008
  29. Thomas RastAug 9, 2008
  30. Junio C HamanoAug 12, 2008
  31. Thomas RastAug 12, 2008
  32. Jan WielemakerAug 8, 2008
  33. Jan WielemakerAug 8, 2008
  34. Documentation: filter-branch: document how to filter all refsThomas Rast, Aug 7, 2008
  35. Documentation: filter-branch: document how to filter all refsThomas Rast, Aug 7, 2008

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.