git
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not git’s official test suite, and the git project is not affiliated with atago.
Summary #
3 suites · 8 scenarios
Contents #
- git + changes (a staged blob touches exactly index + one object) — 2 scenarios
- git (third-party CLI, no build required) — 5 scenarios
- git + sandbox_home (global config in an isolated HOME) — 1 scenario
git + changes (a staged blob touches exactly index + one object) #
Source: test/e2e/thirdparty/git/changes.atago.yaml
Scenario: staging one file creates the index and a single loose object (POSIX) #
skipped on Windows
Given #
- Fixture file
repo/f.txtis created.
Inputs #
Fixture repo/f.txt:
hello from atago
When #
git init -q repo
git -C repo add f.txt
Then #
- after
git init -q repo:- exit code is
0
- exit code is
- after
git -C repo add f.txt:- exit code is
0 - the step changed exactly created
repo/.git/index,repo/.git/objects/*/*, modified nothing, deleted nothing
- exit code is
Scenario: git init’s whole .git tree is pinned by one recursive glob (POSIX) #
skipped on Windows
When #
git init -q repo
Then #
- exit code is
0 - the step changed exactly created
repo/.git/**, modified nothing, deleted nothing
git (third-party CLI, no build required) #
Source: test/e2e/thirdparty/git/git.atago.yaml
Scenario: init creates an empty repository #
When #
git init -q repo
git -C repo rev-parse HEAD
Then #
- after
git init -q repo:- exit code is
0 - file
repo/.git/HEADcontainsref
- exit code is
- after
git -C repo rev-parse HEAD:- exit code is not
0
- exit code is not
Scenario: add and commit make the working tree clean #
Given #
- Fixture file
repo-src/hello.txtis created.
Inputs #
Fixture repo-src/hello.txt:
hello from atago
When #
git init -q repo-src
git -C repo-src add hello.txt
git -C repo-src -c user.name=atago -c user.email=atago@example.com commit -q -m "add hello"
git -C repo-src status --porcelain
git -C repo-src log --oneline
Then #
- after
git -C repo-src -c user.name=atago -c user.email=atago@example.com commit -q -m "add hello":- exit code is
0
- exit code is
- after
git -C repo-src status --porcelain:- exit code is
0 - stdout is empty
- exit code is
- after
git -C repo-src log --oneline:- stdout contains
add hello
- stdout contains
Scenario: a captured commit hash flows into a later command #
Given #
- Fixture file
r/f.txtis created.
Inputs #
Fixture r/f.txt:
v1
When #
git init -q r
git -C r add f.txt
git -C r -c user.name=atago -c user.email=atago@example.com commit -q -m "first"
git -C r rev-parse HEAD
# capture ${head} from stdout
git -C r show --no-patch --format=%s ${head}
Then #
- after
git -C r show --no-patch --format=%s ${head}:- exit code is
0 - stdout contains
first
- exit code is
Scenario: checking out a missing ref fails with an explanation (no-such-branch) #
When #
git init -q repo
git -C repo checkout no-such-branch
Then #
- after
git -C repo checkout no-such-branch:- exit code is not
0 - stderr contains
no-such-branch
- exit code is not
Scenario: checking out a missing ref fails with an explanation (v9.9.9) #
When #
git init -q repo
git -C repo checkout v9.9.9
Then #
- after
git -C repo checkout v9.9.9:- exit code is not
0 - stderr contains
v9.9.9
- exit code is not
git + sandbox_home (global config in an isolated HOME) #
Source: test/e2e/thirdparty/git/sandbox_home.atago.yaml
Scenario: global user.name is written under the sandbox home and read back (POSIX) #
skipped on Windows
Given #
- The command runs with an isolated home under
${workdir}/.atago-home(HOME/XDG or APPDATA redirected). - The command runs with an isolated home under
${workdir}/.atago-home(HOME/XDG or APPDATA redirected).
When #
git config --global user.name atago-sandbox-user
git config --global user.name
Then #
- after
git config --global user.name atago-sandbox-user:- exit code is
0 - file
.atago-home/.gitconfigcontainsatago-sandbox-user
- exit code is
- after
git config --global user.name:- exit code is
0 - stdout equals an exact value
- exit code is