summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-06-08 21:39:55 +0200
committerLudovic Courtès <ludo@gnu.org>2020-06-09 00:34:52 +0200
commit72357e2170e88f73c11ff089f87a744cee8606ec (patch)
tree6a80061f7a74c68ab6ed8a2e8144ed3c27742d40
parent5d95ac9178c2b4f5510390b0c31d440efc3c203d (diff)
git: 'commit-difference' really excludes the ancestors of #:excluded.
* guix/git.scm (commit-difference): Initialize VISITED to the closure of OLD and EXCLUDED, as written in the docstring. * tests/git.scm ("commit-difference, excluded commits"): Adjust accordingly.
-rw-r--r--guix/git.scm4
-rw-r--r--tests/git.scm3
2 files changed, 4 insertions, 3 deletions
diff --git a/guix/git.scm b/guix/git.scm
index 1671f57d9f4..0d8e617cc9c 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -416,7 +416,9 @@ Essentially, this computes the set difference between the closure of NEW and
416that of OLD." 416that of OLD."
417 (let loop ((commits (list new)) 417 (let loop ((commits (list new))
418 (result '()) 418 (result '())
419 (visited (commit-closure old (list->setq excluded)))) 419 (visited (fold commit-closure
420 (setq)
421 (cons old excluded))))
420 (match commits 422 (match commits
421 (() 423 (()
422 (reverse result)) 424 (reverse result))
diff --git a/tests/git.scm b/tests/git.scm
index 4a806abcc30..aa4f03ca62c 100644
--- a/tests/git.scm
+++ b/tests/git.scm
@@ -119,8 +119,7 @@
119 (list commit3 commit4)) 119 (list commit3 commit4))
120 (lset= eq? (commit-difference commit4 commit1 (list commit3)) 120 (lset= eq? (commit-difference commit4 commit1 (list commit3))
121 (list commit4)) 121 (list commit4))
122 (lset= eq? (commit-difference commit4 commit1 (list commit5)) 122 (null? (commit-difference commit4 commit1 (list commit5))))))))
123 (list commit2 commit3 commit4)))))))
124 123
125(unless (which (git-command)) (test-skip 1)) 124(unless (which (git-command)) (test-skip 1))
126(test-equal "commit-relation" 125(test-equal "commit-relation"