From: Jonathan Nieder <jrnieder@uchicago.edu>
To: David Neu <david@davidneu.com>
Cc: git@vger.kernel.org
Subject: Re: git-filter-branch behavior
Date: Wed, 13 Aug 2008 15:41:42 -0500 (CDT) [thread overview]
Message-ID: <Pine.GSO.4.62.0808131533320.10800@harper.uchicago.edu> (raw)
In-Reply-To: <e0b44a890808130914oced739cy2aaf54aebfcfcbce@mail.gmail.com>
Hello,
David Neu wrote:
> Running
>
> git-filter-branch --tree-filter 'rm -rf subdir/' -- --all
>
> as shown below seems to leave empty commits
> corresponding to subdir/ in the tree. Is this the expected
> behavior? If so is there a command to remove the empty
> commits?
The following is probably overkill, but it is what I would do.
It's completely untested. If you'd prefer to do things by hand
instead, my only advice is that using grafts with filter-branch
might be easier than rebase -i.
-- snipsnip --
# prune-empty-commits - filter-branch filter to avoid boring commits
#
# Usage: git-filter-branch --tree-filter <something> \
# --commit-filter 'prune-empty-commits "$@"' -- <refs>
# Public domain.
interesting=
test "$#" -eq 1 && interesting=t
committree=$1
shift
for sha1 in "$@"
do
test z"$sha1" = z-p && continue
map "$sha1" | while read parent
do
parenttree=$(git log -1 --pretty=format:%T "$parent")
test "$committree" != "$parenttree" &&
interesting=t
test -n "$interesting" && break
done
test "-n interesting" && break
done
test -n "$interesting" && git commit-tree "$@" || skip_commit "$@"
next prev parent reply other threads:[~2008-08-13 20:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 16:14 git-filter-branch behavior David Neu
2008-08-13 20:41 ` Jonathan Nieder [this message]
2008-08-13 21:00 ` Jonathan Nieder
2008-08-15 15:32 ` Michael J Gruber
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.GSO.4.62.0808131533320.10800@harper.uchicago.edu \
--to=jrnieder@uchicago.edu \
--cc=david@davidneu.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).