From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@postbox.com
Subject: [PATCH/RFC] filter-branch: support skipping of commits more easily
Date: Fri, 8 Jun 2007 00:59:48 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0706080058160.4046@racer.site> (raw)
When commit-filter echoes just "skip", just skip that commit by mapping
its object name to the same (possibly rewritten) object name(s) its
parent(s) are mapped to.
IOW, given A-B-C, if commit-filter says "skip" upon B, the rewritten
branch will look like this: A'-C'.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Of course, if you think of "patchsets", this behaviour might
be unexpected, since the children will still contain everything
which was changed in the skipped revisions, and not changed in
_them_.
git-filter-branch.sh | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 9d61b7f..e6ed7b9 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -102,6 +102,9 @@
# multiple commit ids; in that case, all of them will be used
# as parents instead of the original commit in further commits.
#
+# For the common case, that this commit should be skipped, just
+# output a single "skip".
+#
# --tag-name-filter COMMAND:: The filter for rewriting tag names.
# If this filter is passed, it will be called for every tag ref
# that points to a rewritten object (or to a tag object which
@@ -321,7 +324,7 @@ test $commits -eq 0 && die "Found nothing to rewrite"
i=0
while read commit; do
i=$(($i+1))
- printf "$commit ($i/$commits) "
+ printf "\rRewriting commits... ($i/$commits)"
git-read-tree -i -m $commit
@@ -358,8 +361,14 @@ while read commit; do
sed -e '1,/^$/d' <../commit | \
eval "$filter_msg" | \
- sh -c "$filter_commit" git-commit-tree $(git-write-tree) $parentstr | \
- tee ../map/$commit
+ sh -c "$filter_commit" \
+ git-commit-tree $(git-write-tree) $parentstr \
+ > ../map/$commit
+
+ test skip = "$(cat ../map/$commit)" &&
+ for parent in $(get_parents $commit); do
+ map "$parent"
+ done > ../map/$commit
done <../revs
src_head=$(tail -n 1 ../revs)
--
1.5.2.1.2689.gaf768-dirty
next reply other threads:[~2007-06-08 0:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-07 23:59 Johannes Schindelin [this message]
2007-06-08 0:42 ` [PATCH/RFC] filter-branch: support skipping of commits more easily Junio C Hamano
2007-06-08 4:17 ` Johannes Schindelin
2007-06-08 6:40 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2007-06-08 2:11 linux
2007-06-08 5:12 ` Johannes Schindelin
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=Pine.LNX.4.64.0706080058160.4046@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@postbox.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).