 4114156ae9
			
		
	
	4114156ae9
	
	
	
		
			
			Many tests pass $(pwd) in some form to git and later test that the output of git contains the correct value of $(pwd). For example, the test of 'git remote show' sets up a remote that contains $(pwd) and then the expected result must contain $(pwd). Again, MSYS-bash's path mangling kicks in: Plain $(pwd) uses the MSYS style absolute path /c/path/to/git. The test case would write this name into the 'expect' file. But when git is invoked, MSYS-bash converts this name to the Windows style path c:/path/to/git, and git would produce this form in the result; the test would fail. We fix this by passing -W to bash's pwd that produces the Windows-style path. There are a two cases that need an accompanying change: - In t1504 the value of $(pwd) becomes part of a path list. In this case, the lone 'c' in something like /foo:c:/path/to/git:/bar inhibits MSYS-bashes path mangling; IOW in this case we want the /c/path/to/git form to allow path mangling. We use $PWD instead of $(pwd), which always has the latter form. - In t6200, $(pwd) - the Windows style path - must be used to construct the expected result because that is the path form that git sees. (The change in the test itself is just for consistency: 'git fetch' always sees the Windows-style path, with or without the change.) Signed-off-by: Johannes Sixt <j6t@kdbg.org>
		
			
				
	
	
		
			164 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			164 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| test_description='test GIT_CEILING_DIRECTORIES'
 | |
| . ./test-lib.sh
 | |
| 
 | |
| test_prefix() {
 | |
| 	test_expect_success "$1" \
 | |
| 	"test '$2' = \"\$(git rev-parse --show-prefix)\""
 | |
| }
 | |
| 
 | |
| test_fail() {
 | |
| 	test_expect_code 128 "$1: prefix" \
 | |
| 	"git rev-parse --show-prefix"
 | |
| }
 | |
| 
 | |
| TRASH_ROOT="$PWD"
 | |
| ROOT_PARENT=$(dirname "$TRASH_ROOT")
 | |
| 
 | |
| 
 | |
| unset GIT_CEILING_DIRECTORIES
 | |
| test_prefix no_ceil ""
 | |
| 
 | |
| export GIT_CEILING_DIRECTORIES
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES=""
 | |
| test_prefix ceil_empty ""
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$ROOT_PARENT"
 | |
| test_prefix ceil_at_parent ""
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$ROOT_PARENT/"
 | |
| test_prefix ceil_at_parent_slash ""
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT"
 | |
| test_prefix ceil_at_trash ""
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/"
 | |
| test_prefix ceil_at_trash_slash ""
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub"
 | |
| test_prefix ceil_at_sub ""
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/"
 | |
| test_prefix ceil_at_sub_slash ""
 | |
| 
 | |
| 
 | |
| mkdir -p sub/dir || exit 1
 | |
| cd sub/dir || exit 1
 | |
| 
 | |
| unset GIT_CEILING_DIRECTORIES
 | |
| test_prefix subdir_no_ceil "sub/dir/"
 | |
| 
 | |
| export GIT_CEILING_DIRECTORIES
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES=""
 | |
| test_prefix subdir_ceil_empty "sub/dir/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT"
 | |
| test_fail subdir_ceil_at_trash
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/"
 | |
| test_fail subdir_ceil_at_trash_slash
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub"
 | |
| test_fail subdir_ceil_at_sub
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/"
 | |
| test_fail subdir_ceil_at_sub_slash
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/dir"
 | |
| test_prefix subdir_ceil_at_subdir "sub/dir/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/dir/"
 | |
| test_prefix subdir_ceil_at_subdir_slash "sub/dir/"
 | |
| 
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/su"
 | |
| test_prefix subdir_ceil_at_su "sub/dir/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/su/"
 | |
| test_prefix subdir_ceil_at_su_slash "sub/dir/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/di"
 | |
| test_prefix subdir_ceil_at_sub_di "sub/dir/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/di"
 | |
| test_prefix subdir_ceil_at_sub_di_slash "sub/dir/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/subdi"
 | |
| test_prefix subdir_ceil_at_subdi "sub/dir/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/subdi"
 | |
| test_prefix subdir_ceil_at_subdi_slash "sub/dir/"
 | |
| 
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="/foo:$TRASH_ROOT/sub"
 | |
| test_fail second_of_two
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub:/bar"
 | |
| test_fail first_of_two
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="/foo:$TRASH_ROOT/sub:/bar"
 | |
| test_fail second_of_three
 | |
| 
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub"
 | |
| GIT_DIR=../../.git
 | |
| export GIT_DIR
 | |
| test_prefix git_dir_specified ""
 | |
| unset GIT_DIR
 | |
| 
 | |
| 
 | |
| cd ../.. || exit 1
 | |
| mkdir -p s/d || exit 1
 | |
| cd s/d || exit 1
 | |
| 
 | |
| unset GIT_CEILING_DIRECTORIES
 | |
| test_prefix sd_no_ceil "s/d/"
 | |
| 
 | |
| export GIT_CEILING_DIRECTORIES
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES=""
 | |
| test_prefix sd_ceil_empty "s/d/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT"
 | |
| test_fail sd_ceil_at_trash
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/"
 | |
| test_fail sd_ceil_at_trash_slash
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/s"
 | |
| test_fail sd_ceil_at_s
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/s/"
 | |
| test_fail sd_ceil_at_s_slash
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/s/d"
 | |
| test_prefix sd_ceil_at_sd "s/d/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/s/d/"
 | |
| test_prefix sd_ceil_at_sd_slash "s/d/"
 | |
| 
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/su"
 | |
| test_prefix sd_ceil_at_su "s/d/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/su/"
 | |
| test_prefix sd_ceil_at_su_slash "s/d/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/s/di"
 | |
| test_prefix sd_ceil_at_s_di "s/d/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/s/di"
 | |
| test_prefix sd_ceil_at_s_di_slash "s/d/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sdi"
 | |
| test_prefix sd_ceil_at_sdi "s/d/"
 | |
| 
 | |
| GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sdi"
 | |
| test_prefix sd_ceil_at_sdi_slash "s/d/"
 | |
| 
 | |
| 
 | |
| test_done
 |