diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-06-27 20:44:28 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-06-27 20:44:28 +0200 |
commit | bdd1d73969ff9015f444239099ed4cdd6afff910 (patch) | |
tree | d3a7332cdde0e549dca9da48d1576f761da448bb /test | |
parent | a56d5c3c753241d205ed2f3e28618d18bf8eb1d9 (diff) |
Test repo subtree
Diffstat (limited to 'test')
-rw-r--r-- | test/script/repo.et | 65 |
1 files changed, 65 insertions, 0 deletions
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/ |