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

Re: [PATCH] filter-branch: rewrite only refs which were not excludedbythe options

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 24, 2007, 19:52 UTC
Message-ID
<Pine.LNX.4.64.0707242047400.14781@racer.site>
In-Reply-To
<46A614CE.597C7130@eudaptics.com>
Hi,
On Tue, 24 Jul 2007, Johannes Sixt wrote:
Show 55 quoted lines
> Johannes Schindelin wrote:
> 
> > On Tue, 24 Jul 2007, Johannes Sixt wrote:
> > 
> > > Johannes Schindelin wrote:
> > >
> > > > On Tue, 24 Jul 2007, Johannes Sixt wrote:
> > > >
> > > > > But there's another problem. Consider this history:
> > > > >
> > > > >    ---X--o--M         <- master
> > > > >              \
> > > > >           ...-o-...-o <- topic
> > > > >
> > > > > Then this (rather contrieved) command:
> > > > >
> > > > >    $ git-filter-branch -n $n master topic --not X
> > > > >
> > > > > If $n is small enough so that M is never rewritten, then
> > > > >
> > > > >    git rev-list -1 "$ref" $negatives
> > > > >
> > > > > still expands to non-empty even for 'master' (= M), which then
> > > > > incorrectly ends up in "$tempdir"/heads.
> > > >
> > > > Aaargh!  Of course!  Since I have to add --topo-order at the end.
> > > > Otherwise it makes no sense.
> > >
> > > No, that was no my point: In my example above, if n=1, `git rev-list -1
> > > "$ref" $negatives` evaluates to
> > >
> > >     $ git rev-list -1 "master" -n 1 ^X
> > >
> > > which returns M, even though M is not going to be rewritten.
> > > --topo-order changes nothing. The problem is that the -n is a relative
> > > restriction. --since is turned into --max-age, which is absolute,
> > > therefore, the test works as expected with --since.
> > 
> > So you think we have to say something like
> > 
> >         git rev-list "$ref" $negatives | grep "$ref" > /dev/null || continue
> > 
> > ?
> 
> No, doesn't help either.
> 
> We are talking about a case where there is more than one positive ref.
> We need not consider the -- sub/ case - it makes things just even more
> complicated. There are two different rev ranges to be considered:
> 
>   # (1) candidate range to be rewritten
>   $ git rev-list "$@"
> 
>   # (2) test if positive ref is in candidate range
>   $ git rev-list $ref $negatives
Okay, but with out any subdirs,
	git rev-list "$@" | grep $(git rev-parse "$ref") > /dev/null || continue

should do exactly what we want. But in that case, we could just use the generated list ../revs to grep for the positive refs.

Darn, this _is_ getting complicated.

Ciao, Dscho

Previous: Johannes SixtNext: Johannes Schindelin
Message 17 of 20 in “filter-branch: Big syntax change; support rewriting multiple refs”
  1. filter-branch: Big syntax change; support rewriting multiple refsJohannes Schindelin, Jul 23, 2007
  2. Junio C HamanoJul 24, 2007
  3. Johannes SchindelinJul 24, 2007
  4. Johannes SixtJul 24, 2007
  5. filter-branch: when dwim'ing a ref, only allow heads and tagsJohannes Schindelin, Jul 24, 2007
  6. Johannes SixtJul 24, 2007
  7. Johannes SchindelinJul 24, 2007
  8. filter-branch: when dwim'ing a ref, only allow heads and tagsJohannes Schindelin, Jul 24, 2007
  9. filter-branch: rewrite only refs which were not excluded by the optionsJohannes Schindelin, Jul 24, 2007
  10. Johannes SixtJul 24, 2007
  11. Johannes SchindelinJul 24, 2007
  12. Johannes SixtJul 24, 2007
  13. Johannes SchindelinJul 24, 2007
  14. Johannes SixtJul 24, 2007
  15. Johannes SchindelinJul 24, 2007
  16. Johannes SixtJul 24, 2007
  17. Johannes SchindelinJul 24, 2007
  18. filter-branch: rewrite only unexcluded refsJohannes Schindelin, Jul 24, 2007
  19. Johannes SixtJul 24, 2007
  20. Johannes SchindelinJul 24, 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.