commit f8a9db5613417ffb30e54495f6a83c2f8a64dfe2 from: Omar Polo date: Sun Jan 03 17:41:06 2021 UTC fix vc-got-repository-url for checkout of non-bare repos before I assumed got could checkout only from bare repos, but it turns out this isn't the case. This fixes it, making vc-got-repository-url more robust. It first try to use .git/config if it exists, if it doesn't but there is a .git directory, don't do anything; finally try to parse config (assuming this is a bare repo). commit - 3d2d3c391f98896699fc27185f56982429b08a7b commit + f8a9db5613417ffb30e54495f6a83c2f8a64dfe2 blob - 19f04bb9fea556fb4d3d1a7d126dbeb11b107ab5 blob + 8440bf5de445d95813d0ffbd4239b2158fbe0103 --- vc-got.el +++ vc-got.el @@ -651,17 +651,24 @@ Value is returned as floating point fractional number (let* ((default-directory (vc-got--repo-root)) (remote-name (or remote-name "origin")) (heading (concat "[remote \"" remote-name "\"]")) + (conf (cond ((file-exists-p ".git/config") + ".git/config") + ((file-exists-p ".git") + nil) + ((file-exists-p "config") + "config"))) found) (with-temp-buffer - (insert-file-contents "config") - (goto-char (point-min)) - (when (search-forward heading nil t) - (forward-line) - (while (and (not found) - (looking-at ".*=")) ;too broad? - (when (looking-at ".*url = \\(.*\\)") - (setq found (match-string-no-properties 1)))) - found)))) + (when conf + (insert-file-contents conf) + (goto-char (point-min)) + (when (search-forward heading nil t) + (forward-line) + (while (and (not found) + (looking-at ".*=")) ;too broad? + (when (looking-at ".*url = \\(.*\\)") + (setq found (match-string-no-properties 1)))) + found))))) (provide 'vc-got) ;;; vc-got.el ends here