Commit Diff


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