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.