From bdd1d73969ff9015f444239099ed4cdd6afff910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Fri, 27 Jun 2025 20:44:28 +0200 Subject: Test repo subtree --- test/script/repo.et | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 test/script/repo.et (limited to 'test') diff --git a/test/script/repo.et b/test/script/repo.et new file mode 100644 index 0000000..7a34a1c --- /dev/null +++ b/test/script/repo.et @@ -0,0 +1,65 @@ +test RepoSubtree: + node n + shell on n as git_init: + mkdir -p work + git -C work -c init.defaultBranch=master init -q + git -C work -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit' + + mkdir -p work/first/second + touch work/first/second/file + git -C work add first + git -C work -c user.name=test -c user.email=test commit -q -m 'commit' + git -C work rev-parse HEAD^{commit} + git -C work rev-parse HEAD^{tree} + git -C work rev-parse HEAD:first + git -C work rev-parse HEAD:first/second + + expect /([0-9a-f]+)/ from git_init capture commit + expect /([0-9a-f]+)/ from git_init capture root + expect /([0-9a-f]+)/ from git_init capture sub1 + expect /([0-9a-f]+)/ from git_init capture sub2 + + for repo in [ "./work" ]: + local: + spawn as p on n args [ repo, "subtree", commit, "" ] + expect from p /msg $root/ + + local: + spawn as p on n args [ repo, "subtree", commit, "." ] + expect from p /msg $root/ + + local: + spawn as p on n args [ repo, "subtree", commit, "/" ] + expect from p /msg $root/ + + local: + spawn as p on n args [ repo, "subtree", commit, "first" ] + expect from p /msg $sub1/ + + local: + spawn as p on n args [ repo, "subtree", commit, "./first" ] + expect from p /msg $sub1/ + + local: + spawn as p on n args [ repo, "subtree", commit, "/first" ] + expect from p /msg $sub1/ + + local: + spawn as p on n args [ repo, "subtree", commit, "./first/second" ] + expect from p /msg $sub2/ + + local: + spawn as p on n args [ repo, "subtree", commit, "/first/second" ] + expect from p /msg $sub2/ + + local: + spawn as p on n args [ repo, "subtree", "$sub1(first)", "second" ] + expect from p /msg $sub2/ + + local: + spawn as p on n args [ repo, "subtree", "$sub1(first)", "./second" ] + expect from p /msg $sub2/ + + local: + spawn as p on n args [ repo, "subtree", "$sub1(first)", "/second/" ] + expect from p /msg $sub2/ -- cgit v1.2.3