;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (test-git) #:use-module (git) #:use-module (guix git) #:use-module (guix tests git) #:use-module (guix build utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64)) ;; Test the (guix git) tools. (test-begin "git") ;; 'with-temporary-git-repository' relies on the 'git' command. (unless (which (git-command)) (test-skip 1)) (test-assert "commit-difference, linear history" (with-temporary-git-repository directory '((add "a.txt" "A") (commit "first commit") (add "b.txt" "B") (commit "second commit") (add "c.txt" "C") (commit "third commit") (add "d.txt" "D") (commit "fourth commit")) (with-repository directory repository (let ((commit1 (find-commit repository "first")) (commit2 (find-commit repository "second")) (commit3 (find-commit repository "third")) (commit4 (find-commit repository "fourth"))) (and (lset= eq? (commit-difference commit4 commit1) (list commit2 commit3 commit4)) (lset= eq? (commit-difference commit4 commit2) (list commit3 commit4)) (equal? (commit-difference commit3 commit2) (list commit3)) ;; COMMIT4 is not an ancestor of COMMIT1 so we should get the ;; empty list. (null? (commit-difference commit1 commit4))))))) (unless (which (git-command)) (test-skip 1)) (test-assert "commit-difference, fork" (with-temporary-git-repository directory '((add "a.txt" "A") (commit "first commit") (branch "devel") (checkout "devel") (add "devel/1.txt" "1") (commit "first devel commit") (add "devel2022-01-17bash completion: Complete "guix home" sub-commands....* etc/completion/bash/guix (_guix_complete): Treat "guix home" like "guix system". Ludovic Courtès 2022-01-16bash completion: Fix options completion....Fixes, for example, "guix import pypi --<TAB>", which would previously fail to show '--recursive'. * etc/completion/bash/guix (_guix_complete_option): Fix options completion for first subcommand. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Fulbert ster2)) (lset= eq? (commit-difference devel2 master1) (list devel2 devel1)) ;; The merge occurred between MASTER2 and MASTER4 so here we ;; expect to see all the commits from the "devel" branch in ;; addition to those on "master". (lset= eq? (commit-difference master4 master2) (list master4 merge master3 devel1 devel2))))))) (unless (which (git-command)) (test-skip 1)) (test-assert "commit-difference, excluded commits" (with-temporary-git-repository directory '((add "a.txt" "A") (commit "first commit") (add "b.txt" "B") (commit "second commit") (add "c.txt" "C") (commit "third commit") (add "d.txt" "D") (commit "fourth commit") (add "e.txt" "E") (commit "fifth commit")) (with-repository directory repository (let ((commit1 (find-commit repository "first")) (commit2 (find-commit repository "second")) (commit3 (find-commit repository "third")) (commit4 (find-commit repository "fourth")) (commit5 (find-commit repository "fifth"))) (and (lset= eq? (commit-difference commit4 commit1 (list commit2)) (list commit3 commit4)) (lset= eq? (commit-difference commit4 commit1 (list commit3)) (list commit4)) (lset= eq? (commit-difference commit4 commit1 (list commit5)) (list commit2 commit3 commit4))))))) (test-end "git")