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

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.

> +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?

As long as you have another command after the "} || : &&", you can just
write "}" instead.

> +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.

-- Hannes

  reply	other threads:[~2010-01-27 16:18 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 [this message]
2010-01-27 23:41       ` Michal Sojka
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=4B606748.2050209@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=sojkam1@fel.cvut.cz \
    /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).