aboutsummaryrefslogtreecommitdiff
A big thanks to Eelco Dolstra, who designed and implemented Nix.
Transposing functional programming discipline to package management
proved to be inspiring and fruitful.

Thanks to the following people who contributed to GNU Guix through
suggestions, bug reports, patches, internationalization, or general
infrastructure help:

	    Lluís Batlle i Rossell <viric@viric.name>
          Sylvain Beucler <beuc@beuc.net>
	   Carlos Carleos <carleos@uniovi.es>
	   Felipe Castro <fefcas@gmail.com>
	   Daniel Clark <dclark@pobox.com>
	Alexandru Cojocaru <xojoc@gmx.com>
	    Aleix Conchillo Flaqué <aconchillo@gmail.com>
          Malcolm Cook <MEC@stowers.org>
           Thomas Danckaert <thomas.danckaert@gmail.com>
	   Rafael Ferreira <rafael.f.f1@gmail.com>
	Christian Grothoff <christian@grothoff.org>
             Eric Hanchrow <eric.hanchrow@gmail.com>
           Konrad Hinsen <konrad.hinsen@fastmail.net>
          Brandon Invergo <brandon@gnu.org>
           Anders Jonsson <anders.jonsson@norsjovallen.se>
	  Jeffrin Jose <ahiliation@yahoo.co.in>
	          Kete <kete@ninthfloor.org>
           Daniel Kochmański <dkochmanski@hellsgate.pl>
	  Matthew Lien <bluet@bluet.org>
             Dave Love <fx@gnu.org>
            Chris Marusich <cmmarusich@gmail.com>
            Niels Möller <nisse@lysator.liu.se>
          Cyprien Nicolas <cyprien@nicolas.tf>
	   Yutaka Niibe <gniibe@fsij.org>
           Andrei Osipov <andrspv@gmail.com>
                  Petter <petter@mykolab.ch>
             Adam Pribyl <pribyl@lowlevel.cz>
            Pjotr Prins <pjotr.public12@thebird.nl>
  Yakkala Yagnesh Raghava <hi@yagnesh.org>
           Joshua Randall <jcrandall@alum.mit.edu>
      Bruno Félix Rezende Ribeiro <oitofelix@gnu.org>
	    Benno Schulenberg <coordinator@translationproject.org>
           Thomas Schwinge <thomas@codesourcery.com>
        Alexander Shendi <Alexander.Shendi@web.de>
	     Alen Skondro <askondro@gmail.com>
              Jan Synáček <jan.synacek@gmail.com>
	 Matthias Wachs <wachs@net.in.tum.de>
        Christine Lemmer-Webber <cwebber@dustycloud.org>
           Philip Woods <elzairthesorcerer@gmail.com>

GNU Guix also includes non-software works.  Thanks to the following
people who contributed the logo and general artwork and themes:

           Nikita Karetnikov <nikita@karetnikov.org>
           Felipe López <felipe.lopez@openmailbox.org>
ef='#n76'>76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
;;;
;;; 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 <http://www.gnu.org/licenses/>.

(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 "devel/2.txt" "2")
        (commit "second devel commit")
        (checkout "master")
        (add "b.txt" "B")
        (commit "second commit")
        (add "c.txt" "C")
        (commit "third commit")
        (merge "devel" "merge")
        (add "d.txt" "D")
        (commit "fourth commit"))
    (with-repository directory repository
      (let ((master1 (find-commit repository "first commit"))
            (master2 (find-commit repository "second commit"))
            (master3 (find-commit repository "third commit"))
            (master4 (find-commit repository "fourth commit"))
            (devel1  (find-commit repository "first devel"))
            (devel2  (find-commit repository "second devel"))
            (merge   (find-commit repository "merge")))
        (and (equal? (commit-difference master4 merge)
                     (list master4))
             (lset= eq? (commit-difference master3 master1)
                    (list master3 master2))
             (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")