feat(L04): add Git status add and commit card
This commit is contained in:
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
repo="$(mktemp -d)"; trap 'rm -rf -- "$repo"' EXIT
|
||||
git -C "$repo" init -q -b main
|
||||
git -C "$repo" config user.name 'Console Student'; git -C "$repo" config user.email 'student@example.invalid'
|
||||
[[ "$(git -C "$repo" rev-parse --is-inside-work-tree)" == true ]]
|
||||
[[ "$(git -C "$repo" branch --show-current)" == main ]]
|
||||
if git -C "$repo" rev-parse --verify HEAD >/dev/null 2>&1; then exit 1; fi
|
||||
[[ "$(git -C "$repo" config --local user.name)" == 'Console Student' ]]
|
||||
printf 'PASS task01 inside_work_tree=true branch=main commits=0 identity=local\n'
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
repo="$(mktemp -d)"; trap 'rm -rf -- "$repo"' EXIT
|
||||
git -C "$repo" init -q -b main
|
||||
printf 'first lesson\n' >"$repo/notes.txt"
|
||||
before="$(git -C "$repo" status --short)"; [[ "$before" == '?? notes.txt' ]]
|
||||
git -C "$repo" add notes.txt
|
||||
after="$(git -C "$repo" status --short)"; [[ "$after" == 'A notes.txt' ]]
|
||||
printf 'PASS task02 before="?? notes.txt" after="A notes.txt" index_entries=1\n'
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
repo="$(mktemp -d)"; trap 'rm -rf -- "$repo"' EXIT
|
||||
git -C "$repo" init -q -b main; git -C "$repo" config user.name 'Console Student'; git -C "$repo" config user.email 'student@example.invalid'
|
||||
printf 'first lesson\n' >"$repo/notes.txt"; git -C "$repo" add notes.txt
|
||||
GIT_AUTHOR_DATE='2026-01-01T00:00:00Z' GIT_COMMITTER_DATE='2026-01-01T00:00:00Z' git -C "$repo" commit -q -m 'add lesson notes'
|
||||
count="$(git -C "$repo" rev-list --count HEAD)"; subject="$(git -C "$repo" log -1 --format=%s)"; status="$(git -C "$repo" status --porcelain)"
|
||||
[[ "$count" -eq 1 && "$subject" == 'add lesson notes' && -z "$status" ]]
|
||||
printf 'PASS task03 commits=1 subject="add lesson notes" clean=1 branch=main\n'
|
||||
Reference in New Issue
Block a user