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

Re: [PATCH] filter-branch: Big syntax change; support rewriting multiplerefs

From
Johannes Sixt <j.sixt@eudaptics.com>
Date
Jul 24, 2007, 09:27 UTC
Message-ID
<46A5C615.24C24F0F@eudaptics.com>
In-Reply-To
<Pine.LNX.4.64.0707231829210.14781@racer.site>
Johannes Schindelin wrote:
Show 19 quoted lines
> +# These refs should be updated if their heads were rewritten
> +
> +git rev-parse --revs-only --symbolic "$@" |
> +while read ref
> +do
> +       # normalize ref
> +       case "$ref" in
> +       HEAD)
> +               ref="$(git symbolic-ref "$ref")"
> +       ;;
> +       refs/*)
> +       ;;
> +       *)
> +               ref="$(git for-each-ref --format='%(refname)' |
> +                       grep /"$ref")"
> +       esac
> +
> +       git check-ref-format "$ref" && echo "$ref"
> +done > "$tempdir"/heads
This does not work as I'd expected it: I can't successfully say:
   git-filter-branch master
It tells me:
   Which ref do you want to rewrite?
Show 15 quoted lines
> +# NEEDSWORK: we should sort the unmapped refs topologically first
> +while read ref
> +do
> +       sha1=$(git rev-parse "$ref"^0)
> +       test -f "$workdir"/../map/$sha1 && continue
> +       # Assign the boundarie(s) in the set of rewritten commits
> +       # as the replacement commit(s).
> +       # (This would look a bit nicer if --not --stdin worked.)
> +       for p in $((cd "$workdir"/../map; ls | sed "s/^/^/") |
> +               git rev-list $ref --boundary --stdin |
> +               sed -n "s/^-//p")
> +       do
> +               map $p >> "$workdir"/../map/$sha1
> +       done
> +done < "$tempdir"/heads
This logic seems to be borked, and I don't grok it. I was trying this:
   git-filter-branch -- --since=2007.01.10 \
		refs/heads/topic refs/heads/master

where topic's last change is from before 2007.01.10, i.e. it is not among the rewritten commits. And I get this:

WARNING: Ref 'refs/heads/master' is unchanged
WARNING: 'refs/heads/topic' was rewritten into multiple commits:
329325526647503382ae7dee41c12fe6b81bbe43
2bdf3349b76f72ceb71755c75a555d60bc7c73aa
ce6c9dfeac5ddbd64da2d9360d6552717df81d1f

The first 2 of these 3 sha1s happen to be merge bases of topic and master, but none of them appear anywhere in

   git rev-list --parents --boundary --since=2007.07.10 \
		refs/heads/topic refs/heads/master
What's up?
-- Hannes
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 4 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.