git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, Martin Langhoff <martin@catalyst.net.nz>,
	Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: Re: [PATCH] cvsexportcommit: be graceful when "cvs status" reorders the arguments
Date: Sun, 17 Feb 2008 19:20:17 -0800	[thread overview]
Message-ID: <7vwsp3uf0u.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vbq6fvudp.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Sun, 17 Feb 2008 19:03:14 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> Side note.  I personally do not like naming hashes and arrays
> plural, and call a hash of paths and list of files %path and
> @file respectively.  That convention makes it easier to read
> things like these:
>
> 	$file[4] ;# fourth file, not $files[4]
> 	$path{'hello.c'} ;# path for 'hello.c', not $paths{'hello.c'}
> ...
> +    while (@canstatusfiles) {
> +	    my %basename = ();
> +	    my @status = ();
> +	    my @leftover = ();
> +	    for (my $i = 0; $i < @canstatusfiles; $i++) {
> +		    my $name = $canstatusfiles[$i];
> +		    my $basename = basename($name);

Side note to the side note.

A related naming guideline I failed to follow (because I was
mostly copying your code) suggests that the hash here should be
named %fullname, instead of %basename.  Then logically:

	$fullname{'hello.c'} = 'a/b/hello.c';

that is, you consult %fullname hash using the basename as the
key to extract the corresponding fullname.  The naming guideline
is "Name the dictionary after its values, not after its keys."

  reply	other threads:[~2008-02-18  3:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18  1:31 [PATCH] cvsexportcommit: be graceful when "cvs status" reorders the arguments Johannes Schindelin
2008-02-18  3:03 ` Junio C Hamano
2008-02-18  3:20   ` Junio C Hamano [this message]
2008-02-18 15:25     ` Martin Langhoff
2008-02-18 16:27       ` Johannes Schindelin
2008-02-18 16:33         ` Martin Langhoff
2008-02-18 17:43           ` Johannes Schindelin
2008-02-18 17:55           ` [PATCH v2] " Johannes Schindelin
2008-02-18 17:54   ` [PATCH] " Johannes Schindelin
2008-02-18 18:36     ` Junio C Hamano
2008-02-18 18:50       ` Johannes Schindelin
2008-02-18 18:55       ` Martin Langhoff
2008-02-18 19:42         ` Johannes Schindelin
2008-02-18 20:06           ` Martin Langhoff
2008-02-18 20:29             ` Johannes Schindelin

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=7vwsp3uf0u.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=martin@catalyst.net.nz \
    --cc=robin.rosenberg@dewire.com \
    /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).