Thread (18 messages) flat view 18 messages, 2 authors, 2016-06-15

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

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:43:23

Johannes Schindelin wrote:
+# 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?
+# 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help