From: Csaba Henk <csaba@gluster.com>
To: git@vger.kernel.org
Subject: [PATCH] filter-branch: retire --remap-to-ancestor
Date: Thu, 26 Aug 2010 14:52:33 +0530 [thread overview]
Message-ID: <20100826092233.GA32617@acharya.in.gluster.com> (raw)
We can be clever and know by ourselves when we need the behavior
implied by "--remap-to-ancestor". No need to encumber users by having
them exposed to it as a tunable.
---
git-filter-branch.sh | 14 ++++++++------
t/t7003-filter-branch.sh | 4 ++--
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 88fb0f0..fd5caaa 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -138,11 +138,6 @@ do
force=t
continue
;;
- --remap-to-ancestor)
- shift
- remap_to_ancestor=t
- continue
- ;;
--prune-empty)
shift
prune_empty=t
@@ -265,7 +260,14 @@ mkdir ../map || die "Could not create map/ directory"
# we need "--" only if there are no path arguments in $@
nonrevs=$(git rev-parse --no-revs "$@") || exit
-test -z "$nonrevs" && dashdash=-- || dashdash=
+if test -z "$nonrevs"
+then
+ dashdash=--
+else
+ dashdash=
+ remap_to_ancestor=t
+fi
+
rev_args=$(git rev-parse --revs-only "$@")
case "$filter_subdir" in
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 2c55801..486c453 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -289,7 +289,7 @@ test_expect_success 'Prune empty commits' '
test_cmp expect actual
'
-test_expect_success '--remap-to-ancestor with filename filters' '
+test_expect_success 'filename filters work even if the given files are not changed in branch head' '
git checkout master &&
git reset --hard A &&
test_commit add-foo foo 1 &&
@@ -299,7 +299,7 @@ test_expect_success '--remap-to-ancestor with filename filters' '
orig_invariant=$(git rev-parse invariant) &&
git branch moved-bar &&
test_commit change-foo foo 2 &&
- git filter-branch -f --remap-to-ancestor \
+ git filter-branch -f \
moved-foo moved-bar A..master \
-- -- foo &&
test $(git rev-parse moved-foo) = $(git rev-parse moved-bar) &&
--
1.7.2.2
next reply other threads:[~2010-08-26 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-26 9:22 Csaba Henk [this message]
2010-08-26 17:19 ` [PATCH] filter-branch: retire --remap-to-ancestor Junio C Hamano
2010-08-27 20:44 ` [PATCH v2] " Csaba Henk
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=20100826092233.GA32617@acharya.in.gluster.com \
--to=csaba@gluster.com \
--cc=git@vger.kernel.org \
/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).