The main goal here was to avoid double-quotes for
surrounding the test snippet, since it makes the code hard
to read (and to grep for common problems).
But while we're here, we can fix a few other things:
  - use test_path_* helpers, which are more robust and give
    better error messages
  - only "cd" inside a subshell, which leaves the
    environment pristine if further tests are added
  - consistently quote shell arguments. These aren't wrong
    if we assume find-rev output doesn't have any
    whitespace, but it doesn't hurt to be careful.
  - replace the old-style 'test x$foo = x' with 'test -z
    "$foo"'. Besides the quoting fix, this is the form we
    generally use in our test suite.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			969 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			969 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/sh
 | 
						|
#
 | 
						|
# Copyright (c) 2007 Eric Wong
 | 
						|
#
 | 
						|
 | 
						|
test_description='git svn tracking removed top-level path'
 | 
						|
. ./lib-git-svn.sh
 | 
						|
 | 
						|
test_expect_success 'make history for tracking' '
 | 
						|
	mkdir import &&
 | 
						|
	mkdir import/trunk &&
 | 
						|
	echo hello >> import/trunk/README &&
 | 
						|
	svn_cmd import -m initial import "$svnrepo" &&
 | 
						|
	rm -rf import &&
 | 
						|
	svn_cmd co "$svnrepo"/trunk trunk &&
 | 
						|
	echo bye bye >> trunk/README &&
 | 
						|
	svn_cmd rm -m "gone" "$svnrepo"/trunk &&
 | 
						|
	rm -rf trunk &&
 | 
						|
	mkdir trunk &&
 | 
						|
	echo "new" > trunk/FOLLOWME &&
 | 
						|
	svn_cmd import -m "new trunk" trunk "$svnrepo"/trunk
 | 
						|
'
 | 
						|
 | 
						|
test_expect_success 'clone repo with git' '
 | 
						|
	git svn clone -s "$svnrepo" x &&
 | 
						|
	test_path_is_file x/FOLLOWME &&
 | 
						|
	test_path_is_missing x/README
 | 
						|
'
 | 
						|
 | 
						|
test_expect_success 'make sure r2 still has old file' '
 | 
						|
	(
 | 
						|
		cd x &&
 | 
						|
		test -n "$(git svn find-rev r1)" &&
 | 
						|
		git reset --hard "$(git svn find-rev r1)" &&
 | 
						|
		test_path_is_file README &&
 | 
						|
		test_path_is_missing FOLLOWME &&
 | 
						|
		test -z "$(git svn find-rev r2)"
 | 
						|
	)
 | 
						|
'
 | 
						|
 | 
						|
test_done
 |