git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: git@vger.kernel.org
Cc: gitster@pobox.com,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jan Wielemaker <J.Wielemaker@uva.nl>
Subject: [PATCH] filter-branch: use --simplify-merges
Date: Sun, 10 Aug 2008 16:02:40 +0200	[thread overview]
Message-ID: <1218376960-6406-1-git-send-email-trast@student.ethz.ch> (raw)
In-Reply-To: <7viqub9dzi.fsf@gitster.siamese.dyndns.org>

Use rev-list --simplify-merges everywhere.  This changes the behaviour
of --subdirectory-filter in cases such as

  O -- A -\
   \       \
    \- B -- M

where A and B bring the same changes to the subdirectory: It now keeps
both sides of the merge.  Previously, the history would have been
simplified to 'O -- A'.  Merges of unrelated side histories that never
touch the subdirectory are still removed.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

This obviously depends on --simplify-merges which is only in 'next'.

Junio C Hamano wrote:
>
> Perhaps --full-history is needed to the rev-list call (and the recent
> invention --simplify-merges that will hopefully appear sometime after
> 1.6.0)?  See recent discussion of --full-history and the default merge
> simplification between Linus and Roman Zippel.

Following history pointers, it turns out the discussion surrounding
a17171b4 (Revert "filter-branch: subdirectory filter needs
--full-history") actually mentions that a simplification step on top
of --full-history is needed:

Junio C Hamano wrote:
[http://kerneltrap.org/mailarchive/git/2007/6/13/249107]
> In short,
> you will end up with something like this:
> 
>              .---. (side branch)
>             /     \
>         ---A---B---C (merge)
> 
> The "merge clean-up" would conceptually be a simple operation.
> Whenever you see a merge C, you look at its parents A and B, and
> cull the ones that are reachable from other parents.  You notice
> that A is an ancestor of B, drop A from the parents of C, and
> simplify the above down to:
> 
>         ---A---B---C (not-a-merge)

Well, turns out that's what you did with --simplify-merges, so let's
use it.

 git-filter-branch.sh |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 539b2e6..60f64ac 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -239,11 +239,11 @@ mkdir ../map || die "Could not create map/ directory"
 case "$filter_subdir" in
 "")
 	git rev-list --reverse --topo-order --default HEAD \
-		--parents "$@"
+		--parents --simplify-merges "$@"
 	;;
 *)
 	git rev-list --reverse --topo-order --default HEAD \
-		--parents "$@" -- "$filter_subdir"
+		--parents --simplify-merges "$@" -- "$filter_subdir"
 esac > ../revs || die "Could not get the commits"
 commits=$(wc -l <../revs | tr -d " ")
 
@@ -333,7 +333,8 @@ then
 	do
 		sha1=$(git rev-parse "$ref"^0)
 		test -f "$workdir"/../map/$sha1 && continue
-		ancestor=$(git rev-list -1 $ref -- "$filter_subdir")
+		ancestor=$(git rev-list --simplify-merges -1 \
+				$ref -- "$filter_subdir")
 		test "$ancestor" && echo $(map $ancestor) >> "$workdir"/../map/$sha1
 	done < "$tempdir"/heads
 fi
-- 
1.6.0.rc2.29.g7ec81

  parent reply	other threads:[~2008-08-10 14:03 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06 13:39 git filter-branch --subdirectory-filter, still a mistery Jan Wielemaker
2008-08-07  7:13 ` Jan Wielemaker
2008-08-07  7:50 ` Thomas Rast
2008-08-07 10:14   ` Jan Wielemaker
2008-08-07 23:48     ` Thomas Rast
2008-08-07 23:50       ` [PATCH] filter-branch: be more helpful when an annotated tag changes Thomas Rast
2008-08-08 20:10         ` [TOY PATCH] filter-branch: add option --delete-unchanged Thomas Rast
2008-08-09  0:35           ` Johannes Schindelin
2008-08-11 10:43           ` Jan Wielemaker
2008-09-14 16:29           ` Felipe Contreras
2008-08-07 23:54       ` [RFH] filter-branch: ancestor detection weirdness Thomas Rast
2008-08-08 11:42         ` Johannes Schindelin
2008-08-08 14:14           ` Thomas Rast
2008-08-08 14:16             ` [PATCH] filter-branch: fix ancestor discovery for --subdirectory-filter Thomas Rast
2008-08-08 14:39             ` [RFH] filter-branch: ancestor detection weirdness Johannes Schindelin
2008-08-08 18:37               ` Thomas Rast
2008-08-08 18:39                 ` [PATCH v2] filter-branch: fix ref rewriting with --subdirectory-filter Thomas Rast
2008-08-09  0:16                 ` [RFH] filter-branch: ancestor detection weirdness Johannes Schindelin
2008-08-09  1:25                   ` Junio C Hamano
2008-08-09  9:25                     ` Thomas Rast
2008-08-09  9:35                       ` Thomas Rast
2008-08-10 14:02                     ` Thomas Rast [this message]
2008-08-12  1:54                       ` [PATCH] filter-branch: use --simplify-merges Junio C Hamano
2008-08-12  2:13                         ` Junio C Hamano
2008-08-12  5:47                           ` Thomas Rast
2008-08-12  6:59                             ` Junio C Hamano
2008-08-12  8:45                               ` [PATCH 0/3] filter-branch --subdirectory-filter improvements Thomas Rast
2008-08-12 12:11                                 ` Jan Wielemaker
2008-08-12  8:45                               ` [PATCH 1/3] filter-branch: Extend test to show rewriting bug Thomas Rast
2008-08-12  8:45                               ` [PATCH 2/3] filter-branch: fix ref rewriting with --subdirectory-filter Thomas Rast
2008-08-12  8:45                               ` [PATCH 3/3] filter-branch: use --simplify-merges Thomas Rast
2008-08-12  8:18                     ` [RFH] filter-branch: ancestor detection weirdness Petr Baudis
2008-08-12 18:33                       ` Junio C Hamano
2008-08-09 10:00                   ` Thomas Rast
2008-08-12 21:33                     ` Junio C Hamano
2008-08-12 22:15                       ` Thomas Rast
2008-08-08  7:44       ` git filter-branch --subdirectory-filter, still a mistery Jan Wielemaker
2008-08-08 11:25       ` Jan Wielemaker
2008-08-07 14:04   ` [PATCH] Documentation: filter-branch: document how to filter all refs Thomas Rast
2008-08-07 14:16     ` [PATCH v2] " Thomas Rast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218376960-6406-1-git-send-email-trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=J.Wielemaker@uva.nl \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).