Skip to content

Commit 3bccbb1

Browse files
committed
A baseline test for attribute matching
1 parent 4ef879e commit 3bccbb1

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:5b07dc852f4fb4bdad995572dfebda0b96d9aa4abb1683b5c7338ed4f1cb4415
3+
size 10988
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
set -eu -o pipefail
3+
4+
mkdir basics;
5+
6+
function baseline() {
7+
{
8+
echo "$1"
9+
git -c core.attributesFile=global-gitattributes check-attr -a "$1"
10+
echo
11+
} >> baseline
12+
}
13+
14+
15+
(cd basics
16+
git init
17+
18+
# based on https://github.com/git/git/blob/140b9478dad5d19543c1cb4fd293ccec228f1240/t/t0003-attributes.sh#L45
19+
mkdir -p a/b/d a/c b
20+
(
21+
echo "[attr]notest !test"
22+
echo "\" d \" test=d"
23+
echo " e test=e"
24+
echo " e\" test=e"
25+
echo "f test=f"
26+
echo "a/i test=a/i"
27+
echo "onoff test -test"
28+
echo "offon -test test"
29+
echo "no notest"
30+
echo "A/e/F test=A/e/F"
31+
) > .gitattributes
32+
(
33+
echo "g test=a/g"
34+
echo "b/g test=a/b/g"
35+
) > a/.gitattributes
36+
(
37+
echo "h test=a/b/h"
38+
echo "d/* test=a/b/d/*"
39+
echo "d/yes notest"
40+
) > a/b/.gitattributes
41+
(
42+
echo "global test=global"
43+
) > global-gitattributes
44+
45+
git add . && git commit -qm c1
46+
47+
baseline " d "
48+
baseline e
49+
baseline "e\""
50+
baseline a/i
51+
baseline onoff
52+
baseline offon
53+
baseline no
54+
baseline A/e/F
55+
baseline a/g
56+
baseline a/b/g
57+
baseline a/b/h
58+
baseline a/b/d/ANY
59+
baseline a/b/d/yes
60+
baseline global
61+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[test]
2+
fn baseline() -> crate::Result {
3+
let dir = gix_testtools::scripted_fixture_read_only("make_attributes_baseline.sh")?;
4+
let _repo_dir = dir.join("basics");
5+
// TODO: everything with ignorecase (tolower, expect same results)
6+
7+
Ok(())
8+
}
+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
mod attributes;
12
mod ignore;

0 commit comments

Comments
 (0)