Currently filter-branch exports GIT_DIR only if it is a relative path but git-sh-setup might also set GIT_DIR to an absolute path that is not exported yet. Additionally we need to export GIT_WORK_TREE with GIT_DIR to ensure that the current working directory is used as working tree even for bare repositories. Signed-off-by: Matthias Lederhofer <matled@xxxxxxx> --- Junio C Hamano <gitster@xxxxxxxxx> wrote: > Hmph. > > When this series is applied on top of 'next' (or whatever > contains t7003-filter-branch.sh), this seems to break it quite > badly. With the GIT_WORK_TREE patch series a relative path in GIT_DIR is expanded to an absolute path. Therefore GIT_DIR=$(GIT_DIR=.git git rev-parse --git-dir) in git-sh-setup will give the full path to the repository. git-filter-branch exports GIT_DIR only if the path is relative. In consequence GIT_DIR was not set at all and the following git commands failed. Additionally GIT_WORK_TREE has to be exported because to make sure that the current directory is used as working tree even for bare repositories. I merged the worktree branch to next and applied the patch, all tests passed. This problem reveals a small change which might cause trouble with other scripts. I looked at the git repository and found no other script which should have problems with this series. With $ git grep -e export --and -e GIT_DIR I found: Documentation/install-doc-quick.sh git-clone.sh git-instaweb.sh These do not need a working tree. git-cvsexportcommit.perl git apply is used with GIT_DIR='', this forces git-apply not to use the git repository. I'm not sure if any other script out there tries to do this. Perhaps we should just keep the old behaviour and use the current directory as working tree when the repository name ends in /.git even though core.bare is true? --- git-filter-branch.sh | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/git-filter-branch.sh b/git-filter-branch.sh index 0c8a7df..f4cfbea 100644 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -313,9 +313,12 @@ workdir="$(pwd)" case "$GIT_DIR" in /*) + export GIT_DIR + export GIT_WORK_TREE=. ;; *) export GIT_DIR="$(pwd)/../../$GIT_DIR" + export GIT_WORK_TREE=. ;; esac -- 1.5.2.1.120.g3877-dirty - 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