git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: William Pursell <bill.pursell@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: summaries in git add --patch[PATCH 1/2]
Date: Thu, 04 Dec 2008 00:47:33 -0800	[thread overview]
Message-ID: <7vvdu0e38a.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <49377ED8.4050905@gmail.com> (William Pursell's message of "Thu, 04 Dec 2008 06:55:20 +0000")

William Pursell <bill.pursell@gmail.com> writes:

>> How well does substr() work with utf-8 and other multi-byte encodings
>> these days, I have to wonder...
>
> Hopefully, it works well.

"Hopefully" is the last word I'd like to hear from submitters.  It would
be either "I do not know" or "I studied the topic and I know the code works".

> Here's another go, with your suggestions applied.

Sorry, this came too late for tonight's round.  I have a fixed-up one
based on your previous round parked in 'pu', which I'll be replacing with
this one (or your future re-submission if there is any) later in the week.

By the way, I noticed that you are sending your patches with:

    Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Please don't.  format=flawed tends to destroy whitespaces (I fixed them up
by hand for the ones I parked in 'pu').

> +	# Add some user context, the first changed line that contains
> +	# some non-white character other than a bracket.
> +	for my $line (@{$rhunk->{TEXT}}) {
> +		if ($line =~ m/^([+-][][{}()\s]*[^][{}()\s])/) {

I would say "$line =~ /^[-+].*\w/" (i.e. match any +/- line that contains
a word letter) would be sufficient, and it would be much easier to read.

As you append the entire $line to $summary, there is no need to capture
with ().

> +# Print a one-line summary of each hunk in the array ref in
> +# the first argument, starting wih the index in the 2nd.
> +sub display_hunks {
> +	my ($hunks, $i) = @_;
> +	my $ctr = 0;
> +	$i = 0 if not $i;

I think "$i ||= 0" is more customary.

  reply	other threads:[~2008-12-04  8:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27 21:10 summaries in git add --patch William Pursell
2008-11-27 21:27 ` Jakub Narebski
2008-11-28  0:34 ` Junio C Hamano
2008-11-28  4:36   ` William Pursell
2008-11-28  6:42   ` William Pursell
2008-11-28  7:24     ` Junio C Hamano
2008-11-29  0:22       ` William Pursell
2008-12-03  2:15         ` Junio C Hamano
2008-12-03 20:38           ` summaries in git add --patch[PATCH 1/2] William Pursell
2008-12-03 23:22             ` Junio C Hamano
2008-12-04  6:55               ` William Pursell
2008-12-04  8:47                 ` Junio C Hamano [this message]
2008-12-04 10:43                   ` William Pursell
2008-12-05  2:23                     ` Junio C Hamano
2008-12-03 20:39           ` summaries in git add --patch[PATCH 2/2] William Pursell
2008-12-03 23:23             ` Junio C Hamano
2008-12-04  6:56               ` William Pursell
2008-12-04  9:00                 ` Junio C Hamano
2008-12-04 10:43                   ` William Pursell

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=7vvdu0e38a.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bill.pursell@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).