Git development
 help / color / mirror / Atom feed
From: Marek Zawirski <marek.zawirski@gmail.com>
To: Charles O'Farrell <charleso@charleso.org>
Cc: git@vger.kernel.org
Subject: Re: [JGIT PATCH 2/3] Cleanup of Branch command ready for verbose mode
Date: Mon, 18 Aug 2008 15:41:55 +0200	[thread overview]
Message-ID: <48A97C23.8030103@gmail.com> (raw)
In-Reply-To: <1219057305-9284-3-git-send-email-charleso@charleso.org>

Charles O'Farrell wrote:
> diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Branch.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Branch.java
(...)
> @@ -87,17 +91,27 @@ private void list() {
>  		if (head != null) {
>  			String current = head.getName();
>  			if (current.equals(Constants.HEAD))
> -				printHead("(no branch)", true);
> -			for (String ref : new TreeSet<String>(refs.keySet())) {
> -				if (isHead(ref))
> -					printHead(ref, current.equals(ref));
> +				addRef("(no branch)", head);
> +			addRefs(refs, Constants.HEADS_PREFIX, !remote);
> +			addRefs(refs, Constants.REMOTES_PREFIX, remote);

We used to use (Constants.HEADS_PREFIX + '/') or 
(Constants.REMOTES_PREFIX + '/') in such places, probably to handle 
correctly jokes like refs named "refs/remotes_will_broke_your_code".

I've seen this expression so many times that I think it's right moment 
to create another Constants.HEADS_PREFIX_SLASHED (same for tags, 
remotes) or similar as this piece of this code is redundant in many 
places. But wait, does anybody use pure ones without slashes? Maybe we 
can just change existing constants.

Beside of that detail, me (being just jgit developer) says that the 
series looks good. Oh, and it's probably good to follow convention of 
marking variables as final when they are final.

-- 
Marek Zawirski [zawir]
marek.zawirski@gmail.com

  parent reply	other threads:[~2008-08-18 13:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-18 11:01 [JGIT PATCH 0/3] jgit: Verbase branch command Charles O'Farrell
2008-08-18 11:01 ` [JGIT PATCH 1/3] Extract RefComparator to sort collection of Refs Charles O'Farrell
2008-08-18 11:01   ` [JGIT PATCH 2/3] Cleanup of Branch command ready for verbose mode Charles O'Farrell
2008-08-18 11:01     ` [JGIT PATCH 3/3] Verbose branch command Charles O'Farrell
2008-08-18 13:41     ` Marek Zawirski [this message]
2008-08-18 14:20       ` [JGIT PATCH 2/3] Cleanup of Branch command ready for verbose mode Shawn O. Pearce

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=48A97C23.8030103@gmail.com \
    --to=marek.zawirski@gmail.com \
    --cc=charleso@charleso.org \
    --cc=git@vger.kernel.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