aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/vc/vc-git-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/vc/vc-git-tests.el')
-rw-r--r--test/lisp/vc/vc-git-tests.el35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/lisp/vc/vc-git-tests.el b/test/lisp/vc/vc-git-tests.el
index fe55cc75d6f..9721cc4d4ff 100644
--- a/test/lisp/vc/vc-git-tests.el
+++ b/test/lisp/vc/vc-git-tests.el
@@ -194,4 +194,39 @@ is absent."
194 ("Tracking" . ,main-branch) 194 ("Tracking" . ,main-branch)
195 ("Remote" . "none (tracking local branch)"))))))))) 195 ("Remote" . "none (tracking local branch)")))))))))
196 196
197(ert-deftest vc-git-test-branch-remotes ()
198 "Test behavior of `vc-git--branch-remotes'."
199 (skip-unless (executable-find vc-git-program))
200 (vc-git-test--with-repo repo
201 (let ((main-branch (vc-git-test--start-branch)))
202 (should (null (vc-git--branch-remotes)))
203 (vc-git--out-ok "config"
204 (format "branch.%s.remote" main-branch)
205 "origin")
206 (should (null (vc-git--branch-remotes)))
207 (vc-git--out-ok "config"
208 (format "branch.%s.merge" main-branch)
209 main-branch)
210 (let ((alist (vc-git--branch-remotes)))
211 (should (assq 'upstream alist))
212 (should (null (assq 'push alist))))
213 (vc-git--out-ok "config"
214 (format "branch.%s.pushRemote" main-branch)
215 "fork")
216 (let ((alist (vc-git--branch-remotes)))
217 (should (assq 'upstream alist))
218 (should (equal (cdr (assq 'push alist))
219 (concat "fork/" main-branch))))
220 (vc-git--out-ok "config" "--unset"
221 (format "branch.%s.pushRemote" main-branch))
222 (vc-git--out-ok "config" "remote.pushDefault" "fork")
223 (let ((alist (vc-git--branch-remotes)))
224 (should (assq 'upstream alist))
225 (should (equal (cdr (assq 'push alist))
226 (concat "fork/" main-branch))))
227 (vc-git--out-ok "config" "remote.pushDefault" "origin")
228 (let ((alist (vc-git--branch-remotes)))
229 (should (assq 'upstream alist))
230 (should (null (assq 'push alist)))))))
231
197;;; vc-git-tests.el ends here 232;;; vc-git-tests.el ends here