File: t7515-status-symlinks.sh

package info (click to toggle)
cgit 1.1%2Bgit2.10.2-3~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 31,812 kB
  • sloc: ansic: 179,975; sh: 150,940; perl: 29,466; tcl: 21,429; python: 7,116; makefile: 3,424; lisp: 1,786; php: 120; asm: 98; csh: 45
file content (43 lines) | stat: -rwxr-xr-x 972 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh

test_description='git status and symlinks'

. ./test-lib.sh

test_expect_success 'setup' '
	echo .gitignore >.gitignore &&
	echo actual >>.gitignore &&
	echo expect >>.gitignore &&
	mkdir dir &&
	echo x >dir/file1 &&
	echo y >dir/file2 &&
	git add dir &&
	git commit -m initial &&
	git tag initial
'

test_expect_success SYMLINKS 'symlink to a directory' '
	test_when_finished "rm symlink" &&
	ln -s dir symlink &&
	echo "?? symlink" >expect &&
	git status --porcelain >actual &&
	test_cmp expect actual
'

test_expect_success SYMLINKS 'symlink replacing a directory' '
	test_when_finished "rm -rf copy && git reset --hard initial" &&
	mkdir copy &&
	cp dir/file1 copy/file1 &&
	echo "changed in copy" >copy/file2 &&
	git add copy &&
	git commit -m second &&
	rm -rf copy &&
	ln -s dir copy &&
	echo " D copy/file1" >expect &&
	echo " D copy/file2" >>expect &&
	echo "?? copy" >>expect &&
	git status --porcelain >actual &&
	test_cmp expect actual
'

test_done