Re: [PATCH] git.el: Only show completions from refs/heads, refs/remotes and refs/tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexandre Julliard <julliard@xxxxxxxxxx> writes:

> David Kågedal <davidk@xxxxxxxxxxxxxx> writes:
>
>> Sorry, I didn't check this properly. I thought I was fixing inside the
>> git-checkout function, but this is git-read-commit-name which is used
>> in more than one place.
>>
>> But for git-checkout, I would like to see a much shorter list of named
>> commits, namely those that can be called "branches". I'll come up with
>> a better patch.
>
> I think it's reasonable to do this for the other uses of
> git-read-commit-name too, so your original patch looks OK.

Actually, I'd like to go one step further. I'm only interested in
branches, and only in branches I can commit to. So only asking for
refs/heads seems the best solution.

And the default parameter to git-read-commit-name is never used, so I
removed it.

And completing-read works fine with an alist, so the mapcar isn't
nedded any more.

Here is an updated patch:

From: David Kågedal <davidk@xxxxxxxxxxxxxx>
Subject: [PATCH] git.el: Only show completions from refs/heads

Signed-off-by: David Kågedal <davidk@xxxxxxxxxxxxxx>
---
 contrib/emacs/git.el |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index feb229c..d4f8710 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -1385,11 +1385,9 @@ With a prefix arg, diff the marked files instead."
         (push (match-string 1) files)))
     files))
 
-(defun git-read-commit-name (prompt &optional default)
+(defun git-read-commit-name (prompt)
   "Ask for a commit name, with completion for local branch, remote branch and tag."
-  (completing-read prompt
-                   (list* "HEAD" "ORIG_HEAD" "FETCH_HEAD" (mapcar #'car (git-for-each-ref)))
-		   nil nil nil nil default))
+  (completing-read prompt (git-for-each-ref "refs/heads")))
 
 (defun git-checkout (branch &optional merge)
   "Checkout a branch, tag, or any commit.
-- 
1.6.2.rc1.21.gda6d



-- 
David Kågedal
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux