diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-08-31 20:06:27 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-08-31 23:22:51 -0700 |
commit | f95eef15f2f8a336b9a42749f5458c841a5a5d63 (patch) | |
tree | 623a5f9e4d1f99d4056b51e4b68e77e4641bcdef /t | |
parent | 7e0f1704b837355d833d84d18a3811d145867b97 (diff) | |
download | git-f95eef15f2f8a336b9a42749f5458c841a5a5d63.tar.gz git-f95eef15f2f8a336b9a42749f5458c841a5a5d63.tar.xz |
filter-branch: introduce convenience function "skip_commit"
With this function, a commit filter can leave out unwanted commits
(such as temporary commits). It does _not_ undo the changeset
corresponding to that commit, but it _skips_ the revision. IOW
no tree object is changed by this.
If you like to commit early and often, but want to filter out all
intermediate commits, marked by "@@@" in the commit message, you can
now do this with
git filter-branch --commit-filter '
if git cat-file commit $GIT_COMMIT | grep '@@@' > /dev/null;
then
skip_commit "$@";
else
git commit-tree "$@";
fi' newbranch
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t7003-filter-branch.sh | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index c79853d98..e935b2000 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -138,13 +138,7 @@ test_expect_success "remove a certain author's commits" ' git-filter-branch -f --commit-filter "\ if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\ then\ - shift;\ - while [ -n \"\$1\" ];\ - do\ - shift;\ - echo \"\$1\";\ - shift;\ - done;\ + skip_commit \"\$@\"; else\ git commit-tree \"\$@\";\ fi" removed-author && |