diff options
| author | Simon Tournier <zimon.toutoune@gmail.com> | 2026-06-13 22:22:16 +0200 |
|---|---|---|
| committer | Simon Tournier <zimon.toutoune@gmail.com> | 2026-06-30 12:08:09 +0200 |
| commit | ba3f2687ca41a30baf572ee3c73e9fa754540859 (patch) | |
| tree | 16a3fa54ceb076783350601f20d645b0714e88f9 /tests | |
| parent | cb7c32bb672d17bdf6e08f156ad612cbb428f025 (diff) | |
tests: git: Improve Git tag check.
Without running 'checkout' as the last Git directives to one branch that
doesn't own the Git tag, the test is trivial thus poorly relevant. This
change checks that 'update-cached-checkout' and that the 'cached-directory'
return both the correct Git object identifier matching the upstream Git object
identifier of the Git tag.
* tests/git.scm ("update-cached-checkout, tag"): Switch to 'master' branch and
improve the checks.
Fixes: guix/guix#9340
Merges: guix/guix!9341
Change-Id: I698f94858a4247b8bdcc54758f38f3623890b6af
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/git.scm | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/git.scm b/tests/git.scm index 712b12c7fc4..6f910070519 100644 --- a/tests/git.scm +++ b/tests/git.scm | |||
| @@ -246,19 +246,26 @@ | |||
| 246 | (checkout "develop") | 246 | (checkout "develop") |
| 247 | (add "b.txt" "B") | 247 | (add "b.txt" "B") |
| 248 | (commit "Second commit") | 248 | (commit "Second commit") |
| 249 | (tag "v1.1" "release-1.1")) | 249 | (tag "v1.1" "release-1.1") |
| 250 | (let ((directory commit relation | 250 | (checkout "master")) |
| 251 | (update-cached-checkout directory | 251 | (let* ((tag (let* ((pipe (open-pipe* OPEN_READ (git-command) |
| 252 | #:ref '(tag . "v1.1") | ||
| 253 | #:cache-directory cache)) | ||
| 254 | (head (let* ((pipe (open-pipe* OPEN_READ (git-command) | ||
| 255 | "-C" directory | 252 | "-C" directory |
| 256 | "rev-parse" "HEAD")) | 253 | "rev-parse" "v1.1^{}")) |
| 257 | (str (get-string-all pipe))) | 254 | (str (get-string-all pipe))) |
| 258 | (close-pipe pipe) | 255 | (close-pipe pipe) |
| 259 | (string-trim-right str)))) | 256 | (string-trim-right str))) |
| 260 | ;; COMMIT should be the ID of the commit object, not that of the tag. | 257 | (cached-directory commit relation |
| 261 | (string=? commit head)))))) | 258 | (update-cached-checkout directory |
| 259 | #:ref '(tag . "v1.1") | ||
| 260 | #:cache-directory cache)) | ||
| 261 | (head (let* ((pipe (open-pipe* OPEN_READ (git-command) | ||
| 262 | "-C" cached-directory | ||
| 263 | "rev-parse" "HEAD")) | ||
| 264 | (str (get-string-all pipe))) | ||
| 265 | (close-pipe pipe) | ||
| 266 | (string-trim-right str)))) | ||
| 267 | (and (string=? commit head) | ||
| 268 | (string=? tag head))))))) | ||
| 262 | 269 | ||
| 263 | (test-assert "update-cached-checkout, untracked files removed" | 270 | (test-assert "update-cached-checkout, untracked files removed" |
| 264 | (call-with-temporary-directory | 271 | (call-with-temporary-directory |
