From: Alexandre Julliard <julliard@winehq.org>
To: "Rémi Vanicat" <vanicat@debian.org>
Cc: git@vger.kernel.org, "Karl Hasselström" <kha@treskal.com>,
"Sergei Organov" <osv@javad.com>
Subject: Re: [PATCH 01/03] Add helper function for branch tag and commitish to git.el
Date: Sun, 17 Feb 2008 19:30:34 +0100 [thread overview]
Message-ID: <87wsp34er9.fsf@wine.dyndns.org> (raw)
In-Reply-To: <87ejbcu2gb.dlv_-_@maison.homelinux.org> ("Rémi Vanicat"'s message of "Sat, 16 Feb 2008 20:27:16 +0100")
Rémi Vanicat <vanicat@debian.org> writes:
> +(defun git-list-branches (&optional all)
> + "Return an alist of available branches
> +if all is non-nil, return all branch, otherwise only local one
> +cdr of assoc is non-nil for the current branch
> +nil otherwise"
> + (let ((branches ()))
> + (with-temp-buffer
> + (if all
> + (git-run-command-buffer (current-buffer) "branch" "-a")
> + (git-run-command-buffer (current-buffer) "branch"))
> + (goto-char (point-min))
> + (while (re-search-forward "^\\([ *]\\) \\([^\n]*\\)$" () t)
> + (push (cons (match-string 2)
> + (string= (match-string 1) "*"))
> + branches)))
> + (nreverse branches)))
git-run-command-buffer isn't really what you want to use here, look at
how other functions that use a temp-buffer do it. Also that alist thing
is ugly, there are better ways of finding the current branch if we need
it. Besides, you probably want to use git-for-each-ref instead of
git-branch, git-branch is a bit too porcelainish IMO.
--
Alexandre Julliard
julliard@winehq.org
next prev parent reply other threads:[~2008-02-17 18:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-13 15:53 [PATCH] Add function to checkout a branch in git.el =?utf-8?q?R=C3=A9mi=20Vanicat?=
2008-02-13 16:30 ` Karl Hasselström
2008-02-13 16:43 ` Karl Hasselström
2008-02-13 18:09 ` Remi Vanicat
2008-02-13 18:23 ` Sergei Organov
2008-02-13 21:04 ` Karl Hasselström
2008-02-14 11:47 ` Sergei Organov
2008-02-16 19:17 ` [patch v2] switching and creating branch, merging and rebasing with Emacs =?utf-8?q?R=C3=A9mi=20Vanicat?=
2008-02-16 19:27 ` [PATCH 01/03] Add helper function for branch tag and commitish to git.el Rémi Vanicat
2008-02-17 18:30 ` Alexandre Julliard [this message]
2008-02-16 19:30 ` [PATCH 02/03] Adding checkout function for commitish in git.el Rémi Vanicat
2008-02-17 18:27 ` Alexandre Julliard
2008-02-16 19:35 ` [PATCH 03/03] Adding command for merging " Rémi Vanicat
2008-02-13 18:29 ` [PATCH] Add function to checkout a branch " Sergei Organov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wsp34er9.fsf@wine.dyndns.org \
--to=julliard@winehq.org \
--cc=git@vger.kernel.org \
--cc=kha@treskal.com \
--cc=osv@javad.com \
--cc=vanicat@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).