shithub: regress

Download patch

ref: 88141f61026e33f0ece140dbc1192059822b721f
parent: 4d955c05e146a5d9f42b90775fa49e376e218474
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Aug 17 00:30:56 EDT 2021

git: add tests for adding files with absolute paths.

--- /dev/null	Mon Oct 18 12:05:45 2021
+++ b/cmd/git/add.expected	Tue Aug 17 00:30:56 2021
@@ -0,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	Thu Aug 12 11:14:45 2021
+++ b/cmd/git/add.rc	Tue Aug 17 00:30:56 2021
@@ -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	Thu Aug 12 11:14:45 2021
+++ b/cmd/git/mkfile	Tue Aug 17 00:30:56 2021
@@ -1,6 +1,7 @@
 </$objtype/mkfile
 
 TEST=\
+	add\
 	basic\
 	export\
 	merge