aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2021-02-27 14:55:05 +0100
committerJonas Bernoulli <jonas@bernoul.li>2021-02-27 15:06:11 +0100
commitdb1c7ecc849b83429346c2328c45648cb89722f3 (patch)
treeb97ead28bd19c915fa433091031b8f2c0451d39c /t
parent579e5168e1935b6b86e41c72c484a8dfeaf6ea94 (diff)
test: Deal with init.defaultBranch being set
Diffstat (limited to 't')
-rw-r--r--t/magit-tests.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/t/magit-tests.el b/t/magit-tests.el
index e9e2f33..927d16f 100644
--- a/t/magit-tests.el
+++ b/t/magit-tests.el
@@ -1,6 +1,6 @@
;;; magit-tests.el --- tests for Magit
-;; Copyright (C) 2011-2018 The Magit Project Contributors
+;; Copyright (C) 2011-2021 The Magit Project Contributors
;;
;; License: GPLv3
@@ -14,6 +14,12 @@
(require 'magit)
+(defun magit-test-init-repo (dir)
+ (let ((magit-git-global-arguments
+ (nconc (list "-c" "init.defaultBranch=master")
+ magit-git-global-arguments)))
+ (magit-git "init" dir)))
+
(defmacro magit-with-test-directory (&rest body)
(declare (indent 0) (debug t))
(let ((dir (make-symbol "dir")))
@@ -31,7 +37,7 @@
(defmacro magit-with-test-repository (&rest body)
(declare (indent 0) (debug t))
- `(magit-with-test-directory (magit-git "init" ".") ,@body))
+ `(magit-with-test-directory (magit-test-init-repo ".") ,@body))
;;; Git
@@ -46,7 +52,7 @@
(ert-deftest magit-toplevel:basic ()
(let ((find-file-visit-truename nil))
(magit-with-test-directory
- (magit-git "init" "repo")
+ (magit-test-init-repo "repo")
(magit-test-magit-toplevel)
(should (equal (magit-toplevel "repo/.git/")
(expand-file-name "repo/")))
@@ -76,7 +82,7 @@
(setq default-directory
(concat (format "/sudo:%s@localhost:" (user-login-name))
default-directory))
- (magit-git "init" "repo")
+ (magit-test-init-repo "repo")
(magit-test-magit-toplevel)
(should (equal (magit-toplevel "repo/.git/")
(expand-file-name "repo/")))
@@ -90,10 +96,10 @@
(ert-deftest magit-toplevel:submodule ()
(let ((find-file-visit-truename nil))
(magit-with-test-directory
- (magit-git "init" "remote")
+ (magit-test-init-repo "remote")
(let ((default-directory (expand-file-name "remote/")))
(magit-git "commit" "-m" "init" "--allow-empty"))
- (magit-git "init" "super")
+ (magit-test-init-repo "super")
(setq default-directory (expand-file-name "super/"))
(magit-git "submodule" "add" "../remote" "repo/")
(magit-test-magit-toplevel)
@@ -135,7 +141,7 @@
(should (equal (magit-toplevel "subdir-link-indirect")
(expand-file-name "repo/")))
;; wrap/*link
- (magit-git "init" "wrap")
+ (magit-test-init-repo "wrap")
(make-symbolic-link "../repo" "wrap/repo-link")
(make-symbolic-link "../repo/subdir" "wrap/subdir-link")
(make-symbolic-link "../repo/subdir/subsubdir" "wrap/subsubdir-link")
@@ -156,11 +162,11 @@
(ert-deftest magit-get ()
(magit-with-test-directory
- (magit-git "init" "remote")
+ (magit-test-init-repo "remote")
(let ((default-directory (expand-file-name "remote/")))
(magit-git "commit" "-m" "init" "--allow-empty")
(magit-git "config" "a.b" "remote-value"))
- (magit-git "init" "super")
+ (magit-test-init-repo "super")
(setq default-directory (expand-file-name "super/"))
;; Some tricky cases:
;; Multiple config values.