git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: Michael Barabanov <michael.barabanov@gmail.com>, gitster@pobox.com
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] filter-branch: skip commits present on --state-branch
Date: Tue, 26 Jun 2018 19:58:04 +0100	[thread overview]
Message-ID: <1530039484.9819.8.camel@hellion.org.uk> (raw)
In-Reply-To: <20180626040733.30757-1-michael.barabanov@gmail.com>

On Mon, 2018-06-25 at 21:07 -0700, Michael Barabanov wrote:
> The commits in state:filter.map have already been processed, so don't
> filter them again. This makes incremental git filter-branch much
> faster.
> 
> Also add tests for --state-branch option.
> 
> Signed-off-by: Michael Barabanov <michael.barabanov@gmail.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

> ---
>  git-filter-branch.sh     |  1 +
>  t/t7003-filter-branch.sh | 15 +++++++++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/git-filter-branch.sh b/git-filter-branch.sh
> index ccceaf19a..5c5afa2b9 100755
> --- a/git-filter-branch.sh
> +++ b/git-filter-branch.sh
> @@ -372,6 +372,7 @@ while read commit parents; do
>  	git_filter_branch__commit_count=$(($git_filter_branch__commi
> t_count+1))
>  
>  	report_progress
> +	test -f "$workdir"/../map/$commit && continue
>  
>  	case "$filter_subdir" in
>  	"")
> diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
> index ec4b160dd..e23de7d0b 100755
> --- a/t/t7003-filter-branch.sh
> +++ b/t/t7003-filter-branch.sh
> @@ -107,6 +107,21 @@ test_expect_success 'test that the directory was
> renamed' '
>  	test dir/D = "$(cat diroh/D.t)"
>  '
>  
> +V=$(git rev-parse HEAD)
> +
> +test_expect_success 'populate --state-branch' '
> +	git filter-branch --state-branch state -f --tree-filter
> "touch file || :" HEAD
> +'
> +
> +W=$(git rev-parse HEAD)
> +
> +test_expect_success 'using --state-branch to skip already rewritten
> commits' '
> +	test_when_finished git reset --hard $V &&
> +	git reset --hard $V &&
> +	git filter-branch --state-branch state -f --tree-filter
> "touch file || :" HEAD &&
> +	test_cmp_rev $W HEAD
> +'
> +
>  git tag oldD HEAD~4
>  test_expect_success 'rewrite one branch, keeping a side branch' '
>  	git branch modD oldD &&

  reply	other threads:[~2018-06-26 19:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-23  4:36 [PATCH] filter-branch: skip commits present on --state-branch Michael Barabanov
2018-06-25 22:14 ` Junio C Hamano
2018-06-26  4:07 ` [PATCH v2] " Michael Barabanov
2018-06-26 18:58   ` Ian Campbell [this message]
2018-06-26 22:44     ` Junio C Hamano

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=1530039484.9819.8.camel@hellion.org.uk \
    --to=ijc@hellion.org.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=michael.barabanov@gmail.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).