summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-22 02:09:02 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-25 05:38:51 (GMT)
commit3fed15f568c24ec00ef78fddc6cbb881fbbb0277 (patch)
treeae1ea1d4895be89d90d8e801a717ca569e363ac0 /t
parentda94faf671c6b7c4db1ae07137bd93e31e232b4c (diff)
downloadgit-3fed15f568c24ec00ef78fddc6cbb881fbbb0277.zip
git-3fed15f568c24ec00ef78fddc6cbb881fbbb0277.tar.gz
git-3fed15f568c24ec00ef78fddc6cbb881fbbb0277.tar.bz2
Add 'ident' conversion.
The 'ident' attribute set to path squashes "$ident:<any bytes except dollor sign>$" to "$ident$" upon checkin, and expands it to "$ident: <blob SHA-1> $" upon checkout. As we have two conversions that affect checkin/checkout paths, clarify how they interact with each other. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't')
-rwxr-xr-xt/t0021-conversion.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
new file mode 100755
index 0000000..ad952c9
--- /dev/null
+++ b/t/t0021-conversion.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+test_description='blob conversion via gitattributes'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ {
+ echo "*.i ident"
+ } >.gitattributes &&
+
+ {
+ echo a b c d e f g h i j k l m
+ echo n o p q r s t u v w x y z
+ echo '\''$ident$'\''
+ } >test &&
+ cat test >test.t &&
+ cat test >test.o &&
+ cat test >test.i &&
+ git add test test.t test.i &&
+ rm -f test test.t test.i &&
+ git checkout -- test test.t test.i
+'
+
+script='s/^\$ident: \([0-9a-f]*\) \$/\1/p'
+
+test_expect_success check '
+
+ cmp test.o test &&
+ cmp test.o test.t &&
+
+ # ident should be stripped in the repository
+ git diff --raw --exit-code :test :test.i &&
+ id=$(git rev-parse --verify :test) &&
+ embedded=$(sed -ne "$script" test.i) &&
+ test "z$id" = "z$embedded"
+'
+
+test_done