* Re: [PATCH] Add some fancy colors in the test library when terminal supports it.
From: Christian Couder @ 2007-10-23 4:08 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: Shawn O. Pearce, git
In-Reply-To: <20071022081341.GC32763@artemis.corp>
Hi Pierre,
Le lundi 22 octobre 2007, Pierre Habouzit a écrit :
> +
> +say_color () {
> + [ "$nocolor" = 0 ] && [ "$1" != '-1' ] && tput setaf "$1"
> + shift
> + echo "* $*"
> + tput op
> +}
> +
> error () {
> - echo "* error: $*"
> + say_color 9 "* error: $*"
This will print something like "* * error: ..." instead of "* error: ..."
The following should work:
> + say_color 9 "error: $*"
By the way, where do the 9 here and the 10 and the -1 below come from ?
"man 5 terminfo" says that only values form 0 to 7 are portably defined.
Maybe 9 is a bold red and 10 a bold green, or something like that, but it
doesn't seem to work on my konsole.
Anyway, perhaps having:
_red=1
_green=2
and then using "say_color $_red stuff" might be easier to understand and
change if needed.
Thanks for this good idea,
Christian.
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Theodore Tso @ 2007-10-23 2:00 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, Shawn O. Pearce, git
In-Reply-To: <7vtzoi8voo.fsf@gitster.siamese.dyndns.org>
On Mon, Oct 22, 2007 at 06:29:59PM -0700, Junio C Hamano wrote:
> Well, the policy is never to commit directly on top of next
> (iow, only merge other topics and nothing else). Otherwise it
> becomes hard to allow individual topics graduate to 'master'
> independently.
I see. So if it's non-trivial enough that you want it to "cook" in
next for a cycle, you'll create a topic branch for it (based off of
'master'), and then force a merge into 'next'?
- Ted
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Jeff King @ 2007-10-23 3:48 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Shawn O. Pearce, git
In-Reply-To: <alpine.LFD.0.999.0710221930330.30120@woody.linux-foundation.org>
On Mon, Oct 22, 2007 at 07:32:02PM -0700, Linus Torvalds wrote:
> Your patch is better than what used to be there, but
>
> > - /* Already picked as a destination? */
> > + /* Already picked as a source? */
> > if (!p->src_dst)
> > continue;
>
> the above is wrong, the whole thing should be dropped (we *want* to be
> able to re-use sources).
Oops, you're right. I'm not sure what I was thinking.
> Anyway, the set of fixes I sent out earlier included fixing that stupid
> loop as one of the things.
Looks like you have made some real progress. I'll try to review your
patch tonight, and hopefully make some progress on the inexact case.
-Peff
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Shawn O. Pearce @ 2007-10-23 3:34 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy7du8vv7.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> Thanks for keeping the git list running smoothly while I was away.
Funny thing. There's this tool called "git" that makes it really
easy to fork a project, apply patches straight from email, and
republish it for others to read and work on top of. You should
check it out sometime. :-)
> I've pulled the four integration branches from you, and split
> out the topic branches out of next and pu so that I can take a
> look at them individually. I haven't looked at the actual
> changes yet (but I do not have to, as long as I can trust
> capable others), and only skimmed the list messages (about 2200
> of them since I left).
>
> git.git at k.org and alt-git.git at repo.or.cz should be in sync
> with you now. I'll take a look at the recent changes after
> grabbing some sleep ;-)
We're glad to have you back. Or should I say _I'm_ glad to have
you back. Never underestimate a man until you've at least walked
a week in his shoes. :-)
Most of the patches that happened while you were away were merged
or parked into my git/spearce.git work (in large part thanks
to Lars Hjemli's work during the first week you were offline).
So hopefully you can just pickup from "recent history" (e.g. today
forward) and if we missed anything really interesting authors can
repost once you've had a chance to get caught up.
--
Shawn.
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Linus Torvalds @ 2007-10-23 2:32 UTC (permalink / raw)
To: Jeff King; +Cc: Shawn O. Pearce, git
In-Reply-To: <20071022071644.GA7290@coredump.intra.peff.net>
Sorry, I missed this while being busy hacking and not reading email ;)
On Mon, 22 Oct 2007, Jeff King wrote:
>
> Patch is below (please just squash with the one from Linus).
Your patch is better than what used to be there, but
> - /* Already picked as a destination? */
> + /* Already picked as a source? */
> if (!p->src_dst)
> continue;
the above is wrong, the whole thing should be dropped (we *want* to be
able to re-use sources).
Anyway, the set of fixes I sent out earlier included fixing that stupid
loop as one of the things.
Linus
^ permalink raw reply
* [PATCH] Let git-add--interactive read "git colors" from git-config
From: Dan Zwell @ 2007-10-23 2:19 UTC (permalink / raw)
To: Dan Zwell
Cc: Shawn O. Pearce, Jeff King, Wincent Colaiuta, Git Mailing List,
Jonathan del Strother, Johannes Schindelin, Frank Lichtenheld
In-Reply-To: <20071022163244.4af72973@danzwell.com>
Colors are specified in color.interactive.{prompt,header,help}.
They are specified as git color strings as described in the
documentation, then parsed into perl color strings (slightly
different). Ugly but visible defaults are still used.
Signed-off-by: Dan Zwell <dzwell@zwell.net>
---
This patch is againts Shawn Pearce's "pu" branch.
Documentation/config.txt | 17 ++-------
git-add--interactive.perl | 78 +++++++++++++++++++++++++++++++++++++++++---
2 files changed, 76 insertions(+), 19 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 99b3817..d06f55f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -390,19 +390,10 @@ color.interactive::
color.interactive.<slot>::
Use customized color for `git add --interactive`
- output. `<slot>` may be `prompt`, `header`, or `help`,
- for three distinct types of common output from interactive
- programs. The values may be a space-delimited combination
- of up to three of the following:
-+
-(optional attribute, optional foreground color, and optional background)
-+
-dark, bold, underline, underscore, blink, reverse, concealed,
-black, red, green, yellow, blue, magenta, cyan, white, on_black,
-on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white
-+
-Note these are not the same colors/attributes that the rest of
-git supports, but are specific to `git-add --interactive`.
+ output. `<slot>` may be `prompt`, `header`, or `help`, for
+ three distinct types of normal output from interactive
+ programs. The values of these variables may be specified as
+ in color.branch.<slot>.
color.pager::
A boolean to enable/disable colored output when the pager is in
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 37be4b0..ca1ca28 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -6,12 +6,78 @@ my ($use_color, $prompt_color, $header_color, $help_color);
my $color_config = qx(git config --get color.interactive);
if ($color_config=~/true|always/ || -t STDOUT && $color_config=~/auto/) {
$use_color = "true";
- chomp( $prompt_color = qx(git config --get color.interactive.prompt) );
- chomp( $header_color = qx(git config --get color.interactive.header) );
- chomp( $help_color = qx(git config --get color.interactive.help) );
- $prompt_color ||= "red bold";
- $header_color ||= "bold";
- $help_color ||= "blue bold";
+ # Grab the 3 main colors in git color string format:
+ my @git_prompt_color =
+ split(/\s+/, qx(git config --get color.interactive.prompt));
+ my @git_header_color =
+ split(/\s+/, qx(git config --get color.interactive.header));
+ my @git_help_color =
+ split(/\s+/, qx(git config --get color.interactive.help));
+
+ # Sane (visible) defaults:
+ if (! @git_prompt_color) {
+ @git_prompt_color = ("blue", "bold");
+ }
+ if (! @git_header_color) {
+ @git_header_color = ("bold");
+ }
+ if (! @git_help_color) {
+ @git_help_color = ("red", "bold");
+ }
+
+ # Parse the git colors into perl colors:
+ my %attrib_mappings = (
+ "bold" => "bold",
+ "ul" => "underline",
+ "blink" => "blink",
+ # not supported:
+ #"dim" => "",
+ "reverse" => "reverse"
+ );
+
+ my @tmp_perl_colors;
+ my $color_list;
+ # Loop over the array of (arrays of) git-style colors
+ foreach $color_list ([@git_prompt_color], [@git_header_color],
+ [@git_help_color]) {
+ my $fg_done;
+ my @perl_attribs;
+ my $word;
+ foreach $word (@{$color_list}) {
+ if ($word =~ /normal/) {
+ $fg_done = "true";
+ }
+ elsif ($word =~ /black|red|green|yellow/ ||
+ $word =~ /blue|magenta|cyan|white/) {
+ # is a color.
+ if ($fg_done) {
+ # this is the background
+ push @perl_attribs, "on_" . $word;
+ }
+ else {
+ # this is foreground
+ $fg_done = "true";
+ push @perl_attribs, $word;
+ }
+ }
+ else {
+ # this is an attribute, not a color.
+ if ($attrib_mappings{$word}) {
+ push(@perl_attribs,
+ $attrib_mappings{$word});
+ }
+ }
+ }
+ if (@perl_attribs) {
+ push @tmp_perl_colors, join(" ", @perl_attribs);
+ }
+ else {
+ #@perl_attribs is empty, need a placeholder
+ push @tmp_perl_colors, "reset";
+ }
+ }
+ ($prompt_color, $header_color, $help_color) =
+ @tmp_perl_colors;
require Term::ANSIColor;
}
--
1.5.3.4.207.gc0ee
^ permalink raw reply related
* Re: [PATCH] resend of git-add--interactive color patch against spearce/pu
From: Dan Zwell @ 2007-10-23 2:11 UTC (permalink / raw)
To: Dan Zwell
Cc: Shawn O. Pearce, Jeff King, Wincent Colaiuta, Git Mailing List,
Jonathan del Strother, Johannes Schindelin, Frank Lichtenheld
In-Reply-To: <20071022163244.4af72973@danzwell.com>
I apparently missed the e-mail where Shawn Pearce explained where his
repository was. The following patch is my recent change(s), rebased
against that.
Dan
^ permalink raw reply
* [PATCH 1/2] gitweb: Refactor abbreviation-with-title-attribute code.
From: David Symonds @ 2007-10-23 1:31 UTC (permalink / raw)
To: pasky, spearce; +Cc: git, David Symonds
Signed-off-by: David Symonds <dsymonds@gmail.com>
---
gitweb/gitweb.perl | 45 +++++++++++++++++++++------------------------
1 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ea84c75..a835bd1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -842,6 +842,23 @@ sub chop_str {
return "$body$tail";
}
+# takes the same arguments as chop_str, but also wraps a <span> around the
+# result with a title attribute if it does get chopped. Additionally, the
+# string is HTML-escaped.
+sub chop_and_escape_str {
+ my $str = shift;
+ my $len = shift;
+ my $add_len = shift || 10;
+
+ my $chopped = chop_str($str, $len, $add_len);
+ if ($chopped eq $str) {
+ return esc_html($chopped);
+ } else {
+ return qq{<span title="} . esc_html($str) . qq{">} .
+ esc_html($chopped) . qq{</span>};
+ }
+}
+
## ----------------------------------------------------------------------
## functions returning short strings
@@ -3427,12 +3444,7 @@ sub git_shortlog_body {
print "<tr class=\"light\">\n";
}
$alternate ^= 1;
- my $author = chop_str($co{'author_name'}, 10);
- if ($author ne $co{'author_name'}) {
- $author = "<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
- } else {
- $author = esc_html($author);
- }
+ my $author = chop_and_escape_str($co{'author_name'}, 10);
# git_summary() used print "<td><i>$co{'age_string'}</i></td>\n" .
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
"<td><i>" . $author . "</i></td>\n" .
@@ -3484,12 +3496,7 @@ sub git_history_body {
}
$alternate ^= 1;
# shortlog uses chop_str($co{'author_name'}, 10)
- my $author = chop_str($co{'author_name'}, 15, 3);
- if ($author ne $co{'author_name'}) {
- "<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
- } else {
- $author = esc_html($author);
- }
+ my $author = chop_and_escape_str($co{'author_name'}, 15, 3);
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
"<td><i>" . $author . "</i></td>\n" .
"<td>";
@@ -3645,12 +3652,7 @@ sub git_search_grep_body {
print "<tr class=\"light\">\n";
}
$alternate ^= 1;
- my $author = chop_str($co{'author_name'}, 15, 5);
- if ($author ne $co{'author_name'}) {
- $author = "<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
- } else {
- $author = esc_html($author);
- }
+ my $author = chop_and_escape_str($co{'author_name'}, 15, 5);
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
"<td><i>" . $author . "</i></td>\n" .
"<td>" .
@@ -5165,12 +5167,7 @@ sub git_search {
print "<tr class=\"light\">\n";
}
$alternate ^= 1;
- my $author = chop_str($co{'author_name'}, 15, 5);
- if ($author ne $co{'author_name'}) {
- $author = "<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
- } else {
- $author = esc_html($author);
- }
+ my $author = chop_and_escape_str($co{'author_name'}, 15, 5);
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
"<td><i>" . $author . "</i></td>\n" .
"<td>" .
--
1.5.3.1
^ permalink raw reply related
* [PATCH 2/2] gitweb: Use chop_and_escape_str in more places.
From: David Symonds @ 2007-10-23 1:31 UTC (permalink / raw)
To: pasky, spearce; +Cc: git, David Symonds
In-Reply-To: <1193103083390-git-send-email-dsymonds@gmail.com>
Signed-off-by: David Symonds <dsymonds@gmail.com>
---
gitweb/gitweb.perl | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a835bd1..1b6c823 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3402,7 +3402,7 @@ sub git_project_list_body {
"<td>" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary"),
-class => "list", -title => $pr->{'descr_long'}},
esc_html($pr->{'descr'})) . "</td>\n" .
- "<td><i>" . esc_html(chop_str($pr->{'owner'}, 15)) . "</i></td>\n";
+ "<td><i>" . chop_and_escape_str($pr->{'owner'}, 15) . "</i></td>\n";
print "<td class=\"". age_class($pr->{'age'}) . "\">" .
(defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n" .
"<td class=\"link\">" .
@@ -3657,7 +3657,7 @@ sub git_search_grep_body {
"<td><i>" . $author . "</i></td>\n" .
"<td>" .
$cgi->a({-href => href(action=>"commit", hash=>$co{'id'}), -class => "list subject"},
- esc_html(chop_str($co{'title'}, 50)) . "<br/>");
+ chop_and_escape_str($co{'title'}, 50) . "<br/>");
my $comment = $co{'comment'};
foreach my $line (@$comment) {
if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
@@ -5173,7 +5173,7 @@ sub git_search {
"<td>" .
$cgi->a({-href => href(action=>"commit", hash=>$co{'id'}),
-class => "list subject"},
- esc_html(chop_str($co{'title'}, 50)) . "<br/>");
+ chop_and_escape_str($co{'title'}, 50) . "<br/>");
while (my $setref = shift @files) {
my %set = %$setref;
print $cgi->a({-href => href(action=>"blob", hash_base=>$co{'id'},
--
1.5.3.1
^ permalink raw reply related
* Re: What's cooking in git/spearce.git (topics)
From: Junio C Hamano @ 2007-10-23 1:29 UTC (permalink / raw)
To: Theodore Tso; +Cc: Johannes Schindelin, Shawn O. Pearce, git
In-Reply-To: <20071023012140.GC22997@thunk.org>
Theodore Tso <tytso@mit.edu> writes:
> I assume PU is what you used to build your proposed-update branch?
> I'm actually trying to use it, and it is useful, although it hasn't
> been working for me completely perfectly. I've still been trying to
> figure out if the reason why it hasn't been working quite right is due
> to my not understanding how to use it correctly, or whether you don't
> use it these days.
Ah, these days I almost always do:
git checkout pu
git reset --hard next
and then merge the topics that haven't been merged anywhere by
hand, using output from
Meta/git-topic.perl
as the guide.
> One question which I have had about the WC script is that if I
> manually add a commit to the next branch, it ends up showing up in all
> of the topic branches as a commit that was part of that topic branch
> which is in next...
Well, the policy is never to commit directly on top of next
(iow, only merge other topics and nothing else). Otherwise it
becomes hard to allow individual topics graduate to 'master'
independently.
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Junio C Hamano @ 2007-10-23 1:26 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20071022063222.GS14735@spearce.org>
Thanks for keeping the git list running smoothly while I was away.
I've pulled the four integration branches from you, and split
out the topic branches out of next and pu so that I can take a
look at them individually. I haven't looked at the actual
changes yet (but I do not have to, as long as I can trust
capable others), and only skimmed the list messages (about 2200
of them since I left).
git.git at k.org and alt-git.git at repo.or.cz should be in sync
with you now. I'll take a look at the recent changes after
grabbing some sleep ;-)
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Theodore Tso @ 2007-10-23 1:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, Shawn O. Pearce, git
In-Reply-To: <7v3aw2aaxu.fsf@gitster.siamese.dyndns.org>
On Mon, Oct 22, 2007 at 06:15:09PM -0700, Junio C Hamano wrote:
> >
> > I've recently started trying to use some of the scripts in "todo" to
> > send similar "What's cooking" messages, and started wondering if they
> > were what Junio actually used in production to send his notes. For
> > example, the scripts don't work particularly well if the refs have
> > been packed. So I had to make changes such as these so they would
> > work for me.
>
> Sorry, WI is for "what's in", WC is for "what's cooking". I
> should remove PU and RB from there.
>
I assume PU is what you used to build your proposed-update branch?
I'm actually trying to use it, and it is useful, although it hasn't
been working for me completely perfectly. I've still been trying to
figure out if the reason why it hasn't been working quite right is due
to my not understanding how to use it correctly, or whether you don't
use it these days.
One question which I have had about the WC script is that if I
manually add a commit to the next branch, it ends up showing up in all
of the topic branches as a commit that was part of that topic branch
which is in next. So I can manually edit the output of WC to remove
the spurious commit, or I could make it be a rule that all new commits
either must go against the master branch, or be put in a topic branch
based off of master, and then merged into next. Or maybe I'm not
understanding how to make the WC and git-topic.perl script work and
sing for me perfectly?
- Ted
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Junio C Hamano @ 2007-10-23 1:15 UTC (permalink / raw)
To: Theodore Tso; +Cc: Johannes Schindelin, Shawn O. Pearce, git
In-Reply-To: <20071016195744.GB32132@closure.lan>
Theodore Tso <tytso@mit.edu> writes:
> On Tue, Oct 16, 2007 at 12:16:28PM +0100, Johannes Schindelin wrote:
>>
>> first let me thank you for being the interim maintainer. I know it is
>> much work, and I frankly do not have the time, or nerve, to do it. Out of
>> curiousity: did you use the scripts in "todo" to send these emails?
>
> I've recently started trying to use some of the scripts in "todo" to
> send similar "What's cooking" messages, and started wondering if they
> were what Junio actually used in production to send his notes. For
> example, the scripts don't work particularly well if the refs have
> been packed. So I had to make changes such as these so they would
> work for me.
Sorry, WI is for "what's in", WC is for "what's cooking". I
should remove PU and RB from there.
^ permalink raw reply
* Re: Linear time/space rename logic for *inexact* case
From: Linus Torvalds @ 2007-10-23 0:49 UTC (permalink / raw)
To: Andy C; +Cc: Jeff King, git
In-Reply-To: <596909b30710221647y6a7481c5me41c31bbe1015e3a@mail.gmail.com>
On Mon, 22 Oct 2007, Andy C wrote:
>
> from diffcore-delta.c:
> "
> * Idea here is very simple.
> *
> * Almost all data we are interested in are text, but sometimes we have
> * to deal with binary data. So we cut them into chunks delimited by
> * LF byte, or 64-byte sequence, whichever comes first, and hash them.
> "
>
> What is the similarity metric for binary files? Is it related to the
> number of 64 byte chunks they have in common? How do you know that
> the 64 byte chunks match up? Suppose I have 10k file, and then I
> insert 10 random bytes at positions, 1000, 2000, 3000, etc. How does
> that work?
The 'LF' byte will start a new window, so even with binary files (assuming
some random-enough distribution that you have *some* 'LF' bytes!), you
basically get a synchronization event on each LF.
So the 64-byte hunks "line up" automatically, even for binary files. Maybe
not immediately, but soon enough (ie on average, assuming some reasonably
compressed - ie virtually random - binary format) you should find a LF
roughly every fourth hunk.
There are probably smarter ways to guarantee it even in the absense of
certain bit-patterns, but I bet the "break every 64 bytes or when you see
a LF" thing works well for any reasonable binary file too.
But text files are obviously the most important case. Diffs on binaries
are somewhat hit-and-miss regardless.
Linus
^ permalink raw reply
* Re: gitk patch collection pull request
From: Paul Mackerras @ 2007-10-23 0:20 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Shawn O. Pearce, git
In-Reply-To: <alpine.LFD.0.999.0710192149020.3794@woody.linux-foundation.org>
Linus Torvalds writes:
> On Sat, 20 Oct 2007, Paul Mackerras wrote:
> >
> > Do you mean that when you have a file limit, the diff window should
> > just show the diffs for those files, not any other files the commit
> > might have modified?
>
> Yes. The same way "git log -p" works by default.
>
> With perhaps a checkbox to toggle the "--full-diff" behaviour.
OK, done. The checkbox is in the Edit/Preferences window. It's
called "Limit diffs to listed paths" and it's on by default.
> > That would be easy enough to implement in gitk.
>
> Well, the "--merged" case is slightly trickier, since git will figure out
> the pathnames on its own (it limits pathnames to the intersection of the
> names you give one the command line *and* the list of unmerged files, ie
> the "filter" becomes "git ls-files -u [pathspec]".
If you use the --merge flag, gitk will do a git ls-files -u at
startup, and use the result as the list of paths (after intersecting
it with the paths on the command line, if you specify paths there).
I pondered whether I needed to re-do the git ls-files -u when you
update the view with File->Update. I decided not to for now, but it
would be possible to add it.
> But goodie. I look forward to it ;)
I just pushed it out to my gitk.git repo (master branch). Enjoy. :)
Paul.
^ permalink raw reply
* Re: [PATCH] Dissociating a repository from its alternates
From: Johannes Schindelin @ 2007-10-23 0:13 UTC (permalink / raw)
To: Michael Hendricks; +Cc: git
In-Reply-To: <20071022233050.GA18430@ginosko.ndrix.org>
Hi,
On Mon, 22 Oct 2007, Michael Hendricks wrote:
> On Mon, Oct 22, 2007 at 08:05:58PM +0100, Johannes Schindelin wrote:
> > On Mon, 22 Oct 2007, Michael Hendricks wrote:
> > > Was such a script ever incorporated into Git?
> >
> > Not that I know of, but "git repack -a && rm
> > .git/objects/info/alternates" should do what you want. You can even
> > make a script of it, add some documentation and a test case, and earn
> > git fame by posting a patch ;-)
>
> With 1.5.3.4, it doesn't appear to work:
>
> $ git clone -s git git2
> Initialized empty Git repository in /Users/michael/src/git2/.git/
>
> $ cd git2
>
> $ git repack -a && rm .git/objects/info/alternates
> Generating pack...
> Done counting 0 objects.
> Nothing new to pack.
>
> $ git status
> # On branch master
> fatal: bad object HEAD
Indeed. Seems that somewhere along the line, repack learnt to imply "-l"
by "-a" or something. Try this instead of "git repack -a":
git rev-parse --all |
git pack-objects --revs .git/objects/pack/pack
(And make sure you read the relevant parts of the documentation to
understand what you're doing ;-)
Hth,
Dscho
^ permalink raw reply
* Re: [PATCH] Add color to git-add--interactive diffs (Total different idea to solve the problem)
From: Johannes Schindelin @ 2007-10-22 23:55 UTC (permalink / raw)
To: Peter Baumann
Cc: Tom Tobin, Dan Zwell, Jonathan del Strother, Shawn O. Pearce,
Git Mailing List
In-Reply-To: <20071022204719.GA23348@xp.machine.xx>
Hi,
On Mon, 22 Oct 2007, Peter Baumann wrote:
> Wouldn't it make more sense to implement the diff coloring inside git
> apply so that you could use something like
>
> diff file1 file2|git apply --color
>
> to make the generated diff with colors [1]? It already implements the
> same semantic for generating a diffstat, using
>
> diff file1 file2|git apply --stat
No. In both cases, "git diff" realises that the output is no terminal,
and switches off color generation. (Just try with diff.color=true instead
of =auto.)
Ciao,
Dscho
^ permalink raw reply
* Re: Linear time/space rename logic for *inexact* case
From: Andy C @ 2007-10-22 23:47 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20071022103439.GA16648@coredump.intra.peff.net>
On 10/22/07, Jeff King <peff@peff.net> wrote:
> On Mon, Oct 22, 2007 at 02:40:08AM -0700, Andy C wrote:
> > You can also prune entries which have a long "postings list" (using
> > the term in the IR sense here:
> > http://www.xapian.org/docs/intro_ir.html). This has the nice side
> > effect of getting rid of quadratic behavior, *and* making the
> > algorithm more accurate because it stops considering common lines like
> > "#endif" as contributing to similarity.
>
> Ah, very clever. I think that should have nice behavior most of the
> time, though I wonder about a pathological case where we have many
> files, all very similar to each other, and then have a commit where they
> all start to diverge, but just by a small amount, while getting moved.
> We would end up with an artificially low score between renamed files
> (because we've thrown out all of the commonality) which may lead us to
> believe there was no rename at all.
>
> But it might be worth ignoring that case.
Well I do adjust the file sizes when pruning. In the .py demo code
you can see it at these lines:
for f in filelist:
sizes[f] -= 1
The similarity metric depends on the sizes, so that way it won't get
out of whack if there are a lot of frequently occurring lines.
I did mention that pathological case to Linus. The worst thing is if
you have N adds and N deletes and every single file is identical.
Well the convenient thing is that the pruning handles this gracefully.
*Every* line in both indices will be pruned, and then the similarity
matrix will be completely empty, and no renames will be recorded.
Arguably that is what you want. You don't want N^2 renames. I guess
you could just assign them randomly to each other too for N renames.
> > http://marc.info/?l=git&m=118975452330644&w=2
> > "Of course, 2 minutes for a git-status is still way too slow, so there we
> > might still need a limiter. It also looks like 57% of my time is spent
> > in spanhash_find, and another 29% in diffcore_count_changes."
> >
> > I know there have been a couple fixes since you posted that, but if it
> > was the O(m*n) behavior that was causing your problem, it should still
> > be reproducible. Linus suggested that this is a good data set to try
> > things out with. Is there there a repository I can clone with git
> > commands to run to repro this?
>
> Yes, I still have the problem (the 2 minutes was _after_ we did fixes,
> down from 20 minutes; the latest patch from Linus just covers the "exact
> match" case where two files have identical SHA1s).
>
> It's a 1.2G repo at the end of a slow DSL line, so rather than cloning
> it, here's a way to reproduce a repo with similar properties:
Ah OK thanks. This is a good test case for binary files, and my
Linux 2.4 vs Linux 2.6 test seems reasonable for text files.
> > 3) Compute the similarity metric, which I've defined here as
> > max(c/|left file|, c/|right file|), where c the entry in the matrix
> > for the file pair. Note that the files are treated as *sets* of lines
> > (unordered, unique). The similarity score is a number between 0.0 and
> > 1.0. Other similarity metrics are certainly possible.
>
> We have to handle binary files, too. In the current implementation, we
> consider either lines or "chunks", and similarity is increased by the
> size of the chunk.
Yes, my thing doesn't handle binary files, but I have a variation of
the idea for that too which I'll explain below.
Can you explain what the current implementation does for binary files
in more detail, or point me to some docs? I'm having a hard code
figuring out what the code is doing, even though the comments insist
that it is very simple : )
from diffcore-delta.c:
"
* Idea here is very simple.
*
* Almost all data we are interested in are text, but sometimes we have
* to deal with binary data. So we cut them into chunks delimited by
* LF byte, or 64-byte sequence, whichever comes first, and hash them.
"
What is the similarity metric for binary files? Is it related to the
number of 64 byte chunks they have in common? How do you know that
the 64 byte chunks match up? Suppose I have 10k file, and then I
insert 10 random bytes at positions, 1000, 2000, 3000, etc. How does
that work?
> > * This can be run on all files, not just adds/deletes. If I have a
>
> Great. git has a "look for copies also" flag, but it is usually disabled
> because of the computational cost. If we can get it low enough, it might
> actually become a lot more useful.
Yes, there seem to be quite a few flags that have to do with trading
off features for computational time/memory. I believe this algorithm
could be made fast enough to simplify the user interface a bit. I'm
not yet super familiar with git, but I imagine it's probably hard for
some users to intuit what these thresholds do.
> > If anything about the explanation is unclear, let me know and I will
> > try to clarify it. Playing around with the demo should illuminate
> > what it does. You can run it on data sets of your own. All you need
> > is 2 source trees and the "find" command to produce input to the
> > script (see setup_demo.sh).
>
> I'll try it on my test data, but it sounds like it doesn't really handle
> binary files.
Yes, I think we should try it out for text files first, since that's
probably the more important case. But at the risk of getting a bit
ahead of myself, I think you can do a similar thing for binary files.
This first part isn't my idea; I heard it at a talk by Udi Manber at
Google, but I think it could be combined with my pruning and sparse
similarity matrix thing. And it looks like there are already some of
the same ideas in git, though I'm still deciphering the code (any docs
on this area would help).
Basically his idea is that you take a rolling window of say 64 bytes
and create an inverted index, just like you do for text files. So if
you have a 10,000 byte file, then there are (10,000 - 64) hashes to be
made.
This could be a lot, so you can speed it up by sampling. But you want
to sample in such a way that preserves commonality. That is, you
don't want to sample a given 64-byte sequence in one doc but miss it
in the other one. So then all you do is keep all windows where the
hash code is 0 mod k (and you can adjust k that to achieve the
sampling rate you want). If a given sequence is sampled in *one* doc,
then it's guaranteed to be sampled in *all* docs.
The second point is that you can do this rolling window hashing very
fast with a polynomial hash. You can use the results of the previous
hash to compute the next hash. I think you already have this in
diff-delta.c, but I'm not quite sure. I'm not sure exactly what that
code is used for either (I don't think it is for the rename matching,
because that is done by estimate_similarity and
diffcore_count_changes?).
Once you have these 2 inverted indices of { sampled subset of 64-byte
substrings -> [list of documents] } then you simply do the same thing
as I suggested for text files. The logic is more or less the same.
If 2 files have many 64-byte substrings in common compared to their
sizes, then they are similar. If a given 64-byte sequence (say
0000000000000...000) appears in many docs, then it's not a good
differentiator or indicator of similarity -- so throw it out.
(It occurs to me that it might be useful to do this with a small
window (8 bytes?) and a larger one (>64), and somehow combine the
results. I guess some experimentation is in order, or maybe there is
some theory about that.)
So this is a linear algorithm too. The hashing could have a high
constant factor, but the sampling and polynomial hashing should
basically eliminate that, I believe.
But like I said, it's probably better to concentrate on the text part
before anyone tackles that (at least I will look at the text case
first). I have less experience with this algorithm, but it seems like
it should work just as well, and is quite simple. I think both of
these algorithms are a bit more general and should lead to a net
reduction in lines of code, which is a good thing.
Andy
^ permalink raw reply
* Re: best git practices, was Re: Git User's Survey 2007 unfinished summary continued
From: Jakub Narebski @ 2007-10-22 23:35 UTC (permalink / raw)
To: Andreas Ericsson
Cc: Johannes Schindelin, Steffen Prohaska, Federico Mena Quintero,
git
In-Reply-To: <471CB443.9070606@op5.se>
On 10/22/07, Andreas Ericsson <ae@op5.se> wrote:
> Johannes Schindelin wrote:
>> On Mon, 22 Oct 2007, Andreas Ericsson wrote:
>>
>>> If I were to suggest any improvements, it'd be to change the semantics of
>>> git-pull to always update the local branches set up to be merged with the
>>> remote tracking branches when they, prior to fetching, pointed to the same
>>> commit, such that when
>>>
>>> $ git show-ref master
>>> d4027a816dd0b416dc8c7b37e2c260e6905f11b6 refs/heads/master
>>> d4027a816dd0b416dc8c7b37e2c260e6905f11b6 refs/remotes/origin/master
>>>
>>> refs/heads/master gets set to refs/remotes/origin/master post-fetch.
>>
>> In general, this should fail. Because you are expected to have local
>> changes in the local branches.
>
>
> BS argument. Git knows when I haven't got any changes on my local
> branches, and it can be fairly safely assumed that when I feel like
> making any, I'd like to make them off as fresh a tip as possible unless
> I explicitly tell git otherwise.
[cut]
It would be I think possible to make git behave as you want, although I'd rather
(at least at first) have behaviour described above turned on by some option
or config variable. I guess that it would be not that hard to make script to do
what you ant (and probably it would be best if you tried your idea that way).
There are the following caveats.
1. For each local branch that is to be updated on pull, this branch
must be marked as tracking some branch of some repository. This has to
be explicitely done; for example by creating those branches using
--track option.
2. Git can do a merge with conflicts _only_ if that branch is checked
out. So for all local branches which you want to get updated using
"git pull --update-all <repo>" (or something like that), the merge
with remote branch should be either fast-forward, trivial merge, or
merge without conflicts. "git pull --update-all <repo>" would return
then list of updated branches and list of branches which cannot be
updated.
So... are you going to try to implement that?
--
Jakub Narebski
^ permalink raw reply
* Re: [PATCH] use only the PATH for exec'ing git commands
From: Johannes Schindelin @ 2007-10-22 23:34 UTC (permalink / raw)
To: Alex Riesen; +Cc: Scott R Parish, git
In-Reply-To: <20071022224015.GG23714@steel.home>
Hi,
On Tue, 23 Oct 2007, Alex Riesen wrote:
> Scott R Parish, Tue, Oct 23, 2007 00:12:02 +0200:
> > > Alex Riesen, Mon, Oct 22, 2007 12:01
> > > Scott R Parish, Mon, Oct 22, 2007 19:01:48 +0200:
> > > > + strbuf_addch(out, ':');
> > >
> > > Shouldn't it break MingW32 native port?
> >
> > What can i do here to better accommodate MingW32? You're right, just
> > because the original code did it this way isn't a good excuse for me
> > not to do it better.
>
> someone here mentioned "higher abstractions".
That someone may well have mentioned that term, but what he meant was
special case those code paths which have to be treated differently for
Windows, and Windows alone.
(Yeah, I know, a response to that was that Nokia phones have drive
letters, too, but that was an invalid objection to that particular
statement, since Nokia phones expect the full path at any time, so I did
not even bother answering to that mail. Well, in a way, I guess I just
did.)
All this boils down to adding code dedicated to Windows. And I am a huge
fan of the principle that you should cross bridges when you get to them,
and not before (i.e. avoid over-engineering).
So my vote is: get it in as-is, us msysGit lot will cope with it in one
way or another. (We already have at least one other place where ":" is
used, which we have to cope with, in shell.c:do_cvs_command().)
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Dissociating a repository from its alternates
From: Michael Hendricks @ 2007-10-22 23:30 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0710221957360.25221@racer.site>
On Mon, Oct 22, 2007 at 08:05:58PM +0100, Johannes Schindelin wrote:
> On Mon, 22 Oct 2007, Michael Hendricks wrote:
> > Was such a script ever incorporated into Git?
>
> Not that I know of, but "git repack -a && rm
> .git/objects/info/alternates" should do what you want. You can even
> make a script of it, add some documentation and a test case, and earn
> git fame by posting a patch ;-)
With 1.5.3.4, it doesn't appear to work:
$ git clone -s git git2
Initialized empty Git repository in /Users/michael/src/git2/.git/
$ cd git2
$ git repack -a && rm .git/objects/info/alternates
Generating pack...
Done counting 0 objects.
Nothing new to pack.
$ git status
# On branch master
fatal: bad object HEAD
--
Michael
^ permalink raw reply
* Re: Git User's Survey 2007 unfinished summary continued
From: Jakub Narebski @ 2007-10-22 23:27 UTC (permalink / raw)
To: Federico Mena Quintero; +Cc: Andreas Ericsson, Johannes Schindelin, git
In-Reply-To: <1193064780.4522.142.camel@cacharro.xalalinux.org>
On 10/22/07, Federico Mena Quintero <federico@novell.com> wrote:
> On Mon, 2007-10-22 at 09:59 +0200, Andreas Ericsson wrote:
>
>> I doubt many people on this list regularly use git-blame but it's a
>> command that's definitely non-trivial to script out using only the
>> "proper" commands, and CVS/SVN users expect it to be there, so it's
>> probably worth listing anyhow.
> Personally I find git-blame *EXTREMELY* useful. The workflow is:
> 5. "WTF? Who wrote this crappy code?"
>
> 6. git blame culprit-file.c
>
> 7. "Oh, it was $person with $commit_id... what were they thinking at the
> time?"
>
> 8. git show $commit_id
You don't need blame for that (by the way, as git-blame is slow, you
can try -L option to limit range of lines; it is a pity that 'git gui
blame' does not support it yet). You can use 'pickaxe search', i.e.
"git log -S'<crappy code>'". Sometimes it is better than git-blame...
--
Jakub Narebski
^ permalink raw reply
* Re: best git practices, was Re: Git User's Survey 2007 unfinished summary continued
From: Johannes Schindelin @ 2007-10-22 23:21 UTC (permalink / raw)
To: Federico Mena Quintero; +Cc: Andreas Ericsson, git
In-Reply-To: <1193081785.4522.181.camel@cacharro.xalalinux.org>
Hi,
On Mon, 22 Oct 2007, Federico Mena Quintero wrote:
> On Mon, 2007-10-22 at 17:16 +0200, Andreas Ericsson wrote:
>
> > To me, it's more along the lines of "let git help me not make the
> > mistake of hacking on a six-week old codebase when I've explicitly asked
> > it to merge these and those remote tracking branches into these and
> > those local branches". Not updating those branches when there *are*
> > changes on them is something users can understand and will probably also
> > appreciate, but the reason for not allowing even fast-forwards escape me.
>
> I'd love this behavior, FWIW.
>
> The "branches should not track their origin by default" seems suited
> only to Linux kernel maintainers who frequently pull from many different
> people, not to "random hacker who wants to keep track of a project he
> doesn't maintain" :)
The problem I see here is not that the kernel folks would suffer, but that
the behaviour would not be easy to explain. Which is a sure way to not
only give people rope, but put their heads in the noose.
Not having clear semantics is prone to lead to misunderstandings, and
mistakes.
IOW while I trust you when you say it would make things easier for you, I
am quite certain it would make things much harder for a substantial part
of the rest of humanity.
Ciao,
Dscho
^ permalink raw reply
* [PATCH 2/2] Let git-add--interactive read colors from git-config
From: Dan Zwell @ 2007-10-22 21:40 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: Jeff King, Wincent Colaiuta, Git Mailing List,
Jonathan del Strother, Johannes Schindelin, Frank Lichtenheld
In-Reply-To: <20071017015152.GN13801@spearce.org>
Colors are specified in color.interactive.{prompt,header,help}.
They are specified as git color strings as described in the
documentation, then parsed into perl color strings (slightly
different). Ugly but visible defaults are still used.
Signed-off-by: Dan Zwell <dzwell@zwell.net>
---
Note: the code to parse git-style color strings to perl-style color
strings should eventually be added to Git.pm so that other (perl)
parts of git can be configured to read colors from .gitconfig in
a nicer way. A git-style string is "ul red black", while perl
likes strings like "underline red on_black".
Documentation/config.txt | 7 ++++
git-add--interactive.perl | 76
++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 79
insertions(+), 4 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index c795a35..75a976a 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -387,6 +387,13 @@ color.interactive::
`auto`, use colors only when the output is to the
terminal. Defaults to false.
+color.interactive.<slot>::
+ Use customized color for `git add --interactive`
+ output. `<slot>` may be `prompt`, `header`, or `help`, for
+ three distinct types of normal output from interactive
+ programs. The values of these variables may be specified as
+ in color.branch.<slot>.
+
color.pager::
A boolean to enable/disable colored output when the pager is in
use (default is true).
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index c66ed4d..d85ec92 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -6,10 +6,78 @@ my ($use_color, $prompt_color, $header_color, $help_color);
my $color_config = qx(git config --get color.interactive);
if ($color_config=~/true|always/ || -t STDOUT && $color_config=~/auto/) {
$use_color = "true";
- # Sane (visible) defaults:
- $prompt_color = "blue bold";
- $header_color = "bold";
- $help_color = "red bold";
+ # Grab the 3 main colors in git color string format:
+ my @git_prompt_color =
+ split(/\s+/, qx(git config --get color.interactive.prompt));
+ my @git_header_color =
+ split(/\s+/, qx(git config --get color.interactive.header));
+ my @git_help_color =
+ split(/\s+/, qx(git config --get color.interactive.help));
+
+ # Sane (visible) defaults:
+ if (! @git_prompt_color) {
+ @git_prompt_color = ("blue", "bold");
+ }
+ if (! @git_header_color) {
+ @git_header_color = ("bold");
+ }
+ if (! @git_help_color) {
+ @git_help_color = ("red", "bold");
+ }
+
+ # Parse the git colors into perl colors:
+ my %attrib_mappings = (
+ "bold" => "bold",
+ "ul" => "underline",
+ "blink" => "blink",
+ # not supported:
+ #"dim" => "",
+ "reverse" => "reverse"
+ );
+
+ my @tmp_perl_colors;
+ my $color_list;
+ # Loop over the array of (arrays of) git-style colors
+ foreach $color_list ([@git_prompt_color], [@git_header_color],
+ [@git_help_color]) {
+ my $fg_done;
+ my @perl_attribs;
+ my $word;
+ foreach $word (@{$color_list}) {
+ if ($word =~ /normal/) {
+ $fg_done = "true";
+ }
+ elsif ($word =~ /black|red|green|yellow/ ||
+ $word =~ /blue|magenta|cyan|white/) {
+ # is a color.
+ if ($fg_done) {
+ # this is the background
+ push @perl_attribs, "on_" . $word;
+ }
+ else {
+ # this is foreground
+ $fg_done = "true";
+ push @perl_attribs, $word;
+ }
+ }
+ else {
+ # this is an attribute, not a color.
+ if ($attrib_mappings{$word}) {
+ push(@perl_attribs,
+ $attrib_mappings{$word});
+ }
+ }
+ }
+ if (@perl_attribs) {
+ push @tmp_perl_colors, join(" ", @perl_attribs);
+ }
+ else {
+ #@perl_attribs is empty, need a placeholder
+ push @tmp_perl_colors, "reset";
+ }
+ }
+ ($prompt_color, $header_color, $help_color) =
+ @tmp_perl_colors;
require Term::ANSIColor;
}
--
1.5.3.4.207.gc0ee
^ permalink raw reply related
* [PATCH 1/2] Added basic color support to git add --interactive
From: Dan Zwell @ 2007-10-22 21:32 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: Jeff King, Wincent Colaiuta, Git Mailing List,
Jonathan del Strother, Johannes Schindelin, Frank Lichtenheld
In-Reply-To: <20071017015152.GN13801@spearce.org>
Added function "print_colored" that prints text with a color that
is passed in. Converted many calls to "print" to being calls to
"print_colored".
The prompt, the header, and the help output are the 3 types of
colorized output, and each has its own color.
Colorization is done through Term::ANSIColor, which is included
with modern versions of perl. This is optional, and should not
need to be present if color.interactive is not turned on.
Signed-off-by: Dan Zwell <dzwell@zwell.net>
---
Documentation/config.txt | 6 ++++++
git-add--interactive.perl | 37 +++++++++++++++++++++++++++++++------
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 971fd9f..c795a35 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -381,6 +381,12 @@ color.diff.<slot>::
whitespace). The values of these variables may be specified as
in color.branch.<slot>.
+color.interactive::
+ When true (or `always`), always use colors in `git add
+ --interactive`. When false (or `never`), never. When set to
+ `auto`, use colors only when the output is to the
+ terminal. Defaults to false.
+
color.pager::
A boolean to enable/disable colored output when the pager is in
use (default is true).
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index be68814..c66ed4d 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -2,6 +2,31 @@
use strict;
+my ($use_color, $prompt_color, $header_color, $help_color);
+my $color_config = qx(git config --get color.interactive);
+if ($color_config=~/true|always/ || -t STDOUT && $color_config=~/auto/) {
+ $use_color = "true";
+ # Sane (visible) defaults:
+ $prompt_color = "blue bold";
+ $header_color = "bold";
+ $help_color = "red bold";
+
+ require Term::ANSIColor;
+}
+
+sub print_colored {
+ my $color = shift;
+ my @strings = @_;
+
+ if ($use_color) {
+ print Term::ANSIColor::color($color);
+ print(@strings);
+ print Term::ANSIColor::color("reset");
+ } else {
+ print @strings;
+ }
+}
+
sub run_cmd_pipe {
if ($^O eq 'MSWin32') {
my @invalid = grep {m/[":*]/} @_;
@@ -175,7 +200,7 @@ sub list_and_choose {
if (!$opts->{LIST_FLAT}) {
print " ";
}
- print "$opts->{HEADER}\n";
+ print_colored $header_color, "$opts->{HEADER}\n";
}
for ($i = 0; $i < @stuff; $i++) {
my $chosen = $chosen[$i] ? '*' : ' ';
@@ -205,7 +230,7 @@ sub list_and_choose {
return if ($opts->{LIST_ONLY});
- print $opts->{PROMPT};
+ print_colored $prompt_color, $opts->{PROMPT};
if ($opts->{SINGLETON}) {
print "> ";
}
@@ -544,7 +569,7 @@ sub coalesce_overlapping_hunks {
}
sub help_patch_cmd {
- print <<\EOF ;
+ print_colored $help_color, <<\EOF ;
y - stage this hunk
n - do not stage this hunk
a - stage this and all the remaining hunks
@@ -619,7 +644,7 @@ sub patch_update_cmd {
for (@{$hunk[$ix]{TEXT}}) {
print;
}
- print "Stage this hunk [y/n/a/d$other/?]? ";
+ print_colored $prompt_color, "Stage this hunk [y/n/a/d$other/?]? ";
my $line = <STDIN>;
if ($line) {
if ($line =~ /^y/i) {
@@ -673,7 +698,7 @@ sub patch_update_cmd {
elsif ($other =~ /s/ && $line =~ /^s/) {
my @split = split_hunk($hunk[$ix]{TEXT});
if (1 < @split) {
- print "Split into ",
+ print_colored "$header_color", "Split into ",
scalar(@split), " hunks.\n";
}
splice(@hunk, $ix, 1,
@@ -769,7 +794,7 @@ sub quit_cmd {
}
sub help_cmd {
- print <<\EOF ;
+ print_colored $help_color, <<\EOF ;
status - show paths with changes
update - add working tree state to the staged set of changes
revert - revert staged set of changes back to the HEAD version
--
1.5.3.4.207.gc0ee
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox