All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Florian Köberle" <FloriansKarten@web.de>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>,
	Marek Zawirski <marek.zawirski@gmail.com>
Subject: Re: [PATCH 1/2] Create a fnmatch-style pattern TreeFilter
Date: Mon, 23 Jun 2008 19:32:50 +0200	[thread overview]
Message-ID: <485FDE42.1060106@web.de> (raw)
In-Reply-To: <1214177145-18963-1-git-send-email-robin.rosenberg@dewire.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Robin,

thank you for accepting my first patch :D.

| +/**
| + * This class implements a TreeeFilter that uses the wildcard style
pattern
| + * matching like of Posix fnmatch function.
| + */
Typo: One 'e' to much in TreeeFilter.

It would be more efficient to
| +	@Override
| +	public TreeFilter clone() {
| +		return new WildCardTreeFilter(pattern);
| +	}

One way to create a clone of the FileNameMatcher is to call:
originalMatcher.reset()
FileNameMatcher clone = originalMatcher.createMatcherForSuffix()

I will send a patch which implements a copy constructor for FileNameMatcher.

First I wanted to implement a clone() method, but found this page and
decided then to implement a copy constructor:
http://www.javapractices.com/topic/TopicAction.do?Id=71

A Implementor of a super class could imply that clone() of object gets
called, as stated in the javadoc of clone():

quote (javadoc ob Object#clone()):
- -----------
By convention, the returned object should be obtained by calling super.clone
- -----------

I think this is a bad convention, as one should not rely on
Object#clone() to do the copy job for one. If you really need a clone
method then I would do it the same way you did, by calling a constructor
which does the job.

Best regards,
Florian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIX94k59ca4mzhfxMRAgDjAJ9S76L8I5Lqed4lKfgTf+2cp2IQ9gCfQNVh
z72+NGvmIy3H0gwveKRfn+w=
=wnpy
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2008-06-23 17:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-22 23:25 [PATCH 1/2] Create a fnmatch-style pattern TreeFilter Robin Rosenberg
2008-06-22 23:25 ` [PATCH 2/2] LsTree: Enable pattern matching in LsTree Robin Rosenberg
2008-06-23  0:27 ` [PATCH 1/2] Create a fnmatch-style pattern TreeFilter Shawn O. Pearce
2008-06-23 17:32 ` Florian Köberle [this message]
2008-06-23 17:43   ` [[JGIT PATCH]] Implementation of a copy constructor for FileNameMatcher Florian Köberle

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=485FDE42.1060106@web.de \
    --to=florianskarten@web.de \
    --cc=git@vger.kernel.org \
    --cc=marek.zawirski@gmail.com \
    --cc=robin.rosenberg@dewire.com \
    --cc=spearce@spearce.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.