ref: 88141f61026e33f0ece140dbc1192059822b721f
parent: 4d955c05e146a5d9f42b90775fa49e376e218474
author: Ori Bernstein <[email protected]>
date: Tue Aug 17 00:30:56 EDT 2021
git: add tests for adding files with absolute paths.
--- /dev/null
+++ b/cmd/git/add.expected
@@ -1,0 +1,9 @@
+A a
+A b
+A dir/a
+A dir/b
+A extra/a
+A extra/b
+A more/a
+A more/b
+A more/c
--- a/cmd/git/add.rc
+++ b/cmd/git/add.rc
@@ -1,30 +1,34 @@
-#!/bin/rc -e
+#!/bin/rc
-rm -fr addrepo
-mkdir -p addrepo
+. ../util.rc
-echo @@ version1 @@
+rm -fr scratch
+mkdir -p scratch/repo
+
+echo @@ abs paths @@
@{
-rfork ne
-cd addrepo
-pwd=`{pwd}
-git/init
-mkdir dir
-mkdir another
-mkdir more
-touch a b c
-touch dir/a dir/b dir/c
-touch another/a another/b another/c
-touch more/a another/b another/c
-git/add a
-git/add $pwd/b
-git/add dir/a
-git/add $pwd/dir/b
-git/add more
-git/fs
-git/walk > ../actual.v1
-git/commit -m version1 .
+ rfork ne
+ cd scratch/repo
+ pwd=`{pwd}
+ git/init
+ mkdir dir
+ mkdir another
+ mkdir more
+ mkdir extra
+ touch a b c
+ touch dir/^(a b c)
+ touch another/^(a b c)
+ touch more/^(a b c)
+ touch extra/^(a b c)
+ git/add a
+ git/add $pwd/b
+ git/add dir/a
+ git/add $pwd/dir/b
+ git/add more
+ @{cd more && git/add ../extra/a}
+ @{cd more && git/add $pwd/extra/b}
+ git/fs
+ git/walk > ../added
}
-diff -c actual.v1 expected.v1
-
+diff -c scratch/added added.expected >/dev/null || die wrong files
--- a/cmd/git/mkfile
+++ b/cmd/git/mkfile
@@ -1,6 +1,7 @@
</$objtype/mkfile
TEST=\
+ add\
basic\
export\
merge