* Re: [PATCH 2/2] gitweb: add a feature to show side-by-side diff
From: Jakub Narebski @ 2011-10-30 18:56 UTC (permalink / raw)
To: Kato Kazuyoshi; +Cc: git, Jakub Narebski
In-Reply-To: <CAFo4x0L4BAKnCDa1uEK0Rskd9kTsR-94D4mkYKnLGqVDnuyuBA@mail.gmail.com>
Those are additional comments, most of which I have come about when
rewriting this series and testing it.
There are to complement existing comments in other post(s).
Kato Kazuyoshi <kato.kazuyoshi@gmail.com> writes:
> ---
> gitweb/gitweb.perl | 81 +++++++++++++++++++++++++++++++++++++++++----
> gitweb/static/gitweb.css | 15 ++++++++
> 2 files changed, 88 insertions(+), 8 deletions(-)
No tests.
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 095adda..dca09dc 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -757,6 +757,7 @@ our @cgi_param_mapping = (
> extra_options => "opt",
> search_use_regexp => "sr",
> ctag => "by_tag",
> + diff_style => "ds",
> # this must be last entry (for manipulation from JavaScript)
> javascript => "js"
> );
Alternate solution would be to use 'extra_options' ("opt") for
that... though current use of it in gitweb seems to suggest that it is
more about passing extra options to underlying git commands; and "git
diff" doesn't support '--side-by-side' like GNU diff does, (yet?).
So currently I favor neither.
> @@ -1072,6 +1073,8 @@ sub evaluate_and_validate_params {
> }
> $search_regexp = $search_use_regexp ? $searchtext : quotemeta $searchtext;
> }
> +
> + $input_params{diff_style} ||= 'inline';
> }
Hmmm... similar option 'order' ("o") had default value set in action
subroutine. I wonder if it wouldn't be better to do the same also in
this situation.
> @@ -2276,7 +2279,7 @@ sub format_diff_line {
> }
> $line = "<span class=\"chunk_info\">@@ $from_text $to_text @@</span>" .
> "<span class=\"section\">" . esc_html($section, -nbsp=>1) .
> "</span>";
> - return "$div_open$line</div>\n";
> + return $diff_class, "$div_open$line</div>\n";
> } elsif ($from && $to && $line =~ m/^\@{3}/) {
> my ($prefix, $ranges, $section) = $line =~ m/^(\@+) (.*?) \@+(.*)$/;
> my (@from_text, @from_start, @from_nlines, $to_text, $to_start, $to_nlines);
This subroutine no longer *format* line to be printed, isn't it?
> @@ -4828,8 +4831,32 @@ sub git_difftree_body {
> print "</table>\n";
> }
>
> +sub format_diff_chunk {
Name: it is not about diff chunk (or hunk), but about a block of lines
in a chunk; in this case block of change lines (rem / add). Also, it
is not about generic diff, only about sidebyside one.
BTW. I think it would be better if this subroutine also managed
context lines.
> + my @chunk = @_;
> +
> + my $first_class = $chunk[0]->[0];
Style: You can use simply $chunk[0][0] here. perlref(1) says:
"The arrow is optional between brackets subscripts, [...]"
> + my @partial = map { $_->[1] } grep { $_->[0] eq $first_class } @chunk;
> +
> + if (scalar @partial < scalar @chunk) {
Style: you can write simply
+ if (@partial < @chunk) {
> + return join '', ("<div class='chunk'><div class='old'>",
> + @partial,
> + "</div>",
> + "<div class='new'>",
> + (map {
> + $_->[1];
> + } @chunk[scalar @partial..scalar @chunk-1]),
> + "</div></div>");
> + } else {
> + return join '', ("<div class='chunk'><div class='",
> + ($first_class eq 'add' ? 'new' : 'old'),
> + "'>",
> + @partial,
> + "</div></div>");
> + }
> +}
Anyway this code is not very clear. You rely on the fact that if
there are two classes, then they are "rem" first, and "add" second.
Also, it is I think overly complicated.
> +
> sub git_patchset_body {
> - my ($fd, $difftree, $hash, @hash_parents) = @_;
> + my ($fd, $is_inline, $difftree, $hash, @hash_parents) = @_;
Rather than passing $is_inline, I think it would be better to pass
$diff_style (with default value filled in)
> my ($hash_parent) = $hash_parents[0];
>
> my $is_combined = (@hash_parents > 1);
> @@ -4940,12 +4967,31 @@ sub git_patchset_body {
>
> # the patch itself
> LINE:
> + my @chunk;
> while ($patch_line = <$fd>) {
> chomp $patch_line;
>
> next PATCH if ($patch_line =~ m/^diff /);
Here is a bug. If patchset consists of more than one patch, if
not-last patches have change that does not have trailing context lines
(changed, added or removed lines at the end of file), then the last
block will be lost (@chunk can be non-empty here).
>
> - print format_diff_line($patch_line, \%from, \%to);
> + my ($class, $line) = format_diff_line($patch_line, \%from, \%to);
> + if ($is_inline) {
That is wrong to test for. You should test if you can use
side-by-side diff, not if you use default output.
Especially that diff can be combined diff of a merge commit, which
cannot be represented as 2-sided side-by-side diff; for such diff
gitweb needs to use inline diff.
> + print $line;
> + } elsif ($class eq 'add' || $class eq 'rem') {
> + push @chunk, [ $class, $line ];
> + } else {
> + if (@chunk) {
> + print format_diff_chunk(@chunk);
> + @chunk = ();
> + } elsif ($class eq 'chunk_header') {
> + print $line;
> + } else {
> + print '<div class="chunk"><div class="old">',
> + $line,
> + '</div><div class="new">',
> + $line,
> + '</div></div>';
All of this should in my opinion be done in format_diff_chunk(), not
in caller. This also introduces a bit of inconsistency in that
added/removed lines are in single block and context lines are each in
its own block.
Additionally you forgot about incomplete lines here, which can apply
either to added lines, removed lines, both of added and removed lines,
and to context lines. Your code generates incorrect info in the case
if incomplete line is either removed line only, or added line only.
[Nb. I have to check my code yet again.]
> +sub diff_nav {
> + my ($style) = @_;
> +
> + my %pairs = (inline => 'inline', 'sidebyside' => 'side by side');
> + join '', ($cgi->start_form({ method => 'get' }),
> + $cgi->hidden('p'),
> + $cgi->hidden('a'),
> + $cgi->hidden('h'),
> + $cgi->hidden('hp'),
> + $cgi->hidden('hb'),
> + $cgi->hidden('hpb'),
> + $cgi->popup_menu('ds', [keys %pairs], $style, \%pairs),
> + $cgi->submit('change'),
> + $cgi->end_form);
> +}
What about 'f' and 'fp' for "blobdiff" view?
> diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
> index 7d88509..dc84db2 100644
> --- a/gitweb/static/gitweb.css
> +++ b/gitweb/static/gitweb.css
> @@ -618,6 +618,21 @@ div.remote {
> cursor: pointer;
> }
>
> +/* side-by-side diff */
> +div.chunk {
> + overflow: hidden;
> +}
> +
> +div.chunk div.old {
> + float: left;
> + width: 50%;
> + overflow: hidden;
> +}
> +
> +div.chunk div.new {
> + margin-left: 50%;
> + width: 50%;
> +}
Nice trick of composing CSS layout... though I wonder if there is
perhaps a better solution.
Anyway, I think this addition should be put near style for div.diff
etc.
--
Jakub Narębski
^ permalink raw reply
* Re: [PATCH] document 'T' status from git-status
From: Mark Dominus @ 2011-10-30 20:34 UTC (permalink / raw)
To: git; +Cc: Mark Dominus
In-Reply-To: <7vmxcjro5t.fsf@alter.siamese.dyndns.org>
On 10/30/2011 02:25 AM, Junio C Hamano wrote:
> Mark Dominus<mjd@plover.com> writes:
>
>
>> +* 'T' = file type changed
>> + (typically from plain file to symlink, or vice versa)
>>
>> Ignored files are not listed, unless `--ignored` option is in effect,
>> in which case `XY` are `!!`.
>> @@ -134,9 +136,11 @@ in which case `XY` are `!!`.
>> D [ M] deleted from index
>> R [ MD] renamed in index
>> C [ MD] copied in index
>> + T [ MD] file type changed in index
>> [MARC] index and work tree matches
>> [ MARC] M work tree changed since index
>> [ MARC] D deleted in work tree
>> + [ MARC] T file type changed in work tree
> The current organization of this table may need to be rethought, but if we
> were to keep it, then this change is far from sufficient. For example, you
> do not explain what XY = TT means.
Thanks for your response.
I did not try to document that because in my experimenting I was not
able to produce that situation. T occurs when the filetype (as reported
by the IS_FMT macro) is different between the two files. On systems I
have available, there are essentially five filetypes: plain file,
symlink, directory, block and character devices. Directories are
handled separately and are not reported by git-status. Device files
cannot be added to the index at all. That leaves only two possible
filetypes, so of the three files (the committed version, the cached
version, and the working tree version) two must be the same.
I am aware that on some systems other filetypes may exist. For example,
HPUX has an 'H' filetype that is a variant of a directory. But git
would treat this as a directory. Since I was not aware of any situation
in which TT could arise, I did not try to document it.
Will you be applying the alternative patch you suggested, or would you
prefer that I try to produce one along those lines?
^ permalink raw reply
* Re: [msysGit] Re: What's cooking in git.git (Oct 2011, #11; Fri, 28)
From: Johannes Sixt @ 2011-10-30 21:43 UTC (permalink / raw)
To: kusmabite; +Cc: Junio C Hamano, git, msysGit
In-Reply-To: <CABPQNSYi7gJKbUb7y2hNvF9KXXyt8ShgJD8AoBhryGwAxp6ejw@mail.gmail.com>
Am 29.10.2011 17:42, schrieb Erik Faye-Lund:
> On Fri, Oct 28, 2011 at 8:12 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> * ef/mingw-upload-archive (2011-10-26) 3 commits
>> - upload-archive: use start_command instead of fork
>> - compat/win32/poll.c: upgrade from upstream
>> - mingw: move poll out of sys-folder
>>
>> Are msysgit folks OK with this series (I didn't see msysgit list Cc'ed on
>> these patches)? If so let's move this forward, as the changes to the core
>> part seem solid.
>
> The msysgit list not being Cc'ed on the patches was a slip-up on my
> behalf. I believe the changes are relatively uncontroversial from an
> msysgit point of view, though. However, an ack/nack would be
> appreciated ;)
The patch series looks good and passes my tests. Therefore:
Acked-by: Johannes Sixt <j6t@kdbg.org>
-- Hannes
^ permalink raw reply
* [PATCHv3 0/8] gitweb: side-by-side diff
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
NOTE: As it is feature-freeze period, this patch series is for review.
This is refinement and extension of Kato Kazuyoshi patch series, sent
originally as
[PATCH/RFC] gitweb: add the ability to show side-by-side diff on commitdiff.
http://thread.gmane.org/gmane.comp.version-control.git/183744
and then refined and split into two-patch series
[PATCH/RFC 1/2] gitweb: change format_diff_line() to remove leading SP from $diff_class
http://thread.gmane.org/gmane.comp.version-control.git/183770
[PATCH 2/2] gitweb: add a feature to show side-by-side diff
http://thread.gmane.org/gmane.comp.version-control.git/183769
This patch series originally started as rebasing second patch in above
two part series on top of diff line classification refactoring
suggested by me and proposed by Junio. Then I thought about putting
all code printing side-by-side diff in print_sidebyside_diff_chunk()
subroutine, then...
Main changes from v2 version from Kato Kazuyoshi:
* Built on top of refactoring of code related to diff
output formatting (patches 1 and 2)
* Code reworked so that is in my opinion easier to follow; gitweb now
handles merges and diffs with incomplete lines correctly (patch 3)
- well, it handles merges by turning off side-by-side diff for them.
* Adding background color to distinguish empty context lines from
vertical align, similarly to e.g.
http://community.activestate.com/files/images/sbsdiffs.png
but without refinement (word diff of changes).
* Adds some very basic test for side-by-side diff (patch 6 (and 5))
* Split adding navigation into a separate commit, and uses [nav] links
rather than HTML form for selecting between inline and side-by-side
diff style (diff 8). Thanks to more thorough use of href(-replay=>1,..)
(patch 7) style of diff should be preserved with this series.
Please excuse me for essentially hijacking this patch series.
P.S. I really, really need to finish work on splitting gitweb into
smaller pieces. With around 8,000 lines it becomes quite unwieldy.
But this would probably need total rework of error handling (the
die_error subroutine), and that would need another changes, etc....
Pull request:
~~~~~~~~~~~~~
These changes are available in the git repository(-y/+ies) at:
git://repo.or.cz/git/jnareb-git.git gitweb/side-by-side-diff-v4
git://github.com/jnareb/git gitweb/side-by-side-diff-v4
Table of contents:
~~~~~~~~~~~~~~~~~~
[PATCHv3 1/8] gitweb: Refactor diff body line classification
[PATCHv3 2/8] gitweb: Extract formatting of diff chunk header
[PATCHv3 3/8] gitweb: Add a feature to show side-by-side diff
[PATCHv3 4/8] gitweb: Give side-by-side diff extra CSS styling
[PATCHv3 5/8] t9500: Add test for handling incomplete lines in diff
by gitweb
[PATCHv3 6/8] t9500: Add basic sanity tests for side-by-side diff in
gitweb
[PATCHv3 7/8] gitweb: Use href(-replay=>1,...) for formats links in
"commitdiff"
[PATCHv3 8/8] gitweb: Add navigation to select side-by-side diff
Shortlog:
~~~~~~~~~
Jakub Narebski (6):
gitweb: Refactor diff body line classification
gitweb: Extract formatting of diff chunk header
gitweb: Give side-by-side diff extra CSS styling
t9500: Add test for handling incomplete lines in diff by gitweb
t9500: Add basic sanity tests for side-by-side diff in gitweb
gitweb: Use href(-replay=>1,...) for formats links in "commitdiff"
Kato Kazuyoshi (2):
gitweb: Add a feature to show side-by-side diff
gitweb: Add navigation to select side-by-side diff
Diffstat:
~~~~~~~~~
gitweb/gitweb.perl | 339 +++++++++++++++++++++++--------
gitweb/static/gitweb.css | 30 +++
t/t9500-gitweb-standalone-no-errors.sh | 73 +++++++-
3 files changed, 353 insertions(+), 89 deletions(-)
--
1.7.6
^ permalink raw reply
* [PATCHv3 1/8] gitweb: Refactor diff body line classification
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski, Junio C Hamano
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
Simplify classification of diff line body in format_diff_line(),
replacing two long if-elsif chains (one for ordinary diff and one for
combined diff of a merge commit) with a single regexp match. Refactor
this code into diff_line_class() function.
While at it:
* Fix an artifact in that $diff_class included leading space to be
able to compose classes like this "class=\"diff$diff_class\"', even
when $diff_class was an empty string. This made code unnecessary
ugly: $diff_class is now just class name or an empty string.
* Introduce "ctx" class for context lines ($diff_class was set to ""
in this case before this commit).
Idea and initial code by Junio C Hamano, polish and testing by Jakub
Narebski. Inspired by patch adding side-by-side diff by Kato Kazuyoshi,
which required $diff_class to be name of class without extra space.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch is new in this version of side-by-side diff series.
Junio, as your proposal was of "what if" variety, and not as a proper
patch, I have taken authorship (after reqorking and testing it).
Should I revert authorship to you?
gitweb/gitweb.perl | 67 ++++++++++++++++++++++++++++-----------------------
1 files changed, 37 insertions(+), 30 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4f0c3bd..914fd4c 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2225,40 +2225,47 @@ sub format_diff_cc_simplified {
return $result;
}
+sub diff_line_class {
+ my ($line, $from, $to) = @_;
+
+ # ordinary diff
+ my $num_sign = 1;
+ # combined diff
+ if ($from && $to && ref($from->{'href'}) eq "ARRAY") {
+ $num_sign = scalar @{$from->{'href'}};
+ }
+
+ my @diff_line_classifier = (
+ { regexp => qr/^\@\@{$num_sign} /, class => "chunk_header"},
+ { regexp => qr/^\\/, class => "incomplete" },
+ { regexp => qr/^ {$num_sign}/, class => "ctx" },
+ # classifier for context must come before classifier add/rem,
+ # or we would have to use more complicated regexp, for example
+ # qr/(?= {0,$m}\+)[+ ]{$num_sign}/, where $m = $num_sign - 1;
+ { regexp => qr/^[+ ]{$num_sign}/, class => "add" },
+ { regexp => qr/^[- ]{$num_sign}/, class => "rem" },
+ );
+ for my $clsfy (@diff_line_classifier) {
+ return $clsfy->{'class'}
+ if ($line =~ $clsfy->{'regexp'});
+ }
+
+ # fallback
+ return "";
+}
+
# format patch (diff) line (not to be used for diff headers)
sub format_diff_line {
my $line = shift;
my ($from, $to) = @_;
- my $diff_class = "";
+
+ my $diff_class = diff_line_class($line, $from, $to);
+ my $diff_classes = "diff";
+ $diff_classes .= " $diff_class" if ($diff_class);
chomp $line;
-
- if ($from && $to && ref($from->{'href'}) eq "ARRAY") {
- # combined diff
- my $prefix = substr($line, 0, scalar @{$from->{'href'}});
- if ($line =~ m/^\@{3}/) {
- $diff_class = " chunk_header";
- } elsif ($line =~ m/^\\/) {
- $diff_class = " incomplete";
- } elsif ($prefix =~ tr/+/+/) {
- $diff_class = " add";
- } elsif ($prefix =~ tr/-/-/) {
- $diff_class = " rem";
- }
- } else {
- # assume ordinary diff
- my $char = substr($line, 0, 1);
- if ($char eq '+') {
- $diff_class = " add";
- } elsif ($char eq '-') {
- $diff_class = " rem";
- } elsif ($char eq '@') {
- $diff_class = " chunk_header";
- } elsif ($char eq "\\") {
- $diff_class = " incomplete";
- }
- }
$line = untabify($line);
+
if ($from && $to && $line =~ m/^\@{2} /) {
my ($from_text, $from_start, $from_lines, $to_text, $to_start, $to_lines, $section) =
$line =~ m/^\@{2} (-(\d+)(?:,(\d+))?) (\+(\d+)(?:,(\d+))?) \@{2}(.*)$/;
@@ -2276,7 +2283,7 @@ sub format_diff_line {
}
$line = "<span class=\"chunk_info\">@@ $from_text $to_text @@</span>" .
"<span class=\"section\">" . esc_html($section, -nbsp=>1) . "</span>";
- return "<div class=\"diff$diff_class\">$line</div>\n";
+ return "<div class=\"$diff_classes\">$line</div>\n";
} elsif ($from && $to && $line =~ m/^\@{3}/) {
my ($prefix, $ranges, $section) = $line =~ m/^(\@+) (.*?) \@+(.*)$/;
my (@from_text, @from_start, @from_nlines, $to_text, $to_start, $to_nlines);
@@ -2309,9 +2316,9 @@ sub format_diff_line {
}
$line .= " $prefix</span>" .
"<span class=\"section\">" . esc_html($section, -nbsp=>1) . "</span>";
- return "<div class=\"diff$diff_class\">$line</div>\n";
+ return "<div class=\"$diff_classes\">$line</div>\n";
}
- return "<div class=\"diff$diff_class\">" . esc_html($line, -nbsp=>1) . "</div>\n";
+ return "<div class=\"$diff_classes\">" . esc_html($line, -nbsp=>1) . "</div>\n";
}
# Generates undef or something like "_snapshot_" or "snapshot (_tbz2_ _zip_)",
--
1.7.6
^ permalink raw reply related
* [PATCHv3 2/8] gitweb: Extract formatting of diff chunk header
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
Refactor main parts of HTML-formatting for diff chunk headers
(formatting means here adding links and syntax hightlighting) into
separate subroutines:
* format_unidiff_chunk_header for ordinary diff,
* format_cc_diff_chunk_header for combined diff
(more than one parent)
This makes format_diff_line() subroutine easier to follow.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch is new in this version of side-by-side diff series.
After those changes format_diff_line() fits in one page (has less than
25 lines). Nice, isn't it?
gitweb/gitweb.perl | 114 ++++++++++++++++++++++++++++++---------------------
1 files changed, 67 insertions(+), 47 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 914fd4c..95d278a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2254,6 +2254,69 @@ sub diff_line_class {
return "";
}
+# assumes that $from and $to are defined and correctly filled,
+# and that $line holds a line of chunk header for unified diff
+sub format_unidiff_chunk_header {
+ my ($line, $from, $to) = @_;
+
+ my ($from_text, $from_start, $from_lines, $to_text, $to_start, $to_lines, $section) =
+ $line =~ m/^\@{2} (-(\d+)(?:,(\d+))?) (\+(\d+)(?:,(\d+))?) \@{2}(.*)$/;
+
+ $from_lines = 0 unless defined $from_lines;
+ $to_lines = 0 unless defined $to_lines;
+
+ if ($from->{'href'}) {
+ $from_text = $cgi->a({-href=>"$from->{'href'}#l$from_start",
+ -class=>"list"}, $from_text);
+ }
+ if ($to->{'href'}) {
+ $to_text = $cgi->a({-href=>"$to->{'href'}#l$to_start",
+ -class=>"list"}, $to_text);
+ }
+ $line = "<span class=\"chunk_info\">@@ $from_text $to_text @@</span>" .
+ "<span class=\"section\">" . esc_html($section, -nbsp=>1) . "</span>";
+ return $line;
+}
+
+# assumes that $from and $to are defined and correctly filled,
+# and that $line holds a line of chunk header for combined diff
+sub format_cc_diff_chunk_header {
+ my ($line, $from, $to) = @_;
+
+ my ($prefix, $ranges, $section) = $line =~ m/^(\@+) (.*?) \@+(.*)$/;
+ my (@from_text, @from_start, @from_nlines, $to_text, $to_start, $to_nlines);
+
+ @from_text = split(' ', $ranges);
+ for (my $i = 0; $i < @from_text; ++$i) {
+ ($from_start[$i], $from_nlines[$i]) =
+ (split(',', substr($from_text[$i], 1)), 0);
+ }
+
+ $to_text = pop @from_text;
+ $to_start = pop @from_start;
+ $to_nlines = pop @from_nlines;
+
+ $line = "<span class=\"chunk_info\">$prefix ";
+ for (my $i = 0; $i < @from_text; ++$i) {
+ if ($from->{'href'}[$i]) {
+ $line .= $cgi->a({-href=>"$from->{'href'}[$i]#l$from_start[$i]",
+ -class=>"list"}, $from_text[$i]);
+ } else {
+ $line .= $from_text[$i];
+ }
+ $line .= " ";
+ }
+ if ($to->{'href'}) {
+ $line .= $cgi->a({-href=>"$to->{'href'}#l$to_start",
+ -class=>"list"}, $to_text);
+ } else {
+ $line .= $to_text;
+ }
+ $line .= " $prefix</span>" .
+ "<span class=\"section\">" . esc_html($section, -nbsp=>1) . "</span>";
+ return $line;
+}
+
# format patch (diff) line (not to be used for diff headers)
sub format_diff_line {
my $line = shift;
@@ -2267,56 +2330,13 @@ sub format_diff_line {
$line = untabify($line);
if ($from && $to && $line =~ m/^\@{2} /) {
- my ($from_text, $from_start, $from_lines, $to_text, $to_start, $to_lines, $section) =
- $line =~ m/^\@{2} (-(\d+)(?:,(\d+))?) (\+(\d+)(?:,(\d+))?) \@{2}(.*)$/;
-
- $from_lines = 0 unless defined $from_lines;
- $to_lines = 0 unless defined $to_lines;
-
- if ($from->{'href'}) {
- $from_text = $cgi->a({-href=>"$from->{'href'}#l$from_start",
- -class=>"list"}, $from_text);
- }
- if ($to->{'href'}) {
- $to_text = $cgi->a({-href=>"$to->{'href'}#l$to_start",
- -class=>"list"}, $to_text);
- }
- $line = "<span class=\"chunk_info\">@@ $from_text $to_text @@</span>" .
- "<span class=\"section\">" . esc_html($section, -nbsp=>1) . "</span>";
+ $line = format_unidiff_chunk_header($line, $from, $to);
return "<div class=\"$diff_classes\">$line</div>\n";
+
} elsif ($from && $to && $line =~ m/^\@{3}/) {
- my ($prefix, $ranges, $section) = $line =~ m/^(\@+) (.*?) \@+(.*)$/;
- my (@from_text, @from_start, @from_nlines, $to_text, $to_start, $to_nlines);
-
- @from_text = split(' ', $ranges);
- for (my $i = 0; $i < @from_text; ++$i) {
- ($from_start[$i], $from_nlines[$i]) =
- (split(',', substr($from_text[$i], 1)), 0);
- }
-
- $to_text = pop @from_text;
- $to_start = pop @from_start;
- $to_nlines = pop @from_nlines;
-
- $line = "<span class=\"chunk_info\">$prefix ";
- for (my $i = 0; $i < @from_text; ++$i) {
- if ($from->{'href'}[$i]) {
- $line .= $cgi->a({-href=>"$from->{'href'}[$i]#l$from_start[$i]",
- -class=>"list"}, $from_text[$i]);
- } else {
- $line .= $from_text[$i];
- }
- $line .= " ";
- }
- if ($to->{'href'}) {
- $line .= $cgi->a({-href=>"$to->{'href'}#l$to_start",
- -class=>"list"}, $to_text);
- } else {
- $line .= $to_text;
- }
- $line .= " $prefix</span>" .
- "<span class=\"section\">" . esc_html($section, -nbsp=>1) . "</span>";
+ $line = format_cc_diff_chunk_header($line, $from, $to);
return "<div class=\"$diff_classes\">$line</div>\n";
+
}
return "<div class=\"$diff_classes\">" . esc_html($line, -nbsp=>1) . "</div>\n";
}
--
1.7.6
^ permalink raw reply related
* [PATCHv3 3/8] gitweb: Add a feature to show side-by-side diff
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
From: Kato Kazuyoshi <kato.kazuyoshi@gmail.com>
This commits adds to support for showing "side-by-side" style diff.
Currently you have to hand-craft the URL; navigation for selecting
diff style is to be added in the next commit.
The diff output in unified format from "git diff-tree" is reorganized to
side-by-side style chunk by chunk with format_sidebyside_diff_chunk().
This reorganization requires knowledge about diff line classification,
so format_diff_line() was renamed to process_diff_line(), and changed to
return tuple (list) consisting of class of diff line and of
HTML-formatted (but not wrapped in <div class="diff ...">...</div>) diff
line. Wrapping is now done by caller, i.e. git_patchset_body().
Gitweb uses float+margin CSS-based layout for "side by side" diff.
You can specify style of diff with "ds" ('diff_style') query
parameter. Currently supported values are 'inline' and 'sidebyside';
the default is 'inline'.
Another solution would be to use "opt" ('extra_options') for that...
though current use of it in gitweb seems to suggest that "opt" is more
about passing extra options to underlying git commands, and "git diff"
doesn't support '--side-by-side' like GNU diff does, (yet?).
Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Heavily changed from original submission by Kato Kazuyoshi, but the
main idea, code structure (somewhat) and CSS-base layout remains.
That's why authorship remains with him; Kato, please speak up if you
would like to change this.
The decision to move some of formatting outside process_diff_line()
(formerly format_diff_line()) was not really necessary, in hindsight...
gitweb/gitweb.perl | 116 +++++++++++++++++++++++++++++++++++++++++----
gitweb/static/gitweb.css | 17 +++++++
2 files changed, 122 insertions(+), 11 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 95d278a..68629f6 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -759,6 +759,7 @@ our @cgi_param_mapping = (
extra_options => "opt",
search_use_regexp => "sr",
ctag => "by_tag",
+ diff_style => "ds",
# this must be last entry (for manipulation from JavaScript)
javascript => "js"
);
@@ -2317,28 +2318,27 @@ sub format_cc_diff_chunk_header {
return $line;
}
-# format patch (diff) line (not to be used for diff headers)
-sub format_diff_line {
+# process patch (diff) line (not to be used for diff headers),
+# returning class and HTML-formatted (but not wrapped) line
+sub process_diff_line {
my $line = shift;
my ($from, $to) = @_;
my $diff_class = diff_line_class($line, $from, $to);
- my $diff_classes = "diff";
- $diff_classes .= " $diff_class" if ($diff_class);
chomp $line;
$line = untabify($line);
if ($from && $to && $line =~ m/^\@{2} /) {
$line = format_unidiff_chunk_header($line, $from, $to);
- return "<div class=\"$diff_classes\">$line</div>\n";
+ return $diff_class, $line;
} elsif ($from && $to && $line =~ m/^\@{3}/) {
$line = format_cc_diff_chunk_header($line, $from, $to);
- return "<div class=\"$diff_classes\">$line</div>\n";
+ return $diff_class, $line;
}
- return "<div class=\"$diff_classes\">" . esc_html($line, -nbsp=>1) . "</div>\n";
+ return $diff_class, esc_html($line, -nbsp=>1);
}
# Generates undef or something like "_snapshot_" or "snapshot (_tbz2_ _zip_)",
@@ -4860,8 +4860,78 @@ sub git_difftree_body {
print "</table>\n";
}
+sub print_sidebyside_diff_chunk {
+ my @chunk = @_;
+ my (@ctx, @rem, @add);
+
+ return unless @chunk;
+
+ # incomplete last line might be among removed or added lines,
+ # or both, or among context lines: find which
+ for (my $i = 1; $i < @chunk; $i++) {
+ if ($chunk[$i][0] eq 'incomplete') {
+ $chunk[$i][0] = $chunk[$i-1][0];
+ }
+ }
+
+ # guardian
+ push @chunk, ["", ""];
+
+ foreach my $line_info (@chunk) {
+ my ($class, $line) = @$line_info;
+
+ # print chunk headers
+ if ($class && $class eq 'chunk_header') {
+ print $line;
+ next;
+ }
+
+ ## print from accumulator when type of class of lines change
+ # empty contents block on start rem/add block, or end of chunk
+ if (@ctx && (!$class || $class eq 'rem' || $class eq 'add')) {
+ print join '',
+ '<div class="chunk_block">',
+ '<div class="old">',
+ @ctx,
+ '</div>',
+ '<div class="new">',
+ @ctx,
+ '</div>',
+ '</div>';
+ @ctx = ();
+ }
+ # empty add/rem block on start context block, or end of chunk
+ if ((@rem || @add) && (!$class || $class eq 'ctx')) {
+ print join '',
+ '<div class="chunk_block">',
+ '<div class="old">',
+ @rem,
+ '</div>',
+ '<div class="new">',
+ @add,
+ '</div>',
+ '</div>';
+ @rem = @add = ();
+ }
+
+ ## adding lines to accumulator
+ # guardian value
+ last unless $line;
+ # rem, add or change
+ if ($class eq 'rem') {
+ push @rem, $line;
+ } elsif ($class eq 'add') {
+ push @add, $line;
+ }
+ # context line
+ if ($class eq 'ctx') {
+ push @ctx, $line;
+ }
+ }
+}
+
sub git_patchset_body {
- my ($fd, $difftree, $hash, @hash_parents) = @_;
+ my ($fd, $diff_style, $difftree, $hash, @hash_parents) = @_;
my ($hash_parent) = $hash_parents[0];
my $is_combined = (@hash_parents > 1);
@@ -4871,6 +4941,7 @@ sub git_patchset_body {
my $diffinfo;
my $to_name;
my (%from, %to);
+ my @chunk; # for side-by-side diff
print "<div class=\"patchset\">\n";
@@ -4977,10 +5048,29 @@ sub git_patchset_body {
next PATCH if ($patch_line =~ m/^diff /);
- print format_diff_line($patch_line, \%from, \%to);
+ my ($class, $line) = process_diff_line($patch_line, \%from, \%to);
+ my $diff_classes = "diff";
+ $diff_classes .= " $class" if ($class);
+ $line = "<div class=\"$diff_classes\">$line</div>\n";
+
+ if ($diff_style eq 'sidebyside' && !$is_combined) {
+ if ($class eq 'chunk_header') {
+ print_sidebyside_diff_chunk(@chunk);
+ @chunk = ( [ $class, $line ] );
+ } else {
+ push @chunk, [ $class, $line ];
+ }
+ } else {
+ # default 'inline' style and unknown styles
+ print $line;
+ }
}
} continue {
+ if (@chunk) {
+ print_sidebyside_diff_chunk(@chunk);
+ @chunk = ();
+ }
print "</div>\n"; # class="patch"
}
@@ -6976,6 +7066,7 @@ sub git_object {
sub git_blobdiff {
my $format = shift || 'html';
+ my $diff_style = $input_params{'diff_style'} || 'inline';
my $fd;
my @difftree;
@@ -7085,7 +7176,8 @@ sub git_blobdiff {
if ($format eq 'html') {
print "<div class=\"page_body\">\n";
- git_patchset_body($fd, [ \%diffinfo ], $hash_base, $hash_parent_base);
+ git_patchset_body($fd, $diff_style,
+ [ \%diffinfo ], $hash_base, $hash_parent_base);
close $fd;
print "</div>\n"; # class="page_body"
@@ -7113,6 +7205,7 @@ sub git_blobdiff_plain {
sub git_commitdiff {
my %params = @_;
my $format = $params{-format} || 'html';
+ my $diff_style = $input_params{'diff_style'} || 'inline';
my ($patch_max) = gitweb_get_feature('patches');
if ($format eq 'patch') {
@@ -7316,7 +7409,8 @@ sub git_commitdiff {
$use_parents ? @{$co{'parents'}} : $hash_parent);
print "<br/>\n";
- git_patchset_body($fd, \@difftree, $hash,
+ git_patchset_body($fd, $diff_style,
+ \@difftree, $hash,
$use_parents ? @{$co{'parents'}} : $hash_parent);
close $fd;
print "</div>\n"; # class="page_body"
diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index 7d88509..21842a6 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -475,6 +475,23 @@ div.diff.nodifferences {
color: #600000;
}
+/* side-by-side diff */
+div.chunk_block {
+ overflow: hidden;
+}
+
+div.chunk_block div.old {
+ float: left;
+ width: 50%;
+ overflow: hidden;
+}
+
+div.chunk_block div.new {
+ margin-left: 50%;
+ width: 50%;
+}
+
+
div.index_include {
border: solid #d9d8d1;
border-width: 0px 0px 1px;
--
1.7.6
^ permalink raw reply related
* [PATCHv3 4/8] gitweb: Give side-by-side diff extra CSS styling
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
Use separate background colors for pure removal, pure addition and
change for side-by-side diff. This makes reading such diff easier,
allowing to easily distinguish empty lines in diff from vertical
whitespace used to align chunk blocks.
Note that if lines in diff were numbered, the absence of line numbers
[for one side] would help in distinguishing empty lines from vertical
align.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch is new in this version of series.
Note that the code could probably be written with less duplication, at
the cost of being more complicated. I think it is worth tradeoff as
written here.
For how output looks like, compare for example:
http://confluence.atlassian.com/display/FISHEYE/Using+Side+by+Side+Diff+View
gitweb/gitweb.perl | 39 +++++++++++++++++++++++++++++----------
gitweb/static/gitweb.css | 13 +++++++++++++
2 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 68629f6..f69ed08 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4890,7 +4890,7 @@ sub print_sidebyside_diff_chunk {
# empty contents block on start rem/add block, or end of chunk
if (@ctx && (!$class || $class eq 'rem' || $class eq 'add')) {
print join '',
- '<div class="chunk_block">',
+ '<div class="chunk_block ctx">',
'<div class="old">',
@ctx,
'</div>',
@@ -4902,15 +4902,34 @@ sub print_sidebyside_diff_chunk {
}
# empty add/rem block on start context block, or end of chunk
if ((@rem || @add) && (!$class || $class eq 'ctx')) {
- print join '',
- '<div class="chunk_block">',
- '<div class="old">',
- @rem,
- '</div>',
- '<div class="new">',
- @add,
- '</div>',
- '</div>';
+ if (!@add) {
+ # pure removal
+ print join '',
+ '<div class="chunk_block rem">',
+ '<div class="old">',
+ @rem,
+ '</div>',
+ '</div>';
+ } elsif (!@rem) {
+ # pure addition
+ print join '',
+ '<div class="chunk_block add">',
+ '<div class="new">',
+ @add,
+ '</div>',
+ '</div>';
+ } else {
+ # assume that it is change
+ print join '',
+ '<div class="chunk_block chg">',
+ '<div class="old">',
+ @rem,
+ '</div>',
+ '<div class="new">',
+ @add,
+ '</div>',
+ '</div>';
+ }
@rem = @add = ();
}
diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index 21842a6..c7827e8 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -491,6 +491,19 @@ div.chunk_block div.new {
width: 50%;
}
+div.chunk_block.rem div.old div.diff.rem {
+ background-color: #fff5f5;
+}
+div.chunk_block.add div.new div.diff.add {
+ background-color: #f8fff8;
+}
+div.chunk_block.chg div div.diff {
+ background-color: #fffff0;
+}
+div.chunk_block.ctx div div.diff.ctx {
+ color: #404040;
+}
+
div.index_include {
border: solid #d9d8d1;
--
1.7.6
^ permalink raw reply related
* [PATCHv3 5/8] t9500: Add test for handling incomplete lines in diff by gitweb
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
Check that "commitdiff" action in gitweb can handle (without errors)
incomplete lines as added and removed lines, and as context lines.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
New in this series, and independent on side-by-side stuff.
t/t9500-gitweb-standalone-no-errors.sh | 47 ++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index 5329715..c731507 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -274,6 +274,53 @@ test_expect_success \
'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"'
# ----------------------------------------------------------------------
+# commitdiff testing (incomplete lines)
+
+test_expect_success 'setup incomplete lines' '
+ cat >file<<-\EOF &&
+ Dominus regit me,
+ et nihil mihi deerit.
+ In loco pascuae ibi me collocavit,
+ super aquam refectionis educavit me;
+ animam meam convertit,
+ deduxit me super semitas jusitiae,
+ propter nomen suum.
+ CHANGE_ME
+ EOF
+ git commit -a -m "Preparing for incomplete lines" &&
+ echo "incomplete" | tr -d "\\012" >>file &&
+ git commit -a -m "Add incomplete line" &&
+ git tag incomplete_lines_add &&
+ sed -e s/CHANGE_ME/change_me/ <file >file+ &&
+ mv -f file+ file &&
+ git commit -a -m "Incomplete context line" &&
+ git tag incomplete_lines_ctx &&
+ echo "Dominus regit me," >file &&
+ echo "incomplete line" | tr -d "\\012" >>file &&
+ git commit -a -m "Change incomplete line" &&
+ git tag incomplete_lines_chg
+ echo "Dominus regit me," >file &&
+ git commit -a -m "Remove incomplete line" &&
+ git tag incomplete_lines_rem
+'
+
+test_expect_success 'commitdiff(1): addition of incomplete line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add"
+'
+
+test_expect_success 'commitdiff(1): incomplete line as context line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx"
+'
+
+test_expect_success 'commitdiff(1): change incomplete line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg"
+'
+
+test_expect_success 'commitdiff(1): removal of incomplete line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem"
+'
+
+# ----------------------------------------------------------------------
# commit, commitdiff: merge, large
test_expect_success \
'Create a merge' \
--
1.7.6
^ permalink raw reply related
* [PATCHv3 6/8] t9500: Add basic sanity tests for side-by-side diff in gitweb
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
Test that side-by-side diff can deal with incomplete lines (and while
at it with pure addition, pure removal, and change), and with merge
commits, producing no errors or warnings.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch is new in this version.
Note this while it does not check if the output is sane, it can help
with manual check; just run test with `--debug' option, and point
gitweb to "t/trash\ directory.t9500-gitweb-standalone-no-errors/.git/"
repository.
t/t9500-gitweb-standalone-no-errors.sh | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index c731507..ab24917 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -329,7 +329,8 @@ test_expect_success \
git add b &&
git commit -a -m "On branch" &&
git checkout master &&
- git pull . b'
+ git pull . b &&
+ git tag merge_commit'
test_expect_success \
'commit(0): merge commit' \
@@ -379,6 +380,29 @@ test_expect_success \
'gitweb_run "p=.git;a=commitdiff;h=b"'
# ----------------------------------------------------------------------
+# side-by-side diff
+
+test_expect_success 'side-by-side: addition of incomplete line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add;ds=sidebyside"
+'
+
+test_expect_success 'side-by-side: incomplete line as context line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx;ds=sidebyside"
+'
+
+test_expect_success 'side-by-side: changed incomplete line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg;ds=sidebyside"
+'
+
+test_expect_success 'side-by-side: removal of incomplete line' '
+ gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem;ds=sidebyside"
+'
+
+test_expect_success 'side-by-side: merge commit' '
+ gitweb_run "p=.git;a=commitdiff;h=merge_commit;ds=sidebyside"
+'
+
+# ----------------------------------------------------------------------
# tags testing
test_expect_success \
--
1.7.6
^ permalink raw reply related
* [PATCHv3 7/8] gitweb: Use href(-replay=>1,...) for formats links in "commitdiff"
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
Use href(-replay->1,...) in (sub)navigation links (like changing style
of view, or going to parent commit) so that extra options are
preserved.
This is needed so clicking on such (sub)navigation link would preserve
style of diff; for example when using "side-by-side" diff style then
going to parent commit would now also use this style.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch is new in this series, and independent on side-by-side stuff.
It can (and perhaps should) be moved earlier in this series.
gitweb/gitweb.perl | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f69ed08..ffaea45 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -7267,8 +7267,8 @@ sub git_commitdiff {
}
}
$formats_nav .= ': ' .
- $cgi->a({-href => href(action=>"commitdiff",
- hash=>$hash_parent)},
+ $cgi->a({-href => href(-replay=>1,
+ hash=>$hash_parent, hash_base=>undef)},
esc_html($hash_parent_short)) .
')';
} elsif (!$co{'parent'}) {
@@ -7278,28 +7278,28 @@ sub git_commitdiff {
# single parent commit
$formats_nav .=
' (parent: ' .
- $cgi->a({-href => href(action=>"commitdiff",
- hash=>$co{'parent'})},
+ $cgi->a({-href => href(-replay=>1,
+ hash=>$co{'parent'}, hash_base=>undef)},
esc_html(substr($co{'parent'}, 0, 7))) .
')';
} else {
# merge commit
if ($hash_parent eq '--cc') {
$formats_nav .= ' | ' .
- $cgi->a({-href => href(action=>"commitdiff",
+ $cgi->a({-href => href(-replay=>1,
hash=>$hash, hash_parent=>'-c')},
'combined');
} else { # $hash_parent eq '-c'
$formats_nav .= ' | ' .
- $cgi->a({-href => href(action=>"commitdiff",
+ $cgi->a({-href => href(-replay=>1,
hash=>$hash, hash_parent=>'--cc')},
'compact');
}
$formats_nav .=
' (merge: ' .
join(' ', map {
- $cgi->a({-href => href(action=>"commitdiff",
- hash=>$_)},
+ $cgi->a({-href => href(-replay=>1,
+ hash=>$_, hash_base=>undef)},
esc_html(substr($_, 0, 7)));
} @{$co{'parents'}} ) .
')';
--
1.7.6
^ permalink raw reply related
* [PATCHv3 8/8] gitweb: Add navigation to select side-by-side diff
From: Jakub Narebski @ 2011-10-30 23:36 UTC (permalink / raw)
To: git; +Cc: Kato Kazuyoshi, Jakub Narebski
In-Reply-To: <1320017787-18048-1-git-send-email-jnareb@gmail.com>
From: Kato Kazuyoshi <kato.kazuyoshi@gmail.com>
Add to the lower part of navigation bar (the action specific part)
links allowing to switch between 'inline' (ordinary) diff and
'side by side' style diff.
It is not shown for combined / compact combined diff.
Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch was originally part of other commit, but was split into a
separate patch.
Note that "blobdiff" should probably also get this navigation.
gitweb/gitweb.perl | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ffaea45..f80f259 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -7164,6 +7164,7 @@ sub git_blobdiff {
my $formats_nav =
$cgi->a({-href => href(action=>"blobdiff_plain", -replay=>1)},
"raw");
+ $formats_nav .= diff_style_nav($diff_style);
git_header_html(undef, $expires);
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
@@ -7221,6 +7222,27 @@ sub git_blobdiff_plain {
git_blobdiff('plain');
}
+# assumes that it is added as later part of already existing navigation,
+# so it returns "| foo | bar" rather than just "foo | bar"
+sub diff_style_nav {
+ my ($diff_style, $is_combined) = @_;
+ $diff_style ||= 'inline';
+
+ return "" if ($is_combined);
+
+ my @styles = (inline => 'inline', 'sidebyside' => 'side by side');
+ my %styles = @styles;
+ @styles =
+ @styles[ map { $_ * 2 } 0..$#styles/2 ];
+
+ return join '',
+ map { " | ".$_ }
+ map {
+ $_ eq $diff_style ? $styles{$_} :
+ $cgi->a({-href => href(-replay=>1, diff_style => $_)}, $styles{$_})
+ } @styles;
+}
+
sub git_commitdiff {
my %params = @_;
my $format = $params{-format} || 'html';
@@ -7250,6 +7272,7 @@ sub git_commitdiff {
$cgi->a({-href => href(action=>"patch", -replay=>1)},
"patch");
}
+ $formats_nav .= diff_style_nav($diff_style, @{$co{'parents'}} > 1);
if (defined $hash_parent &&
$hash_parent ne '-c' && $hash_parent ne '--cc') {
--
1.7.6
^ permalink raw reply related
* Re: [PATCH/WIP 03/11] t5403: avoid doing "git add foo/bar" where foo/.git exists
From: Junio C Hamano @ 2011-10-30 23:47 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <CACsJy8Ae1MPYzjoouZoFCU6Ltr9UznukfuTrJb=OUJYr9VTYSg@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>> We however *do* know that our working tree is our current directory, so
>> it would be wrong to do this:
>>
>> $ GIT_DIR=clone2/.git git add clone2/2 3; echo $?
>> error: 3 is outside our repository, possibly goverened by .git
>> 1
>>
>> The command should just add clone2/2 and 3 as it was told to.
>
> I am concerned about clone2/2 in this case, not 3. ...
Hmm... If that is the case, I am afraid that I failed to convey my point
in the previous message.
You are concerned about clone2/2 because you think GIT_DIR=clone2/.git
somehow implies that clone2/2 is a file at the toplevel of some repository
that should appear at "2" not at "clone2/2" in the index, no?
If that is the case, it means you are somehow getting the notion that
GIT_WORK_TREE is set to clone2 even though in the example we are
discussing it is _not_. Which in turn would mean "3" that is outside of
that directory should not even get into the picture.
In other words, the wish to register clone2/2 at "2" in the index by
stripping clone2/ and the wish to reject "3" as outside because it is
impossible to strip clone2/ from it are the same thing. You either should
be worrying about _both_ paths, or neither of them.
And I am saying that you should be worried about neither of them in this
case. GIT_DIR=<some where> without GIT_WORK_TREE set has treated the
current directory as the top of the working tree from the beginning of
time, and both clone2/2 and 3 _should_ appear in the index in this
example, which is $GIT_DIR/index, which happens to be at a confusing
location that is clone2/.git/index.
> ... I guess we can
> check if clone2/.git is the repo we are using. If it is, skip it.
^ permalink raw reply
* Re: [PATCH] Fix a typo in line 117 of git-gui/lib/sshkeys.tcl.
From: Erik Faye-Lund @ 2011-10-30 23:57 UTC (permalink / raw)
To: Dejan Ribič; +Cc: Git ML
In-Reply-To: <1319995124-7509-1-git-send-email-dejan.ribic@gmail.com>
Thanks for re-posting inline and with a sign-off. But there's still a
few minor nits:
2011/10/30 Dejan Ribič <dejan.ribic@gmail.com>:
> "succeded" changed to "succeeded".
We write commit messages in imperative mood, so this should be
something like 'change "succeded" to "succeeded"' instead. This is
documented in Documentation/SubmittingPatches.
> modified: git-gui/lib/sshkey.tcl
We don't normally include a list of changed files in the commit
message; the diffstat already provides that information.
^ permalink raw reply
* New Feature wanted: Is it possible to let git clone continue last break point?
From: netroby @ 2011-10-31 2:28 UTC (permalink / raw)
To: Git Mail List
In-Reply-To: <CAEZo+gfKVY-YgMjd=bEYzRV4-460kqDik-yVcQ9Xs=DoCZOMDg@mail.gmail.com>
Is it possible to let git clone continue last break point.
when we git clone very large project from the web, we may face some
interupt, then we must clone it from zero .
it is bad feeling for low connection speed users.
please help us out.
we need git clone continue last break point
netroby
----------------------------------
http://www.netroby.com
^ permalink raw reply
* Re: New Feature wanted: Is it possible to let git clone continue last break point?
From: Tay Ray Chuan @ 2011-10-31 4:00 UTC (permalink / raw)
To: netroby; +Cc: Git Mail List
In-Reply-To: <CAEZo+gcj5q2UYnak1+1UG7pPzoeaUr=QLsiCiNXbC_n+JQbKQQ@mail.gmail.com>
This is a hard problem that hasn't been solved. Year after year, it's
a GSoC proposal...
What you can do is use --depth 1 with your git-clone; then "extend"
the depth incrementally.
-- Cheers,Ray Chuan
On Mon, Oct 31, 2011 at 10:28 AM, netroby <hufeng1987@gmail.com> wrote:
> Is it possible to let git clone continue last break point.
> when we git clone very large project from the web, we may face some
> interupt, then we must clone it from zero .
>
> it is bad feeling for low connection speed users.
>
> please help us out.
>
> we need git clone continue last break point
>
> netroby
> ----------------------------------
> http://www.netroby.com
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH] document 'T' status from git-status
From: Junio C Hamano @ 2011-10-31 4:18 UTC (permalink / raw)
To: Mark Dominus; +Cc: git, Mark Dominus
In-Reply-To: <4EADB4DB.5020004@icgroup.com>
Mark Dominus <mjd@icgroup.com> writes:
>> The current organization of this table may need to be rethought, but if we
>> were to keep it, then this change is far from sufficient. For example, you
>> do not explain what XY = TT means.
> Thanks for your response.
>
> I did not try to document that because in my experimenting I was not
> able to produce that situation.
It is trivial if you realize that X is the change between the HEAD and the
index, and Y is the change between the index and the working tree. Most
importantly, no direct comparison between the HEAD and the working tree
gets in the picture.
$ mv COPYING RENAMING
$ ln -s RENAMING COPYING
$ git add COPYING
$ mv RENAMING COPYING
$ git status -suno
TT COPYING
> Will you be applying the alternative patch you suggested, or would you
> prefer that I try to produce one along those lines?
I dunno.
An obvious alternative is to add T next to all occurrences of M in the
table where we say "M is possible", but unless it is accompanied by an
explanation "T is just a special case of M", I suspect the resulting
description would be harder to understand than currently is, and as long
as the reader understands "T is just a special case of M", then there
isn't much point adding T everywhere M appears in the table anyway, so...
^ permalink raw reply
* [ANNOUNCE] Git 1.7.8.rc0
From: Junio C Hamano @ 2011-10-31 5:00 UTC (permalink / raw)
To: git; +Cc: Linux Kernel
A release candidate Git 1.7.8.rc0 is available for testing.
The release tarballs are found at:
http://code.google.com/p/git-core/downloads/list
and their SHA-1 checksums are:
4c437ecb17ba7d1b69cecd06eae9543ad35be7a6 git-1.7.8.rc0.tar.gz
5fc490a7ab29bf020a8f46eecfdb421d970b6235 git-htmldocs-1.7.8.rc0.tar.gz
856259f71c10b21620caa27dbc74c3794f0c6854 git-manpages-1.7.8.rc0.tar.gz
Also the following public repositories all have a copy of the v1.7.8.rc0
tag and the master branch that the tag points at:
url = git://repo.or.cz/alt-git.git
url = https://code.google.com/p/git-core/
url = git://git.sourceforge.jp/gitroot/git-core/git.git
url = git://git-core.git.sourceforge.net/gitroot/git-core/git-core
url = https://github.com/gitster/git
There are a few topics that I would further merge down before -rc1 but
this should be pretty much it for the upcoming release, as far as "new
features" are concerned. Please test thoroughly to hunt for regressions.
Hopefully we can have something reasonable by late November before many in
the US will stop working and start stuffing themselves.
Git v1.7.8 Release Notes (draft)
================================
Updates since v1.7.7
--------------------
* Some git-svn, git-gui, git-p4 (in contrib) and msysgit updates.
* Updates to bash completion scripts.
* The build procedure has been taught to take advantage of computed
dependency automatically when the complier supports it.
* The date parser now accepts timezone designators that lack minutes
part and also has a colon between "hh:mm".
* The contents of the /etc/mailname file, if exists, is used as the
default value of the hostname part of the committer/author e-mail.
* "git am" learned how to read from patches generated by Hg.
* "git archive" talking with a remote repository can report errors
from the remote side in a more informative way.
* "git branch" learned an explicit --list option to ask for branches
listed, optionally with a glob matching pattern to limit its output.
* "git check-attr" learned "--cached" option to look at .gitattributes
files from the index, not from the working tree.
* Variants of "git cherry-pick" and "git revert" that take multiple
commits learned to "--continue".
* "git daemon" gives more human readble error messages to clients
using ERR packets when appropriate.
* Errors at the network layer is logged by "git daemon".
* "git diff" learned "--minimal" option to spend extra cycles to come
up with a minimal patch output.
* "git diff" learned "--function-context" option to show the whole
function as context that was affected by a change.
* "git difftool" can be told to skip launching the tool for a path by
answering 'n' to its prompt.
* "git fetch" learned to honor transfer.fsckobjects configuration to
validate the objects that were received from the other end, just like
"git receive-pack" (the receiving end of "git push") does.
* "git fetch" makes sure that the set of objects it received from the
other end actually completes the history before updating the refs.
"git receive-pack" (the receiving end of "git push") learned to do the
same.
* "git fetch" learned that fetching/cloning from a regular file on the
filesystem is not necessarily a request to unpack a bundle file; the
file could be ".git" with "gitdir: <path>" in it.
* "git for-each-ref" learned "%(contents:subject)", "%(contents:body)"
and "%(contents:signature)". The last one is useful for signed tags.
* "git grep" used to incorrectly pay attention to .gitignore files
scattered in the directory it was working in even when "--no-index"
option was used. It no longer does this. The "--exclude-standard"
option needs to be given to explicitly activate the ignore
mechanism.
* "git grep" learned "--untracked" option, where given patterns are
searched in untracked (but not ignored) files as well as tracked
files in the working tree, so that matches in new but not yet
added files do not get missed.
* The recursive merge backend no longer looks for meaningless
existing merges in submodules unless in the outermost merge.
* "git log" and friends learned "--children" option.
* "git ls-remote" learned to respond to "-h"(elp) requests.
* "git merge" learned the "--edit" option to allow users to edit the
merge commit log message.
* "git rebase -i" can be told to use special purpose editor suitable
only for its insn sheet via sequence.editor configuration variable.
* "git send-email" learned to respond to "-h"(elp) requests.
* "git send-email" allows the value given to sendemail.aliasfile to begin
with "~/" to refer to the $HOME directory.
* "git send-email" forces use of Authen::SASL::Perl to work around
issues between Authen::SASL::Cyrus and AUTH PLAIN/LOGIN.
* "git stash" learned "--include-untracked" option to stash away
untracked/ignored cruft from the working tree.
* "git submodule clone" does not leak an error message to the UI
level unnecessarily anymore.
* "git submodule update" learned to honor "none" as the value for
submodule.<name>.update to specify that the named submodule should
not be checked out by default.
* When populating a new submodule directory with "git submodule init",
the $GIT_DIR metainformation directory for submodules is created inside
$GIT_DIR/modules/<name>/ directory of the superproject and referenced
via the gitfile mechanism. This is to make it possible to switch
between commits in the superproject that has and does not have the
submodule in the tree without re-cloning.
* "mediawiki" remote helper can interact with (surprise!) MediaWiki
with "git fetch" & "git push".
* "gitweb" leaked unescaped control characters from syntax hiliter
outputs.
* "gitweb" can be told to give custom string at the end of the HTML
HEAD element.
* "gitweb" now has its own manual pages.
Also contains other documentation updates and minor code cleanups.
Fixes since v1.7.7
------------------
Unless otherwise noted, all fixes in the 1.7.7.X maintenance track are
included in this release.
* We used to drop error messages from libcurl on certain kinds of
errors.
(merge be22d92eac8 jn/maint-http-error-message later to maint).
* Error report from smart HTTP transport, when the connection was
broken in the middle of a transfer, showed a useless message on
a corrupt packet.
(merge 6cdf022 sp/smart-http-failure later to maint).
* HTTP transport did not use pushurl correctly, and also did not tell
what host it is trying to authenticate with when asking for
credentials.
(merge deba493 jk/http-auth later to maint).
* "git branch -m/-M" advertised to update RENAME_REF ref in the
commit log message that introduced the feature but not anywhere in
the documentation, and never did update such a ref anyway. This
undocumented misfeature that did not exist has been excised.
(merge b0eab01 jc/maint-remove-renamed-ref later to maint).
* Adding many refs to the local repository in one go (e.g. "git fetch"
that fetches many tags) and looking up a ref by name in a repository
with too many refs were unnecessarily slow.
(merge 17d68a54d jp/get-ref-dir-unsorted later to maint).
* "git fetch --prune" was unsafe when used with refspecs from the
command line.
(merge e8c1e6c cn/fetch-prune later to maint).
* Report from "git commit" on untracked files was confused under
core.ignorecase option.
(merge 2548183b jk/name-hash-dirent later to maint).
* The attribute mechanism did not use case insensitive match when
core.ignorecase was set.
(merge 6eba621 bc/attr-ignore-case later to maint).
* "git bisect" did not notice when it failed to update the working tree
to the next commit to be tested.
(merge 1acf11717 js/bisect-no-checkout later to maint).
* "git config --bool --get-regexp" failed to separate the variable name
and its value "true" when the variable is defined without "= true".
(merge 880e3cc mm/maint-config-explicit-bool-display later to maint).
* "git remote rename $a $b" were not careful to match the remote name
against $a (i.e. source side of the remote nickname).
(merge b52d00aed mz/remote-rename later to maint).
* "git diff --[num]stat" used to use the number of lines of context
different from the default, potentially giving different results from
"git diff | diffstat" and confusing the users.
(merge f01cae918 jc/maint-diffstat-numstat-context later to maint).
* "git merge" did not understand ":/<pattern>" as a way to name a commit.
* "git mergetool" learned to use its arguments as pathspec, not a path to
the file that may not even have any conflict.
(merge 6d9990a jm/mergetool-pathspec later to maint).
* "git pull" and "git rebase" did not work well even when GIT_WORK_TREE is
set correctly with GIT_DIR if the current directory is outside the working
tree.
(merge 035b5bf jk/pull-rebase-with-work-tree later to maint).
" "git push" on the receiving end used to call post-receive and post-update
hooks for attempted removal of non-existing refs.
(merge 160b81ed ph/push-to-delete-nothing later to maint).
* "git send-email" did not honor the configured hostname when restarting
the HELO/EHLO exchange after switching TLS on.
(merge 155b940 md/smtp-tls-hello-again later to maint).
* "gitweb" used to produce a non-working link while showing the contents
of a blob, when JavaScript actions are enabled.
(merge 2b07ff3ff ps/gitweb-js-with-lineno later to maint).
* The logic to filter out forked projects in the project list in
"gitweb" was broken for some time.
(merge 53c632f jm/maint-gitweb-filter-forks-fix later to maint).
----------------------------------------------------------------
Changes since v1.7.7 are as follows:
Bert Wesarg (7):
grep: do not use --index in the short usage output
grep --no-index: don't use git standard exclusions
git-gui: search and linenumber input are mutual exclusive in the blame view
git-gui: only accept numbers in the goto-line input
git-gui: clear the goto line input when hiding
git-gui: incremental goto line in blame view
grep: fix the error message that mentions --exclude
Brad King (3):
rev-list: Demonstrate breakage with --ancestry-path --all
submodule: Demonstrate known breakage during recursive merge
submodule: Search for merges only at end of recursive merge
Brandon Casey (13):
t/t3905: use the name 'actual' for test output, swap arguments to test_cmp
git-stash.sh: fix typo in error message
t/t3905: add missing '&&' linkage
git-stash: remove untracked/ignored directories when stashed
attr.c: avoid inappropriate access to strbuf "buf" member
cleanup: use internal memory allocation wrapper functions everywhere
builtin/mv.c: plug miniscule memory leak
refs.c: ensure struct whose member may be passed to realloc is initialized
refs.c: abort ref search if ref array is empty
refs.c: free duplicate entries in the ref array instead of leaking them
attr.c: respect core.ignorecase when matching attribute patterns
strbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()
t/t3000-ls-files-others.sh: use $SHELL_PATH to run git-new-workdir script
Carlos Martín Nieto (7):
Remove 'working copy' from the documentation and C code
fetch: free all the additional refspecs
t5510: add tests for fetch --prune
remote: separate out the remote_find_tracking logic into query_refspecs
fetch: honor the user-provided refspecs when pruning refs
fetch: treat --tags like refs/tags/*:refs/tags/* when pruning
Documentation: update [section.subsection] to reflect what git does
Chris Packham (1):
git-web--browse: avoid the use of eval
Christian Couder (1):
bisect: fix exiting when checkout failed in bisect_start()
Christoffer Pettersson (1):
git-gui: Corrected a typo in the Swedish translation of 'Continue'
Clemens Buchacher (5):
remove prefix argument from pathspec_prefix
rename pathspec_prefix() to common_prefix() and move to dir.[ch]
send-email: add option -h
use -h for synopsis and --help for manpage consistently
use test number as port number
Cord Seele (3):
Add Git::config_path()
use new Git::config_path() for aliasesfile
send-email: Fix %config_path_settings handling
Dan McGee (2):
tree-walk: drop unused parameter from match_dir_prefix
tree-walk: micro-optimization in tree_entry_interesting
David Aguilar (1):
Makefile: Improve compiler header dependency check
David Fries (2):
git-gui: Enable jumping to a specific line number in blame view.
git-gui: Add keyboard shortcuts for search and goto commands in blame view.
Dmitry Ivankov (3):
Fix typo: existant->existent
fast-import: don't allow to tag empty branch
fast-import: don't allow to note on empty branch
Drew Northup (1):
gitweb: Add gitweb.conf(5) manpage for gitweb configuration files
Erik Faye-Lund (2):
enter_repo: do not modify input
mingw: avoid using strbuf in syslog
Fredrik Gustafsson (2):
rev-parse: add option --resolve-git-dir <path>
Move git-dir for submodules
Fredrik Kuivinen (1):
Makefile: Use computed header dependencies if the compiler supports it
Frédéric Heitzmann (1):
git svn dcommit: new option --interactive.
Giuseppe Bilotta (1):
am: preliminary support for hg patches
Haitao Li (1):
date.c: Support iso8601 timezone formats
Heiko Voigt (4):
git-gui: warn when trying to commit on a detached head
submodule: move update configuration variable further up
add update 'none' flag to disable update of submodule by default
git-gui: deal with unknown files when pressing the "Stage Changed" button
Hui Wang (1):
sha1_file: normalize alt_odb path before comparing and storing
Ilari Liusvaara (1):
Support ERR in remote archive like in fetch/push
Jakub Narebski (6):
gitweb: Strip non-printable characters from syntax highlighter output
gitweb: Add gitweb(1) manpage for gitweb itself
Documentation: Link to gitweb(1) and gitweb.conf(5) in other manpages
Documentation: Add gitweb config variables to git-config(1)
gitweb: Add gitweb manpages to 'gitweb' package in git.spec
Add simple test for Git::config_path() in t/t9700-perl-git.sh
Jay Soffian (6):
Teach '--cached' option to check-attr
log --children
merge-one-file: fix "expr: non-numeric argument"
revert.c: defer writing CHERRY_PICK_HEAD till it is safe to do so
cherry-pick: do not give irrelevant advice when cherry-pick punted
Teach merge the '[-e|--edit]' option
Jeff King (30):
url: decode buffers that are not NUL-terminated
improve httpd auth tests
remote-curl: don't retry auth failures with dumb protocol
http: retry authentication failures for all http requests
t7004: factor out gpg setup
t6300: add more body-parsing tests
for-each-ref: refactor subject and body placeholder parsing
for-each-ref: handle multiline subjects like --pretty
fetch: avoid quadratic loop checking for updated submodules
t3200: clean up checks for file existence
add sha1_array API docs
quote.h: fix bogus comment
refactor argv_array into generic code
quote: provide sq_dequote_to_argv_array
bisect: use argv_array API
checkout: use argv_array API
run_hook: use argv_array API
filter-branch: use require_clean_work_tree
fix phantom untracked files when core.ignorecase is set
t1300: put git invocations inside test function
t1300: test mixed-case variable retrieval
pull,rebase: handle GIT_WORK_TREE better
pack-objects: protect against disappearing packs
downgrade "packfile cannot be accessed" errors to warnings
daemon: give friendlier error messages to clients
http_init: accept separate URL parameter
contrib: add diff highlight script
tests: add missing executable bits
contrib: add git-jump script
completion: match ctags symbol names in grep patterns
Jeremie Nikaes (1):
Add a remote helper to interact with mediawiki (fetch & push)
Jim Meyering (2):
fix "git apply --index ..." not to deref NULL
make the sample pre-commit hook script reject names with newlines, too
Johannes Schindelin (5):
Fix is_gitfile() for files too small or larger than PATH_MAX to be a gitfile
t1020: disable the pwd test on MinGW
t9001: do not fail only due to CR/LF issues
t9300: do not run --cat-blob-fd related tests on MinGW
git grep: be careful to use mutexes only when they are initialized
Johannes Sixt (2):
t1402-check-ref-format: skip tests of refs beginning with slash on Windows
t1300: attempting to remove a non-existent .git/config is not an error
Jonathan Nieder (7):
http: remove extra newline in error message
http: avoid empty error messages for some curl errors
ident: check /etc/mailname if email is unknown
Makefile: do not set setgid bit on directories on GNU/kFreeBSD
ident: do not retrieve default ident when unnecessary
Makefile: fix permissions of mergetools/ checked out with permissive umask
RelNotes/1.7.7.1: setgid bit patch is about fixing "git init" via Makefile setting
Jonathon Mah (1):
mergetool: Use args as pathspec to unmerged files
Julian Phillips (2):
Don't sort ref_list too early
refs: Use binary search to lookup refs faster
Julien Muchembled (1):
gitweb: fix regression when filtering out forks
Junio C Hamano (66):
rev-list: fix finish_object() call
revision.c: add show_object_with_name() helper function
revision.c: update show_object_with_name() without using malloc()
revision: keep track of the end-user input from the command line
revision: do not include sibling history in --ancestry-path output
rebase -i: notice and warn if "exec $cmd" modifies the index or the working tree
traverse_trees(): allow pruning with pathspec
unpack-trees: allow pruning with pathspec
diff-index: pass pathspec down to unpack-trees machinery
list-objects: pass callback data to show_objects()
rev-list --verify-object
fetch: verify we have everything we need before updating our ref
fetch.fsckobjects: verify downloaded objects
transfer.fsckobjects: unify fetch/receive.fsckobjects
test: fetch/receive with fsckobjects
consolidate pathspec_prefix and common_prefix
fetch: verify we have everything we need before updating our ref
check_everything_connected(): refactor to use an iterator
check_everything_connected(): libify
receive-pack: check connectivity before concluding "git push"
builtin/revert.c: make commit_list_append() static
refs.c: make create_cached_refs() static
fsck: do not abort upon finding an empty blob
send-pack: typofix error message
refactor run_receive_hook()
rename "match_refs()" to "match_push_refs()"
Allow git merge ":/<pattern>"
ls-remote: a lone "-h" is asking for help
Teach progress eye-candy to fetch_refs_from_bundle()
diff: teach --stat/--numstat to honor -U$num
t0003: remove extra whitespaces
mergetool: no longer need to save standard input
apply --whitespace=error: correctly report new blank lines at end
parse-options: deprecate OPT_BOOLEAN
archive.c: use OPT_BOOL()
checkout $tree $path: do not clobber local changes in $path not in $tree
url.c: simplify is_url()
diff: resurrect XDF_NEED_MINIMAL with --minimal
grep: teach --untracked and --exclude-standard options
Post 1.7.7 first wave
attr: read core.attributesfile from git_default_core_config
Update draft release notes to 1.7.8
branch -m/-M: remove undocumented RENAMED-REF
refs.c: move dwim_ref()/dwim_log() from sha1_name.c
Update draft release notes to 1.7.8
bundle: allowing to read from an unseekable fd
bundle: add parse_bundle_header() helper function
Update draft release notes to 1.7.8
t7800: avoid arithmetic expansion notation
Prepare for 1.7.7.1
Update draft release notes to 1.7.8
resolve_gitlink_packed_ref(): fix mismerge
Update draft release notes to 1.7.8
Makefile: ask "ls-files" to list source files if available
libperl-git: refactor Git::config_*
Update draft release notes to 1.7.8
resolve_ref(): expose REF_ISBROKEN flag
resolve_ref(): report breakage to the caller without warning
Almost ready for 1.7.7.1
Update draft release notes to 1.7.8
Git 1.7.7.1
builtin/grep: make lock/unlock into static inline functions
builtin/grep: simplify lock_and_read_sha1_file()
Update draft release notes to 1.7.8
Update draft release notes to 1.7.8
Git 1.7.8-rc0
Luke Diamand (1):
git-p4: handle files with shell metacharacters
Lénaïc Huard (1):
gitweb: provide a way to customize html headers
Martin von Zweigbergk (4):
remote: write correct fetch spec when renaming remote 'remote'
remote: "rename o foo" should not rename ref "origin/bar"
remote rename: warn when refspec was not updated
remote: only update remote-tracking branch if updating refspec
Matthew Daley (1):
send-email: Honour SMTP domain when using TLS
Matthieu Moy (8):
rebase -i: clean error message for --continue after failed exec
git-remote-mediawiki: allow push to set MediaWiki metadata
git-remote-mediawiki: trivial fixes
git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts
git-remote-mediawiki: obey advice.pushNonFastForward
git-remote-mediawiki: allow a domain to be set for authentication
config: display key_delim for config --bool --get-regexp
git-remote-mediawiki: don't include HTTP login/password in author
Michael Haggerty (37):
Extract a function clear_cached_refs()
Access reference caches only through new function get_cached_refs()
Change the signature of read_packed_refs()
Allocate cached_refs objects dynamically
Store the submodule name in struct cached_refs
Retain caches of submodule refs
notes_merge_commit(): do not pass temporary buffer to other function
get_sha1_hex(): do not read past a NUL character
t1402: add some more tests
git check-ref-format: add options --allow-onelevel and --refspec-pattern
Change bad_ref_char() to return a boolean value
Change check_ref_format() to take a flags argument
Refactor check_refname_format()
Do not allow ".lock" at the end of any refname component
Make collapse_slashes() allocate memory for its result
Inline function refname_format_print()
Change check_refname_format() to reject unnormalized refnames
resolve_ref(): explicitly fail if a symlink is not readable
resolve_ref(): use prefixcmp()
resolve_ref(): only follow a symlink that contains a valid, normalized refname
resolve_ref(): turn buffer into a proper string as soon as possible
resolve_ref(): extract a function get_packed_ref()
resolve_ref(): do not follow incorrectly-formatted symbolic refs
remote: use xstrdup() instead of strdup()
remote: avoid passing NULL to read_ref()
resolve_ref(): verify that the input refname has the right format
resolve_ref(): emit warnings for improperly-formatted references
resolve_ref(): also treat a too-long SHA1 as invalid
resolve_ref(): expand documentation
add_ref(): verify that the refname is formatted correctly
invalidate_ref_cache(): rename function from invalidate_cached_refs()
invalidate_ref_cache(): take the submodule as parameter
invalidate_ref_cache(): expose this function in the refs API
clear_ref_cache(): rename parameter
clear_ref_cache(): extract two new functions
write_ref_sha1(): only invalidate the loose ref cache
clear_ref_cache(): inline function
Michael J Gruber (10):
t6040: test branch -vv
git-tag: introduce long forms for the options
git-branch: introduce missing long forms for the options
branch: introduce --list option
branch: allow pattern arguments
branch: -v does not automatically imply --list
unpack-trees: print "Aborting" to stderr
git-read-tree.txt: language and typography fixes
git-read-tree.txt: correct sparse-checkout and skip-worktree description
http: use hostname in credential description
Michael Schubert (1):
patch-id.c: use strbuf instead of a fixed buffer
Michael W. Olson (1):
git-svn: Allow certain refs to be ignored
Michał Górny (1):
for-each-ref: add split message parts to %(contents:*).
Nguyễn Thái Ngọc Duy (12):
merge: keep stash[] a local variable
merge: use return value of resolve_ref() to determine if HEAD is invalid
merge: remove global variable head[]
Accept tags in HEAD or MERGE_HEAD
sparse checkout: show error messages when worktree shaping fails
Add explanation why we do not allow to sparse checkout to empty working tree
git-read-tree.txt: update sparse checkout examples
pack-protocol: document "ERR" line
daemon: return "access denied" if a service is not allowed
daemon: log errors if we could not use some sockets
t5403: convert leading spaces to tabs
Reindent closing bracket using tab instead of spaces
Nicolas Morey-Chaisemartin (1):
grep: Fix race condition in delta_base_cache
Pang Yan Han (1):
receive-pack: don't pass non-existent refs to post-{receive,update} hooks
Pat Thoyts (6):
git-gui: updated translator README for current procedures.
Fix tooltip display with multiple monitors on windows.
git-gui: drop the 'n' and 'Shift-n' bindings from the last patch.
mergetools: use the correct tool for Beyond Compare 3 on Windows
mingw: ensure sockets are initialized before calling gethostname
t9901: fix line-ending dependency on windows
Pete Wyckoff (5):
git-p4 tests: refactor and cleanup
git-p4: handle utf16 filetype properly
git-p4: recognize all p4 filetypes
git-p4: stop ignoring apple filetype
git-p4: keyword flattening fixes
Peter Oberndorfer (1):
"rebase -i": support special-purpose editor to edit insn sheet
Peter Stuge (1):
gitweb: Fix links to lines in blobs when javascript-actions are enabled
Phil Hord (3):
Learn to handle gitfiles in enter_repo
Teach transport about the gitfile mechanism
Add test showing git-fetch groks gitfiles
Ramkumar Ramachandra (18):
advice: Introduce error_resolve_conflict
config: Introduce functions to write non-standard file
revert: Simplify and inline add_message_to_msg
revert: Don't check lone argument in get_encoding
revert: Rename no_replay to record_origin
revert: Eliminate global "commit" variable
revert: Introduce struct to keep command-line options
revert: Separate cmdline parsing from functional code
revert: Don't create invalid replay_opts in parse_args
revert: Save data for continuing after conflict resolution
revert: Save command-line options for continuing operation
revert: Make pick_commits functionally act on a commit list
revert: Introduce --reset to remove sequencer state
reset: Make reset remove the sequencer state
revert: Remove sequencer state when no commits are pending
revert: Don't implicitly stomp pending sequencer operation
revert: Introduce --continue to continue the operation
revert: Propagate errors upwards from do_pick_commit
Ramsay Allan Jones (6):
Makefile: Make dependency directory creation less noisy
sparse: Fix an "Using plain integer as NULL pointer" warning
obstack.c: Fix some sparse warnings
t9159-*.sh: skip for mergeinfo test for svn <= 1.4
Fix some "variable might be used uninitialized" warnings
gitweb/Makefile: Remove static/gitweb.js in the clean target
René Scharfe (26):
Revert removal of multi-match discard heuristic in 27af01
parseopt: add OPT_NOOP_NOARG
revert: use OPT_NOOP_NOARG
apply: use OPT_NOOP_NOARG
checkout: check for "Previous HEAD" notice in t2020
revision: factor out add_pending_sha1
checkout: use add_pending_{object,sha1} in orphan check
revision: add leak_pending flag
bisect: use leak_pending flag
bundle: use leak_pending flag
checkout: use leak_pending flag
commit: factor out clear_commit_marks_for_object_array
test-ctype: macrofy
test-ctype: add test for is_pathspec_magic
name-rev: split usage string
pickaxe: plug diff filespec leak with empty needle
pickaxe: plug regex leak
pickaxe: plug regex/kws leak
pickaxe: factor out has_changes
pickaxe: pass diff_options to contains and has_changes
pickaxe: give diff_grep the same signature as has_changes
pickaxe: factor out pickaxe
xdiff: factor out get_func_line()
diff: add option to show whole functions as context
t1304: fall back to $USER if $LOGNAME is not defined
read-cache.c: fix index memory allocation
Richard Hartmann (1):
clone: Quote user supplied path in a single quote pair
SZEDER Gábor (2):
completion: unite --reuse-message and --reedit-message for 'notes'
completion: unite --format and --pretty for 'log' and 'show'
Sebastian Schuberth (2):
git-svn: On MSYS, escape and quote SVN_SSH also if set by the user
inet_ntop.c: Work around GCC 4.6's detection of uninitialized variables
Shawn O. Pearce (1):
remote-curl: Fix warning after HTTP failure
Sitaram Chamarty (1):
git-difftool: allow skipping file by typing 'n' at prompt
Stefan Naewe (2):
Documentation/git-update-index: refer to 'ls-files'
completion: fix issue with process substitution not working on Git for Windows
Tay Ray Chuan (3):
fetch: plug two leaks on error exit in store_updated_refs
submodule: whitespace fix
submodule::module_clone(): silence die() message from module_name()
Teemu Matilainen (3):
completion: unite --reuse-message and --reedit-message handling
completion: commit --fixup and --squash
completion: push --set-upstream
Thomas Rast (3):
Symlink mergetools scriptlets into valgrind wrappers
Documentation: basic configuration of notes.rewriteRef
t6019: avoid refname collision on case-insensitive systems
Zbigniew Jędrzejewski-Szmek (1):
send-email: auth plain/login fix
^ permalink raw reply
* Re: git stash show doesn't show stashed untracked files
From: Kirill Likhodedov @ 2011-10-31 8:36 UTC (permalink / raw)
To: git
In-Reply-To: <5284251B-7265-493B-981D-DD10B80F85B1@jetbrains.com>
Resending: it seems that the message was lost in discussions.
>
> Git 1.7.7 introduced a very useful feature - stashing untracked files via "-u" option.
>
> However, there is a problems with it:
> 'git stash show' doesn't show stashed untracked files.
>
> # git version
> git version 1.7.7
> # touch untracked.txt
> # git stash save -u
> # git stash show // no output
>
> If changes in tracked files are stashed along with untracked files, then only tracked changes are shown in "git stash show" output.
>
> Moreover, if I have the same file in the working tree, I wouldn't be able to 'git stash pop':
> # git stash pop -v
> untracked.txt already exists, no checkout
> Could not restore untracked files from stash
>
> In this case the only way to access the stashed content is to remove the tracked file and pop the stash again.
>
^ permalink raw reply
* Re: [PATCH] Fix a typo in line 117 of git-gui/lib/sshkeys.tcl.
From: Pat Thoyts @ 2011-10-31 8:56 UTC (permalink / raw)
To: kusmabite; +Cc: Dejan Ribič, Git ML
In-Reply-To: <CABPQNSaLsS9P8hWMEBYVe4FEo5x11+J+pMw29NN+EF2siCO35w@mail.gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
>Thanks for re-posting inline and with a sign-off. But there's still a
>few minor nits:
>
>2011/10/30 Dejan Ribič <dejan.ribic@gmail.com>:
>> "succeded" changed to "succeeded".
>
>We write commit messages in imperative mood, so this should be
>something like 'change "succeded" to "succeeded"' instead. This is
>documented in Documentation/SubmittingPatches.
>
>> modified: git-gui/lib/sshkey.tcl
>
>We don't normally include a list of changed files in the commit
>message; the diffstat already provides that information.
>
The change is fine so I've applied this to the git-gui repository with a
fixed commit message. Thank you.
git-gui is hosted separately and merged into git-core at intervals so
the development version of git-gui is in fact hosted at
git://repo.or.cz/git-gui.git although patches against the git-core
version seldom pose a problem to apply and are gratefully received.
(git am -p2 usually fixes them).
--
Pat Thoyts http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
^ permalink raw reply
* Re: [git patches] libata updates, GPG signed (but see admin notes)
From: Ingo Molnar @ 2011-10-31 8:40 UTC (permalink / raw)
To: Linus Torvalds
Cc: James Bottomley, Jeff Garzik, Andrew Morton, linux-ide, LKML
In-Reply-To: <CA+55aFx1NGWfNJAKDTvZfsHDDKiEtS4t4RydSgHurBeyGPyhXg@mail.gmail.com>
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> That said, even the "BEGIN PGP SIGNED MESSAGE" things are a massive
> pain in the butt. We need to automate this some sane way, both for
> the sender and for the recipient.
The most practical form would be if Git supported such oneliner pull
requests:
git pull git://foo.com bar.branch \
--pull-sha1 0acf00014bcfd71090c3b0d43c98e970108064e4 \
--gpg-by: "Ingo Molnar <mingo@kernel.org>" \
--gpg-sig: 8a6f134afd1d212fe21345
maintainers could just paste them into a shell and it would abort if
it's not trusted. The maintainer verifies the visible, 'Ingo Molnar'
bit. The 8a6f134afd1d212fe21345 is a signed-by-Ingo-Molnar version of
this content:
git://foo.com bar.branch 0acf00014bcfd71090c3b0d43c98e970108064e4
And Git would verify that what ends up being pulled is indeed
0acf00014bcfd and also verifies that it was signed by me.
[ If we are extra diligent/paranoid then beyond the sha1 we might
even GPG sign the shortlog, or even the full raw log of all commits
leading to the sha1: this introduces some Git shortlog and patch
formatting version dependency though.
Git could also double check foo.com's DNS coherency, or check it
against a known-trusted whitelist of domain names specified in the
maintainer's .gitconfig, as an extra layer. ]
Doing it in this form would remove all the mail formatting madness -
one could paste such a pull request into a shell straight away, from
HTML email, from text email, from MIME email, etc.
In fact i would trust such a Git based solution far more than any
opaque, invisible tool that claims to have checked a signature with
cooperation of my mail client (ha!).
The only somewhat non-obvious bit is that Git should be *very*
careful about its key ID and signature parsing strategy, to protect
against social engineering attacks.
For example neither this:
--gpg-by: "Ingo Molnar <mingo@kernal.org>"
nor this:
--pgp-by: "Ingo Molnar <mingo@kernel.org>"
malicious pull request should slip through in any fashion:
- Git should only use keys that are in your ring of trust - not pull
keys from the public keyring automatically and just check
coherency of the pull request or such. [I'm sure people will be
tempted to have such a feature - but that temptation should be
resisted.]
- Git should abort the moment it sees an unknown option
Thanks,
Ingo
^ permalink raw reply
* Re: [git patches] libata updates, GPG signed (but see admin notes)
From: Ingo Molnar @ 2011-10-31 8:40 UTC (permalink / raw)
To: Linus Torvalds
Cc: James Bottomley, Jeff Garzik, Andrew Morton, linux-ide, LKML
In-Reply-To: <CA+55aFx1NGWfNJAKDTvZfsHDDKiEtS4t4RydSgHurBeyGPyhXg@mail.gmail.com>
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> That said, even the "BEGIN PGP SIGNED MESSAGE" things are a massive
> pain in the butt. We need to automate this some sane way, both for
> the sender and for the recipient.
The most practical form would be if Git supported such oneliner pull
requests:
git pull git://foo.com bar.branch \
--pull-sha1 0acf00014bcfd71090c3b0d43c98e970108064e4 \
--gpg-by: "Ingo Molnar <mingo@kernel.org>" \
--gpg-sig: 8a6f134afd1d212fe21345
maintainers could just paste them into a shell and it would abort if
it's not trusted. The maintainer verifies the visible, 'Ingo Molnar'
bit. The 8a6f134afd1d212fe21345 is a signed-by-Ingo-Molnar version of
this content:
git://foo.com bar.branch 0acf00014bcfd71090c3b0d43c98e970108064e4
And Git would verify that what ends up being pulled is indeed
0acf00014bcfd and also verifies that it was signed by me.
[ If we are extra diligent/paranoid then beyond the sha1 we might
even GPG sign the shortlog, or even the full raw log of all commits
leading to the sha1: this introduces some Git shortlog and patch
formatting version dependency though.
Git could also double check foo.com's DNS coherency, or check it
against a known-trusted whitelist of domain names specified in the
maintainer's .gitconfig, as an extra layer. ]
Doing it in this form would remove all the mail formatting madness -
one could paste such a pull request into a shell straight away, from
HTML email, from text email, from MIME email, etc.
In fact i would trust such a Git based solution far more than any
opaque, invisible tool that claims to have checked a signature with
cooperation of my mail client (ha!).
The only somewhat non-obvious bit is that Git should be *very*
careful about its key ID and signature parsing strategy, to protect
against social engineering attacks.
For example neither this:
--gpg-by: "Ingo Molnar <mingo@kernal.org>"
nor this:
--pgp-by: "Ingo Molnar <mingo@kernel.org>"
malicious pull request should slip through in any fashion:
- Git should only use keys that are in your ring of trust - not pull
keys from the public keyring automatically and just check
coherency of the pull request or such. [I'm sure people will be
tempted to have such a feature - but that temptation should be
resisted.]
- Git should abort the moment it sees an unknown option
Thanks,
Ingo
^ permalink raw reply
* Re: New Feature wanted: Is it possible to let git clone continue last break point?
From: Jonathan Nieder @ 2011-10-31 9:07 UTC (permalink / raw)
To: netroby; +Cc: Git Mail List, Tomas Carnecky, Jeff King
In-Reply-To: <CAEZo+gcj5q2UYnak1+1UG7pPzoeaUr=QLsiCiNXbC_n+JQbKQQ@mail.gmail.com>
Hi,
netroby wrote:
> Is it possible to let git clone continue last break point.
> when we git clone very large project from the web, we may face some
> interupt, then we must clone it from zero .
You might find [1] useful as a stopgap (thanks, Tomas!).
Something like Jeff's "priming the well with a server-specified
bundle" proposal[2] might be a good way to make the same trick
transparent to clients in the future.
Even with that, later fetches, which grab a pack generated on the fly
to only contain the objects not already fetched, are generally not
resumable. Overcoming that would presumably require larger protocol
changes, and I don't know of anyone working on it. (My workaround
when in a setup where this mattered was to use the old-fashioned
"dumb" http protocol. It worked fine.)
Hope that helps,
Jonathan
[1] http://thread.gmane.org/gmane.comp.version-control.git/181380
[2] http://thread.gmane.org/gmane.comp.version-control.git/164569/focus=164701
http://thread.gmane.org/gmane.comp.version-control.git/168906/focus=168912
^ permalink raw reply
* Re: New Feature wanted: Is it possible to let git clone continue last break point?
From: Jakub Narebski @ 2011-10-31 9:14 UTC (permalink / raw)
To: netroby; +Cc: Git Mail List
In-Reply-To: <CAEZo+gcj5q2UYnak1+1UG7pPzoeaUr=QLsiCiNXbC_n+JQbKQQ@mail.gmail.com>
netroby <hufeng1987@gmail.com> writes:
> Is it possible to let git clone continue last break point.
> when we git clone very large project from the web, we may face some
> interupt, then we must clone it from zero .
>
> it is bad feeling for low connection speed users.
>
> please help us out.
>
> we need git clone continue last break point
Resuming "git clone" is not currently possible in Git, and it would be
difficult to add such feature to Git; there were several attempts and
neither succeeded.
What you can do is generate a starter bundle out of your repository
(using "git bundle"), and serve this file via HTTP / FTP / BitTorrent,
i.e. some resumable transport. Then you "git clone <bundle file>",
fix up configuration, and fetch the rest since bundle creation.
Though this is possible only if it is your project... or can ask
project administrator to provide bundle.
--
Jakub Narębski
^ permalink raw reply
* Re: New Feature wanted: Is it possible to let git clone continue last break point?
From: netroby @ 2011-10-31 9:16 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Git Mail List, Tomas Carnecky, Jeff King
In-Reply-To: <20111031090717.GA24978@elie.hsd1.il.comcast.net>
the example :
i want to clone the freebsd and linux kernel git repo , to view their
source code.
git://github.com/freebsd/freebsd.git
git://github.com/torvalds/linux.git
they are big project, so they are huge.
thanks for your tips. it will let me have a try .
I am current using 256K Adsl , so it is very not stable when clone in progress.
netroby
----------------------------------
http://www.netroby.com
On Mon, Oct 31, 2011 at 17:07, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi,
>
> netroby wrote:
>
>> Is it possible to let git clone continue last break point.
>> when we git clone very large project from the web, we may face some
>> interupt, then we must clone it from zero .
>
> You might find [1] useful as a stopgap (thanks, Tomas!).
>
> Something like Jeff's "priming the well with a server-specified
> bundle" proposal[2] might be a good way to make the same trick
> transparent to clients in the future.
>
> Even with that, later fetches, which grab a pack generated on the fly
> to only contain the objects not already fetched, are generally not
> resumable. Overcoming that would presumably require larger protocol
> changes, and I don't know of anyone working on it. (My workaround
> when in a setup where this mattered was to use the old-fashioned
> "dumb" http protocol. It worked fine.)
>
> Hope that helps,
> Jonathan
>
> [1] http://thread.gmane.org/gmane.comp.version-control.git/181380
> [2] http://thread.gmane.org/gmane.comp.version-control.git/164569/focus=164701
> http://thread.gmane.org/gmane.comp.version-control.git/168906/focus=168912
>
^ permalink raw reply
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