git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 7d68a6e2a5363586f39c3ca9417687c62adec6bb 1534 bytes (raw)
name: t/t4045-diff-relative.sh 	 # note: path name is non-authoritative(*)

 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
#!/bin/sh

test_description='diff --relative tests'
. ./test-lib.sh

test_expect_success 'setup' '
	git commit --allow-empty -m empty &&
	echo content >file1 &&
	mkdir subdir &&
	echo other content >subdir/file2 &&
	git add . &&
	git commit -m one
'

check_diff() {
dir=$1; shift
expect=$1; shift
cat >expected <<EOF
diff --git a/$expect b/$expect
new file mode 100644
index 0000000..25c05ef
--- /dev/null
+++ b/$expect
@@ -0,0 +1 @@
+other content
EOF
test_expect_success "-p $*" "
	git -C '$dir' diff -p $* HEAD^ >actual &&
	test_cmp expected actual
"
}

check_numstat() {
dir=$1; shift
expect=$1; shift
cat >expected <<EOF
1	0	$expect
EOF
test_expect_success "--numstat $*" "
	echo '1	0	$expect' >expected &&
	git -C '$dir' diff --numstat $* HEAD^ >actual &&
	test_cmp expected actual
"
}

check_stat() {
dir=$1; shift
expect=$1; shift
cat >expected <<EOF
 $expect | 1 +
 1 file changed, 1 insertion(+)
EOF
test_expect_success "--stat $*" "
	git -C '$dir' diff --stat $* HEAD^ >actual &&
	test_i18ncmp expected actual
"
}

check_raw() {
dir=$1; shift
expect=$1; shift
cat >expected <<EOF
:000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A	$expect
EOF
test_expect_success "--raw $*" "
	git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&
	test_cmp expected actual
"
}

for type in diff numstat stat raw; do
	check_$type . file2 --relative=subdir/
	check_$type . file2 --relative=subdir
	check_$type . dir/file2 --relative=sub
	check_$type subdir file2 --relative
done

test_done

debug log:

solving 7d68a6e2a5 ...
found 7d68a6e2a5 in https://public-inbox.org/git/20171209204013.10997-6-chriscool@tuxfamily.org/ ||
	https://public-inbox.org/git/20171207190135.28660-1-jacob.e.keller@intel.com/
found 3950f5034d in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 3950f5034d319be99695c9332b22a8d26e20ff32	t/t4045-diff-relative.sh

applying [1/1] https://public-inbox.org/git/20171209204013.10997-6-chriscool@tuxfamily.org/
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 3950f5034d..7d68a6e2a5 100755

Checking patch t/t4045-diff-relative.sh...
Applied patch t/t4045-diff-relative.sh cleanly.

skipping https://public-inbox.org/git/20171207190135.28660-1-jacob.e.keller@intel.com/ for 7d68a6e2a5
index at:
100755 7d68a6e2a5363586f39c3ca9417687c62adec6bb	t/t4045-diff-relative.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).