From dd5c8af176bb935a0b01a7dc2d5e022565c3aac3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 17 Oct 2007 00:37:36 +0100 Subject: Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE There are a few programs, such as config and diff, which allow running without a git repository. Therefore, they have to call setup_git_directory_gently(). However, when GIT_DIR and GIT_WORK_TREE were set, and the current directory was a subdirectory of the work tree, setup_git_directory_gently() would return a bogus NULL prefix. This patch fixes that. Noticed by REPLeffect on IRC. Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce --- t/t1501-worktree.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 732216184..7ee3820ce 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -103,4 +103,13 @@ test_expect_success 'repo finds its work tree from work tree, too' ' test sub/dir/tracked = "$(git ls-files)") ' +test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' ' + cd repo.git/work/sub/dir && + GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ + git diff --exit-code tracked && + echo changed > tracked && + ! GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ + git diff --exit-code tracked +' + test_done -- cgit v1.2.1 From 46eb449cbefac461659c42c4ba4b36de1959e7ca Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 17 Oct 2007 03:23:10 +0100 Subject: filter-branch: update current branch when rewritten Earlier, "git filter-branch -- HEAD" would not update the working tree after rewriting the branch. This commit fixes it. Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce --- t/t7003-filter-branch.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index e935b2000..2089351f7 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -41,7 +41,9 @@ test_expect_success 'rewrite, renaming a specific file' ' ' test_expect_success 'test that the file was renamed' ' - test d = $(git show HEAD:doh) + test d = $(git show HEAD:doh) && + test -f doh && + test d = $(cat doh) ' git tag oldD HEAD~4 -- cgit v1.2.1