From: Thomas Rast <trast@student.ethz.ch>
To: <jeffrey.freeman@syncleus.com>
Cc: <git@vger.kernel.org>
Subject: [RFC PATCH 2/3] filter-branch: optionally load existing mappings prior to filtering
Date: Fri, 31 Dec 2010 16:29:23 +0100 [thread overview]
Message-ID: <f89203efcf1b2f49fb33097b3e7fc27e070626fb.1293809100.git.trast@student.ethz.ch> (raw)
In-Reply-To: <cover.1293809100.git.trast@student.ethz.ch>
In the previous commit filter-branch learned to dump its mappings.
Introduce a --load-map option that lets it load map files in the same
format.
This option does not accumulate; only the last one counts. Letting it
accumulate would require two argument-parsing passes since we need to
know the $tempdir before we can establish any maps.
Also, the maps add to all filtered maps. This is a bit of a tradeoff.
As it stands, it could be useful to remap refs in another repository
using the map file from elsewere. On the other hand, it does mean
that it may rewrite more refs than the user intended.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
git-filter-branch.sh | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 020b076..9feeb26 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -127,6 +127,7 @@ force=
prune_empty=
remap_to_ancestor=
dump_map=
+load_map=
while :
do
case "$1" in
@@ -205,6 +206,16 @@ do
;;
esac
;;
+ --load-map)
+ case "$OPTARG" in
+ /*)
+ load_map="$OPTARG"
+ ;;
+ *)
+ load_map="$(pwd)/$OPTARG"
+ ;;
+ esac
+ ;;
*)
usage
;;
@@ -275,6 +286,14 @@ export GIT_INDEX_FILE
# map old->new commit ids for rewriting parents
mkdir ../map || die "Could not create map/ directory"
+if test -n "$load_map"
+then
+ while read pre post
+ do
+ echo $post > ../map/$pre
+ done < "$load_map"
+fi
+
# we need "--" only if there are no path arguments in $@
nonrevs=$(git rev-parse --no-revs "$@") || exit
if test -z "$nonrevs"
--
1.7.4.rc0.240.g44e61
next prev parent reply other threads:[~2010-12-31 15:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-31 15:29 [RFC PATCH 0/3] Submodule filtering for filter-branch Thomas Rast
2010-12-31 15:29 ` [RFC PATCH 1/3] filter-branch: optionally dump all mappings at the end Thomas Rast
2010-12-31 17:09 ` Johannes Sixt
2010-12-31 15:29 ` Thomas Rast [this message]
2010-12-31 17:10 ` [RFC PATCH 2/3] filter-branch: optionally load existing mappings prior to filtering Johannes Sixt
2010-12-31 15:29 ` [RFC PATCH 3/3] filter-branch: support --submodule-filter Thomas Rast
2010-12-31 17:31 ` Johannes Sixt
2011-01-03 23:44 ` Jeffrey Phillips Freeman
2011-01-04 13:14 ` Thomas Rast
2011-01-04 19:18 ` Junio C Hamano
2010-12-31 17:20 ` [RFC PATCH 0/3] Submodule filtering for filter-branch Johannes Sixt
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=f89203efcf1b2f49fb33097b3e7fc27e070626fb.1293809100.git.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=jeffrey.freeman@syncleus.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).