Re: [PATCH 3/3] Added diff hunk coloring to git-add--interactive
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 11, 2007, 10:00 UTC
- Message-ID
- <7vlk95f6fb.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20071110180344.05a81497@paradox.zwell.net>
Dan Zwell <dzwell@zwell.net> writes:
Show 9 quoted lines
> +sub colored_diff_hunk {
> + my ($text) = @_;
> + # return the text, so that it can be passed to print()
> + my @ret;
> + for (@$text) {
> + if (!$diff_use_color) {
> + push @ret, $_;
> + next;
> + }It would be better to do the "if (!$diff_use_color)" part upfront before entering the loop, wouldn't it?
sub colored_diff_hunk {
my ($text) = @_;
if (!$diff_use_color) {
return @$text;
} my @ret;
for (@$text) {
...
}
}