I'm interested in contributing to Magit, and I'd like to know if
there's a preferred way of submitting patches, coordinating what
should be worked on, etc.
So far I've been exploring Magit and noticing things that seem a bit
"off" that I might want to change, but I don't necessarily want to
just write code and throw Pull Requests at the GitHub repo without
consulting anybody.
Example: I noticed that if I have magit-repo-dirs set, magit-status
doesn't know what to do if I interactively give it the path of a
directory instead of a named repository. I came up with a patch to
let it understand a directory as input, but I don't like changing an
interface without understanding the context of the original design
decision. (Magit-status lets you enter a directory if you hit C-u
twice before you call it. Why twice? I don't know. I see the code
that requires more than one prefix arg, but I don't know why it was
written that way.)
Anyway, the patch is below, or at "git://github.com/pjweisberg/magit
name-or-path". I'd rather have somebody review it before asking for
it to be included.
-PJ
======================================================================
Changes at upstream/master
Modified magit.el
diff --git a/magit.el b/magit.el
index dfb56ff..2858ab6 100644
--- a/magit.el
+++ b/magit.el
@@ -792,10 +792,12 @@ Otherwise, return nil."
(defun magit-read-top-dir (rawp)
(if (and (not rawp) magit-repo-dirs)
(let* ((repos (magit-list-repos magit-repo-dirs))
- (reply (magit-completing-read "Git repository: "
- (magit-list-repos
magit-repo-dirs))))
- (file-name-as-directory
- (cdr (assoc reply repos))))
+ (reply (magit-completing-read "Git repository: " repos)))
+ (file-name-as-directory
+ (or (cdr (assoc reply repos))
+ (if (file-directory-p reply)
+ (expand-file-name reply)
+ (error "Not a repository or a directory: %s" reply)))))
(file-name-as-directory
(read-directory-name "Git repository: "
(or (magit-get-top-dir default-directory)