diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-03-12 21:45:21 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-03-12 21:45:21 -0700 |
commit | 592ebd087a1b33fe93dcd20a1466bc4d119d1c42 (patch) | |
tree | 1fa71a18917f28e68e356d30f8e8f288d48ed746 | |
parent | d9b04430d238be1fe75ef97e3455c65ca72a7fa0 (diff) | |
parent | 9273b56278e64dd47b1a96a705ddf46aeaf6afe3 (diff) | |
download | git-592ebd087a1b33fe93dcd20a1466bc4d119d1c42.tar.gz |
Merge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1
* ek/maint-1.6.1-filter-branch-bare:
filter-branch: Fix fatal error on bare repositories
-rwxr-xr-x | git-filter-branch.sh | 25 | ||||
-rwxr-xr-x | t/t7003-filter-branch.sh | 4 |
2 files changed, 16 insertions, 13 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh index c106f45af7..56d1bd0f99 100755 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -442,19 +442,20 @@ rm -rf "$tempdir" trap - 0 +unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE +test -z "$ORIG_GIT_DIR" || { + GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR +} +test -z "$ORIG_GIT_WORK_TREE" || { + GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" && + export GIT_WORK_TREE +} +test -z "$ORIG_GIT_INDEX_FILE" || { + GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" && + export GIT_INDEX_FILE +} + if [ "$(is_bare_repository)" = false ]; then - unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE - test -z "$ORIG_GIT_DIR" || { - GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR - } - test -z "$ORIG_GIT_WORK_TREE" || { - GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" && - export GIT_WORK_TREE - } - test -z "$ORIG_GIT_INDEX_FILE" || { - GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" && - export GIT_INDEX_FILE - } git read-tree -u -m HEAD fi diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index b0a9d7d536..6a9936e5c4 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -39,7 +39,9 @@ test_expect_success 'result is really identical' ' ' test_expect_success 'rewrite bare repository identically' ' - (git config core.bare true && cd .git && git filter-branch branch) + (git config core.bare true && cd .git && + git filter-branch branch > filter-output 2>&1 && + ! fgrep fatal filter-output) ' git config core.bare false test_expect_success 'result is really identical' ' |