git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: Johannes Sixt <j.sixt@viscovery.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] filter-branch fix and tests
Date: Thu, 28 Jan 2010 00:41:23 +0100	[thread overview]
Message-ID: <201001280041.23182.sojkam1@fel.cvut.cz> (raw)
In-Reply-To: <4B606748.2050209@viscovery.net>

On Wednesday 27 of January 2010 17:18:16 Johannes Sixt wrote:
> Michal Sojka schrieb:
> > +orig_head=`git show-ref --hash HEAD`
> > +export orig_head
> 
> You place the tree filter in double-quotes. Hence, orig_head will be
> interpolated on the filter-branch command line. You don't need to export
>  it.

You're right. Fixed.
 
> > +test_expect_success 'rewrite submodule with another content' '
> > +	git filter-branch --tree-filter "test -d submod && {
> > +					 rm -rf submod &&
> > +					 git rm -rf --quiet submod &&
> > +					 mkdir submod &&
> > +					 : > submod/file
> > +					 } || : &&
> > +					 test $orig_head != `git show-ref --hash HEAD`"
> 
> What is the purpose of the check in the last line?

It should check that something was rewritten, but it was incorrectly put into 
the filed. Fixed.
 
> As long as you have another command after the "} || : &&", you can just
> write "}" instead.

OK.

> > +test_expect_failure 'checkout submodule during rewrite' '
> > +	git reset --hard original &&
> > +	git filter-branch -f --tree-filter \
> > +	    "git submodule update --init &&
> > +	     cd submod &&
> > +	     git reset --hard origin/master" HEAD
> 
> You must not change the directory without changing back. Use a sub-shell.
> 
> I'm not sure whether it's worth catering for this use-case anyway.
> Replacing a submodule commit should really be done only in the
> --index-filter. The tree that --tree-filter checks out is intended only as
> a temporary scratch area. It is not intended as a full worktree. In
> particular, since 'submodule update --init' changes the configuration, it
> is extremly dangerous to call from a filter.

I fully agree. I don't plan to put this test in the final version of the 
patch. I wrote this test because I didn't exactly know which issue has Dscho 
in mind. If it was this one, I wanted to show that this is not relevant.

I'm sending corrected version of the patch with tests.

Thanks
Michal

  reply	other threads:[~2010-01-27 23:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25 13:06 filter-branch fix and tests Michal Sojka
2010-01-25 13:06 ` [PATCH 1/2] filter-branch: Fix to allow replacing submodules with another content Michal Sojka
2010-01-25 13:06 ` [PATCH 2/2] filter-branch: Add tests for submodules Michal Sojka
     [not found] ` <alpine.DEB.1.00.1001261939420.4641@intel-tinevez-2-302>
2010-01-27 15:49   ` [PATCH] filter-branch fix and tests Michal Sojka
2010-01-27 16:18     ` Johannes Sixt
2010-01-27 23:41       ` Michal Sojka [this message]
2010-01-27 23:55         ` [PATCHv3] filter-branch: Add tests for submodules Michal Sojka
2010-01-28  0:14           ` Junio C Hamano
2010-01-28  9:02             ` Michal Sojka
2010-01-28  9:08               ` [PATCHv4 1/2] filter-branch: Fix to allow replacing submodules with another content Michal Sojka
2010-01-28  9:08               ` [PATCHv4 2/2] filter-branch: Add tests for submodules in tree-filter Michal Sojka
2010-01-28 21:57                 ` Junio C Hamano
2010-01-29 15:20                   ` Michal Sojka
2010-01-29 15:27                     ` [PATCHv5 1/2] filter-branch: Fix to allow replacing submodules with another content Michal Sojka
2010-01-29 15:27                     ` [PATCHv5 2/2] filter-branch: Add tests for submodules in tree-filter Michal Sojka

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=201001280041.23182.sojkam1@fel.cvut.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    /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).