git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH EGIT 1/2] Implement "jgit rev-parse"

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 1, 2009, 15:14 UTC
Message-ID
<20090501151454.GC23604@spearce.org>
In-Reply-To
<1241174172-19581-1-git-send-email-git@sdiz.net>
"Daniel Cheng (aka SDiZ)" <j16sdiz+freenet@gmail.com> wrote:
>  .../src/org/spearce/jgit/pgm/RevParse.java         |   70 ++++++++++++++++++++

Thanks. I have two remarks, I'm amending them in as they are trivial for me to fix.

> +class RevParse extends TextBuiltin {
> +	RevWalk walk;
Unused field.  Deleted.
Show 15 quoted lines
> +	@Option(name = "--all")
> +	boolean all = false;
> +
> +	@Argument(index = 0, metaVar = "commit-ish")
> +	private final List<ObjectId> commits = new ArrayList<ObjectId>();
> +
> +	@Override
> +	protected void run() throws Exception {
> +		if (all) {
> +			Map<String, Ref> allRefs = db.getAllRefs();
> +			for (final Ref r : allRefs.values())
> +				System.out.println(r.getObjectId().name());
> +		} else {
> +			for (final ObjectId o : commits)
> +				System.out.println(o.name());

These should use the PrintWriter called "out" inherited from the TextBuiltin class, not System.out. Fixed.

-- 
Shawn.
Previous: Daniel Cheng (aka SDiZ)
Message 3 of 3 in “Implement "jgit rev-parse"”
  1. 1/2 Implement "jgit rev-parse"Daniel Cheng (aka SDiZ), May 1, 2009
  2. 2/2 Enable "jgit show-ref"Daniel Cheng (aka SDiZ), May 1, 2009
  3. Shawn O. PearceMay 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.