Re: [PATCH] filter-branch fix and tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]