Hi, [Cc'ed Wincent correctly] On Fri, 12 Oct 2007, Dan Zwell wrote: > diff --git a/git-add--interactive.perl b/git-add--interactive.perl > index be68814..f55d787 100755 > --- a/git-add--interactive.perl > +++ b/git-add--interactive.perl > @@ -2,6 +2,18 @@ > > use strict; > > +my $use_color; > +my $color_config = qx(git config --get color.add-interactive); > +if ($color_config=~"true" || -t STDOUT && $color_config=~"auto") { > + $use_color = "true"; > + require Term::ANSIColor; > +} Good. If you do not have color enabled, it does not require that package that is only default with modern Perl. > @@ -175,7 +187,9 @@ sub list_and_choose { > if (!$opts->{LIST_FLAT}) { > print " "; > } > + print_ansi_color "bold"; > print "$opts->{HEADER}\n"; > + print_ansi_color "clear"; Here you say "clear", and ... > } > for ($i = 0; $i < @stuff; $i++) { > my $chosen = $chosen[$i] ? '*' : ' '; > @@ -205,7 +219,9 @@ sub list_and_choose { > > return if ($opts->{LIST_ONLY}); > > + print_ansi_color "bold blue"; > print $opts->{PROMPT}; > + print_ansi_color "reset"; here you say "reset". Is it because of the added colour? > @@ -338,6 +354,16 @@ sub add_untracked_cmd { > > sub parse_diff { > my ($path) = @_; > + # FIXME: the following breaks git, and I'm not sure why. When > + # the following is uncommented, git no longer asks whether we > + # want to add given hunks. > + #my @diff; > + #if ($use_color) { > + # #@diff = run_cmd_pipe(qw(git diff-files --color -p --), $path); > + #} > + #else { > + # #@diff = run_cmd_pipe(qw(git diff-files -p --), $path); > + #} > my @diff = run_cmd_pipe(qw(git diff-files -p --), $path); > my (@hunk) = { TEXT => [] }; This fails because of the next two lines: for (@diff) { if (/^@@ /) { Replace the if with "if (/^[^-+ ]*@@ /)", or something even stricter. --color adds magic sequences to make color. I cannot comment on the Perl style ;-) Ciao, Dscho - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html