* fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
From: Thomas Glanzmann @ 2007-06-08 10:08 UTC (permalink / raw)
To: GIT
Hello,
(s017241) [/usr/src/linux-2.6] git checkout v2.6.20
warning: You appear to be on a branch yet to be born.
warning: Forcing checkout of v2.6.20.
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
Cannot detach HEAD
(s017241) [/usr/src/linux-2.6] git version
git version 1.5.2.1
what is going wrong here?
Thomas
^ permalink raw reply
* Re: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
From: Junio C Hamano @ 2007-06-08 10:15 UTC (permalink / raw)
To: Thomas Glanzmann; +Cc: GIT
In-Reply-To: <20070608100831.GA2335@cip.informatik.uni-erlangen.de>
Thomas Glanzmann <thomas@glanzmann.de> writes:
> Hello,
>
> (s017241) [/usr/src/linux-2.6] git checkout v2.6.20
> warning: You appear to be on a branch yet to be born.
> warning: Forcing checkout of v2.6.20.
> fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
> Use '--' to separate paths from revisions
> Cannot detach HEAD
>
> (s017241) [/usr/src/linux-2.6] git version
> git version 1.5.2.1
>
> what is going wrong here?
Perhaps repository was set up in an unusual way by hand
(i.e. not by a clone), such that:
1. you have HEAD pointing at a branch (e.g. 'refs/heads/master'),
2. which does _not_ exist yet (i.e. no 'refs/heads/master'),
3. yet you have a tag that you can try to detach your HEAD to (e.g. v2.6.20).
... well that was my initial guess, but even after setting up such a
funny repository by hand, I cannot seem to reproduce it.
^ permalink raw reply
* Re: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
From: Thomas Glanzmann @ 2007-06-08 10:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT
In-Reply-To: <7vodjqkazp.fsf@assigned-by-dhcp.cox.net>
Hello Junio,
> ... well that was my initial guess, but even after setting up such a
> funny repository by hand, I cannot seem to reproduce it.
This was on a fresh clone. What I did was:
(s017241) [/usr/src] git clone 131.188.30.102:/scratch/tg/linux-2.6/
Initialized empty Git repository in /usr/src/linux-2.6/.git/
remote: Generating pack...
remote: Done counting 496189 objects.
remote: Deltifying 496189 objects...
remote: 100% (496189/496189) done
Indexing 496189 objects...
remote: Total 496189 (delta 401610), reused 496189 (delta 401610)
100% (496189/496189) done
Resolving 401610 deltas...
100% (401610/401610) donedone
fatal: Not a valid object name HEAD
I see it. Last line. I tried to clone from a repository which itself had a
detached HEAD. Could that be the problem?
Thomas
^ permalink raw reply
* Re: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
From: Junio C Hamano @ 2007-06-08 10:27 UTC (permalink / raw)
To: Thomas Glanzmann; +Cc: GIT
In-Reply-To: <7vodjqkazp.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
> Perhaps repository was set up in an unusual way by hand
> (i.e. not by a clone), such that:
>
> 1. you have HEAD pointing at a branch (e.g. 'refs/heads/master'),
> 2. which does _not_ exist yet (i.e. no 'refs/heads/master'),
> 3. yet you have a tag that you can try to detach your HEAD to (e.g. v2.6.20).
>
> ... well that was my initial guess, but even after setting up such a
> funny repository by hand, I cannot seem to reproduce it.
Actually, that turns out to be the reason for 'maint' releases,
although it works on 'master' (hence will be in 1.5.3 later).
How did you get your repository into such a state to begin with?
^ permalink raw reply
* Re: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
From: Junio C Hamano @ 2007-06-08 10:33 UTC (permalink / raw)
To: Thomas Glanzmann; +Cc: GIT
In-Reply-To: <20070608102113.GB2335@cip.informatik.uni-erlangen.de>
Thomas Glanzmann <thomas@glanzmann.de> writes:
> I see it. Last line. I tried to clone from a repository which itself had a
> detached HEAD. Could that be the problem?
Ah, our mails crossed.
There is no reason to forbid cloning of a repository whose HEAD
is detached, but detached HEAD is a relatively recent invention,
and I would not be surprised if that was indeed the breakage,
nor nobody has hit this so far.
It's sufficiently late here so I do not think I would be able to
take a look at it tonight, though. Sorry.
Just in case you need unblocking (although I think you know how
already), you should be able to continue with:
$ git rev-parse v2.6.20^0 >.git/HEAD
$ git read-tree HEAD
$ git checkout-index -f -q -u -a
That would give you a normal detached state at v2.6.20; you
should be able to come back to your branches with usual "git
checkout".
^ permalink raw reply
* Re: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
From: Thomas Glanzmann @ 2007-06-08 10:38 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT
In-Reply-To: <7vfy52ka63.fsf@assigned-by-dhcp.cox.net>
Hello Junio,
sleep well! And if you want to reproduce it yourself we can e-mail
tomorrow or whenever you like.
Thanks,
Thomas
^ permalink raw reply
* Re: [PATCH v2] Remove useless uses of cat, and replace with filename arguments or redirection
From: Martin Langhoff @ 2007-06-08 10:42 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Josh Triplett, Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0706070506230.4046@racer.site>
On 6/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Things like that are known to happen, and that's why "wc -l < file" is a
> better fix than "wc -l file | tr -dc 0-9". In this case, it might not
> matter for a long time, but why not stop being sloppy here and now?
Not sure if I'd call is sloppy, but I also prefer wc -l < file -- it's
definitely safer.
cheers,
m
^ permalink raw reply
* Re: Problems with git-svnimport
From: Martin Langhoff @ 2007-06-08 10:56 UTC (permalink / raw)
To: plexq; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0706071639190.12111@www.mintpixels.com>
On 6/8/07, Alex R.M. Turner <aturner@plexq.com> wrote:
> Is this expected, or should I be worried?
It means that you need to play a bit with your import settings. It
usually takes me a few tried to get the right trunk, tags and branches
parameter for each repo. SVN's layout is a bit too flexible and
doesn't make this easy to figure out.
cheers,
martin
^ permalink raw reply
* fatal: serious inflate inconsistency
From: Thomas Glanzmann @ 2007-06-08 11:05 UTC (permalink / raw)
To: GIT
Hello,
and here is another one I guess: ;-(
(tomcat-05) [/usr/src] git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Initialized empty Git repository in /usr/src/linux-2.6/.git/
remote: Generating pack...
remote: Done counting 496911 objects.
remote: Deltifying 496911 objects...
remote: 100% (496911/496911) done
Indexing 496911 objects...
remote: Total 496911 (delta 401539), reused 493712 (delta 398653)
100% (496911/496911) done
Resolving 401539 deltas...
fatal: serious inflate inconsistency
fatal: index-pack died with error code 128
fetch-pack from
'git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git' failed.
(tomcat-05) [/usr/src] git version
git version 1.5.2.1
Greetings,
Thomas
^ permalink raw reply
* Re: Spec file for StGIT (or equivalent)
From: Jakub Narebski @ 2007-06-08 11:21 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <b0943d9e0706080146n5f19beffi385e706f40146062@mail.gmail.com>
Catalin Marinas wrote:
> On 08/06/07, Jakub Narebski <jnareb@gmail.com> wrote:
>> I can see that stgit repository contains some helper files to build deb
>> package. How to build rpm package from current version of stgit?
>
> python setup.py bdist_rpm
Thanks a lot.
> I have a release script that build rpm and dist, I should add it to
> the contrib dir.
TIA.
It would be nice to have the above instruction, as well as the one
using scripts in contrib/ and debian/ on how to build rpm and deb
packages in INSTALL
>> Is here main version planned to be released soon?
>
> Yes, 0.13, in about a week or as soon as I clear some of the bugs in
> https://gna.org/bugs/?group=stgit.
Shouldn't this URL be in README (or BUGS)?
--
Jakub Narebski
Poland
^ permalink raw reply
* [PATCH 0/6] gitweb: 'commitdiff' view improvements
From: Jakub Narebski @ 2007-06-08 11:24 UTC (permalink / raw)
To: git
The following series makes a few improvements to 'commitdiff' view.
The final goal of the series is to use '--cc' (compact combined)
format for merge commits in gitweb, as requested by Linus Torvalds
in
Message-ID: <Pine.LNX.4.64.0610061202060.3952@g5.osdl.org>
with a few other improvements.
Table of contents:
------------------
gitweb: Provide links to commitdiff to each parent in 'commitdiff' view
gitweb: Improve "next" link in commitdiff view
gitweb: Split git_patchset_body into separate subroutines
gitweb: Create special from-file/to-file header for combined diff
gitweb: Add links to blobdiffs in from-file/to-file header for merges
gitweb: '--cc' for merges in 'commitdiff' view
The first two patches are totally independent of other patches, and
are not required by anu patches.
The "Split git_patchset_body" is required for all subsequent patches;
those patches shows why it was needed. The last patch is conceptually
indepenent on the "improve from-file/to-file header for merges"
patches.
Diffstat:
---------
gitweb/gitweb.css | 5 +
gitweb/gitweb.perl | 481 ++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 362 insertions(+), 124 deletions(-)
--
Jakub Narebski
ShadeHawk on #git
Poland
^ permalink raw reply
* [PATCH 1/6] gitweb: Provide links to commitdiff to each parent in 'commitdiff' view
From: Jakub Narebski @ 2007-06-08 11:24 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
Since commit-fb1dde4a we show combined diff for merges in 'commitdiff'
view, and since commit-208ecb2e also in 'commit' view. Sometimes
though one would want to see diff to one of merge commit parents. It
is easy in 'commit' view: in the commit header part there are "diff"
links for each of parent header. This commit adds such links also for
'commitdiff' view.
Add to difftree / whatchanged table row with "1", "2", ... links to
'commitdiff' view for diff with n-th parent for merge commits, as a
table header. This is visible only in 'comitdiff' view, and only for
a merge commit (comit with more than one parent).
To save space links are shown as "n", where "n" is number of a parent,
and not as for example shortened (to 7 characters) sha1 of a parent
commit. To make it easier to discover what links is for, each link
has 'title' attribute explaining the link.
Note that one would need to remember that difftree table in 'commit'
view has one less column (it doesn't have "patch" link column), if one
would want to add such table header also in 'commit' view.
Example output:
1 2 3
Makefile patch | diff1 | diff2 | diff3 | blob | history
cache.h patch | diff1 | diff2 | diff3 | blob | history
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.css | 5 +++++
gitweb/gitweb.perl | 21 +++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 9f0822f..7908fe3 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -181,10 +181,15 @@ table.diff_tree {
font-family: monospace;
}
+table.combined.diff_tree th {
+ text-align: center;
+}
+
table.combined.diff_tree td {
padding-right: 24px;
}
+table.combined.diff_tree th.link,
table.combined.diff_tree td.link {
padding: 0px 2px;
}
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e92596c..e2d5222 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2401,6 +2401,26 @@ sub git_difftree_body {
print "<table class=\"" .
(@parents > 1 ? "combined " : "") .
"diff_tree\">\n";
+
+ # header only for combined diff in 'commitdiff' view
+ my $has_header = @parents > 1 && $action eq 'commitdiff';
+ if ($has_header) {
+ # table header
+ print "<thead><tr>\n" .
+ "<th></th><th></th>\n"; # filename, patchN link
+ for (my $i = 0; $i < @parents; $i++) {
+ my $par = $parents[$i];
+ print "<th>" .
+ $cgi->a({-href => href(action=>"commitdiff",
+ hash=>$hash, hash_parent=>$par),
+ -title => 'commitdiff to parent number ' .
+ ($i+1) . ': ' . substr($par,0,7)},
+ $i+1) .
+ " </th>\n";
+ }
+ print "</tr></thead>\n<tbody>\n";
+ }
+
my $alternate = 1;
my $patchno = 0;
foreach my $line (@{$difftree}) {
@@ -2673,6 +2693,7 @@ sub git_difftree_body {
} # we should not encounter Unmerged (U) or Unknown (X) status
print "</tr>\n";
}
+ print "</tbody>" if $has_header;
print "</table>\n";
}
^ permalink raw reply related
* [PATCH 2/6] gitweb: Improve "next" link in commitdiff view
From: Jakub Narebski @ 2007-06-08 11:26 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
Check if 'hp' (hash_parent) parameter to 'commitdiff' view is one of
'h' (hash) commit parents, i.e. if commitdiff is of the form
"<commit>^<n> <commit>", and mark it as such in the bottom part of
navigation bar. The "next" link in commitdiff view was introduced
in commit 151602df00b8e5c5b4a8193f59a94b85f9b5aebc
If 'hb' is n-th parent of 'h', show the following at the bottom
of navigation bar:
(from parent n: _commit_)
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is sort of companion to previous commit, meaning thatI'd like to
see if I came from link to diff to one of parents in a merge commit.
Purely decoration, but I think it is nice.
gitweb/gitweb.perl | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e2d5222..4561d4e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4479,7 +4479,14 @@ sub git_commitdiff {
$hash_parent_short = substr($hash_parent, 0, 7);
}
$formats_nav .=
- ' (from: ' .
+ ' (from';
+ for (my $i = 0; $i < @{$co{'parents'}}; $i++) {
+ if ($co{'parents'}[$i] eq $hash_parent) {
+ $formats_nav .= ' parent ' . ($i+1);
+ last;
+ }
+ }
+ $formats_nav .= ': ' .
$cgi->a({-href => href(action=>"commitdiff",
hash=>$hash_parent)},
esc_html($hash_parent_short)) .
^ permalink raw reply related
* [PATCH 3/6] gitweb: Split git_patchset_body into separate subroutines
From: Jakub Narebski @ 2007-06-08 11:27 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
This commit makes git_patchset_body easier to read, and reduces level of
nesting and indent level. It adds more lines that it removes because of
extra parameter passing in subroutines, and subroutine calls in
git_patchset_body. Also because there are few added comments.
Below there are descriptions of all split-off subroutines:
Separate formatting "git diff" header into format_git_diff_header_line.
While at it fix it so it always escapes pathname. It would be even more
useful if we decide to use `--cc' for merges, and need to generate by
hand empty patches for anchors.
Separate formatting extended (git) diff header lines into
format_extended_diff_header_line. This one is copied without changes.
Separate formatting two-lines from-file/to-file diff header into
format_diff_from_to_header subroutine. While at it fix it so it always
escapes pathname. Beware calling convention: it takes _two_ lines.
Separate generating %from and %to hashes (with info used among others to
generate hyperlinks) into parse_from_to_diffinfo subroutine. This one is
copied without changes.
Separate checking if file was deleted (and among others therefore does
not have link to the result file) into is_deleted subroutine. This would
allow us to easily change the algotithm to find if file is_deleted in
the result.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Perhaps only first paragraph (and signoff line) should be in the
commit message, although I think those comments are useful.
gitweb/gitweb.perl | 313 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 202 insertions(+), 111 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4561d4e..aee4f23 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -954,7 +954,149 @@ sub format_subject_html {
}
}
-# format patch (diff) line (rather not to be used for diff headers)
+# format git diff header line, i.e. "diff --(git|combined|cc) ..."
+sub format_git_diff_header_line {
+ my $line = shift;
+ my $diffinfo = shift;
+ my ($from, $to) = @_;
+
+ if ($diffinfo->{'nparents'}) {
+ # combined diff
+ $line =~ s!^(diff (.*?) )"?.*$!$1!;
+ if ($to->{'href'}) {
+ $line .= $cgi->a({-href => $to->{'href'}, -class => "path"},
+ esc_path($to->{'file'}));
+ } else { # file was deleted (no href)
+ $line .= esc_path($to->{'file'});
+ }
+ } else {
+ # "ordinary" diff
+ $line =~ s!^(diff (.*?) )"?a/.*$!$1!;
+ if ($from->{'href'}) {
+ $line .= $cgi->a({-href => $from->{'href'}, -class => "path"},
+ 'a/' . esc_path($from->{'file'}));
+ } else { # file was added (no href)
+ $line .= 'a/' . esc_path($from->{'file'});
+ }
+ $line .= ' ';
+ if ($to->{'href'}) {
+ $line .= $cgi->a({-href => $to->{'href'}, -class => "path"},
+ 'b/' . esc_path($to->{'file'}));
+ } else { # file was deleted
+ $line .= 'b/' . esc_path($to->{'file'});
+ }
+ }
+
+ return "<div class=\"diff header\">$line</div>\n";
+}
+
+# format extended diff header line, before patch itself
+sub format_extended_diff_header_line {
+ my $line = shift;
+ my $diffinfo = shift;
+ my ($from, $to) = @_;
+
+ # match <path>
+ if ($line =~ s!^((copy|rename) from ).*$!$1! && $from->{'href'}) {
+ $line .= $cgi->a({-href=>$from->{'href'}, -class=>"path"},
+ esc_path($from->{'file'}));
+ }
+ if ($line =~ s!^((copy|rename) to ).*$!$1! && $to->{'href'}) {
+ $line .= $cgi->a({-href=>$to->{'href'}, -class=>"path"},
+ esc_path($to->{'file'}));
+ }
+ # match single <mode>
+ if ($line =~ m/\s(\d{6})$/) {
+ $line .= '<span class="info"> (' .
+ file_type_long($1) .
+ ')</span>';
+ }
+ # match <hash>
+ if ($line =~ m/^index [0-9a-fA-F]{40},[0-9a-fA-F]{40}/) {
+ # can match only for combined diff
+ $line = 'index ';
+ for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
+ if ($from->{'href'}[$i]) {
+ $line .= $cgi->a({-href=>$from->{'href'}[$i],
+ -class=>"hash"},
+ substr($diffinfo->{'from_id'}[$i],0,7));
+ } else {
+ $line .= '0' x 7;
+ }
+ # separator
+ $line .= ',' if ($i < $diffinfo->{'nparents'} - 1);
+ }
+ $line .= '..';
+ if ($to->{'href'}) {
+ $line .= $cgi->a({-href=>$to->{'href'}, -class=>"hash"},
+ substr($diffinfo->{'to_id'},0,7));
+ } else {
+ $line .= '0' x 7;
+ }
+
+ } elsif ($line =~ m/^index [0-9a-fA-F]{40}..[0-9a-fA-F]{40}/) {
+ # can match only for ordinary diff
+ my ($from_link, $to_link);
+ if ($from->{'href'}) {
+ $from_link = $cgi->a({-href=>$from->{'href'}, -class=>"hash"},
+ substr($diffinfo->{'from_id'},0,7));
+ } else {
+ $from_link = '0' x 7;
+ }
+ if ($to->{'href'}) {
+ $to_link = $cgi->a({-href=>$to->{'href'}, -class=>"hash"},
+ substr($diffinfo->{'to_id'},0,7));
+ } else {
+ $to_link = '0' x 7;
+ }
+ my ($from_id, $to_id) = ($diffinfo->{'from_id'}, $diffinfo->{'to_id'});
+ $line =~ s!$from_id\.\.$to_id!$from_link..$to_link!;
+ }
+
+ return $line . "<br/>\n";
+}
+
+# format from-file/to-file diff header
+sub format_diff_from_to_header {
+ my ($from_line, $to_line, $diffinfo, $from, $to) = @_;
+ my $line;
+ my $result = '';
+
+ $line = $from_line;
+ #assert($line =~ m/^---/) if DEBUG;
+ # no extra formatting "^--- /dev/null"
+ if ($line =~ m!^--- "?a/!) {
+ if (!$diffinfo->{'nparents'} && # multiple 'from'
+ $from->{'href'}) {
+ $line = '--- a/' .
+ $cgi->a({-href=>$from->{'href'}, -class=>"path"},
+ esc_path($from->{'file'}));
+ } else {
+ $line = '--- a/' .
+ esc_path($from->{'file'});
+ }
+ }
+ $result .= qq!<div class="diff from_file">$line</div>\n!;
+
+ $line = $to_line;
+ #assert($line =~ m/^\+\+\+/) if DEBUG;
+ # no extra formatting for "^+++ /dev/null"
+ if ($line =~ m!^\+\+\+ "?b/!) {
+ if ($to->{'href'}) {
+ $line = '+++ b/' .
+ $cgi->a({-href=>$to->{'href'}, -class=>"path"},
+ esc_path($to->{'file'}));
+ } else {
+ $line = '+++ b/' .
+ esc_path($to->{'file'});
+ }
+ }
+ $result .= qq!<div class="diff to_file">$line</div>\n!;
+
+ return $result;
+}
+
+# format patch (diff) line (not to be used for diff headers)
sub format_diff_line {
my $line = shift;
my ($from, $to) = @_;
@@ -1680,6 +1822,48 @@ sub parse_ls_tree_line ($;%) {
return wantarray ? %res : \%res;
}
+# generates _two_ hashes, references to which are passed as 2 and 3 argument
+sub parse_from_to_diffinfo {
+ my ($diffinfo, $from, $to, @parents) = @_;
+
+ if ($diffinfo->{'nparents'}) {
+ # combined diff
+ $from->{'file'} = [];
+ $from->{'href'} = [];
+ fill_from_file_info($diffinfo, @parents)
+ unless exists $diffinfo->{'from_file'};
+ for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
+ $from->{'file'}[$i] = $diffinfo->{'from_file'}[$i] || $diffinfo->{'to_file'};
+ if ($diffinfo->{'status'}[$i] ne "A") { # not new (added) file
+ $from->{'href'}[$i] = href(action=>"blob",
+ hash_base=>$parents[$i],
+ hash=>$diffinfo->{'from_id'}[$i],
+ file_name=>$from->{'file'}[$i]);
+ } else {
+ $from->{'href'}[$i] = undef;
+ }
+ }
+ } else {
+ $from->{'file'} = $diffinfo->{'from_file'} || $diffinfo->{'file'};
+ if ($diffinfo->{'status'} ne "A") { # not new (added) file
+ $from->{'href'} = href(action=>"blob", hash_base=>$hash_parent,
+ hash=>$diffinfo->{'from_id'},
+ file_name=>$from->{'file'});
+ } else {
+ delete $from->{'href'};
+ }
+ }
+
+ $to->{'file'} = $diffinfo->{'to_file'} || $diffinfo->{'file'};
+ if (!is_deleted($diffinfo)) { # file exists in result
+ $to->{'href'} = href(action=>"blob", hash_base=>$hash,
+ hash=>$diffinfo->{'to_id'},
+ file_name=>$to->{'file'});
+ } else {
+ delete $to->{'href'};
+ }
+}
+
## ......................................................................
## parse to array of hashes functions
@@ -2387,6 +2571,11 @@ sub from_ids_eq {
}
}
+sub is_deleted {
+ my $diffinfo = shift;
+
+ return $diffinfo->{'to_id'} eq ('0' x 40);
+}
sub git_difftree_body {
my ($difftree, $hash, @parents) = @_;
@@ -2444,7 +2633,7 @@ sub git_difftree_body {
fill_from_file_info($diff, @parents)
unless exists $diff->{'from_file'};
- if ($diff->{'to_id'} ne ('0' x 40)) {
+ if (!is_deleted($diff)) {
# file exists in the result (child) commit
print "<td>" .
$cgi->a({-href => href(action=>"blob", hash=>$diff->{'to_id'},
@@ -2765,6 +2954,8 @@ sub git_patchset_body {
} else {
$diffinfo = parse_difftree_raw_line($difftree->[$patch_idx]);
}
+ # modifies %from, %to hashes
+ parse_from_to_diffinfo($diffinfo, \%from, \%to, @hash_parents);
if ($diffinfo->{'nparents'}) {
# combined diff
$from{'file'} = [];
@@ -2794,7 +2985,7 @@ sub git_patchset_body {
}
$to{'file'} = $diffinfo->{'to_file'} || $diffinfo->{'file'};
- if ($diffinfo->{'to_id'} ne ('0' x 40)) { # file exists in result
+ if (!is_deleted($diffinfo)) { # file exists in result
$to{'href'} = href(action=>"blob", hash_base=>$hash,
hash=>$diffinfo->{'to_id'},
file_name=>$to{'file'});
@@ -2808,105 +2999,15 @@ sub git_patchset_body {
# print "git diff" header
$patch_line = shift @diff_header;
- if ($diffinfo->{'nparents'}) {
-
- # combined diff
- $patch_line =~ s!^(diff (.*?) )"?.*$!$1!;
- if ($to{'href'}) {
- $patch_line .= $cgi->a({-href => $to{'href'}, -class => "path"},
- esc_path($to{'file'}));
- } else { # file was deleted
- $patch_line .= esc_path($to{'file'});
- }
-
- } else {
-
- $patch_line =~ s!^(diff (.*?) )"?a/.*$!$1!;
- if ($from{'href'}) {
- $patch_line .= $cgi->a({-href => $from{'href'}, -class => "path"},
- 'a/' . esc_path($from{'file'}));
- } else { # file was added
- $patch_line .= 'a/' . esc_path($from{'file'});
- }
- $patch_line .= ' ';
- if ($to{'href'}) {
- $patch_line .= $cgi->a({-href => $to{'href'}, -class => "path"},
- 'b/' . esc_path($to{'file'}));
- } else { # file was deleted
- $patch_line .= 'b/' . esc_path($to{'file'});
- }
-
- }
- print "<div class=\"diff header\">$patch_line</div>\n";
+ print format_git_diff_header_line($patch_line, $diffinfo,
+ \%from, \%to);
# print extended diff header
print "<div class=\"diff extended_header\">\n" if (@diff_header > 0);
EXTENDED_HEADER:
foreach $patch_line (@diff_header) {
- # match <path>
- if ($patch_line =~ s!^((copy|rename) from ).*$!$1! && $from{'href'}) {
- $patch_line .= $cgi->a({-href=>$from{'href'}, -class=>"path"},
- esc_path($from{'file'}));
- }
- if ($patch_line =~ s!^((copy|rename) to ).*$!$1! && $to{'href'}) {
- $patch_line .= $cgi->a({-href=>$to{'href'}, -class=>"path"},
- esc_path($to{'file'}));
- }
- # match single <mode>
- if ($patch_line =~ m/\s(\d{6})$/) {
- $patch_line .= '<span class="info"> (' .
- file_type_long($1) .
- ')</span>';
- }
- # match <hash>
- if ($patch_line =~ m/^index [0-9a-fA-F]{40},[0-9a-fA-F]{40}/) {
- # can match only for combined diff
- $patch_line = 'index ';
- for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
- if ($from{'href'}[$i]) {
- $patch_line .= $cgi->a({-href=>$from{'href'}[$i],
- -class=>"hash"},
- substr($diffinfo->{'from_id'}[$i],0,7));
- } else {
- $patch_line .= '0' x 7;
- }
- # separator
- $patch_line .= ',' if ($i < $diffinfo->{'nparents'} - 1);
- }
- $patch_line .= '..';
- if ($to{'href'}) {
- $patch_line .= $cgi->a({-href=>$to{'href'}, -class=>"hash"},
- substr($diffinfo->{'to_id'},0,7));
- } else {
- $patch_line .= '0' x 7;
- }
-
- } elsif ($patch_line =~ m/^index [0-9a-fA-F]{40}..[0-9a-fA-F]{40}/) {
- # can match only for ordinary diff
- my ($from_link, $to_link);
- if ($from{'href'}) {
- $from_link = $cgi->a({-href=>$from{'href'}, -class=>"hash"},
- substr($diffinfo->{'from_id'},0,7));
- } else {
- $from_link = '0' x 7;
- }
- if ($to{'href'}) {
- $to_link = $cgi->a({-href=>$to{'href'}, -class=>"hash"},
- substr($diffinfo->{'to_id'},0,7));
- } else {
- $to_link = '0' x 7;
- }
- #affirm {
- # my ($from_hash, $to_hash) =
- # ($patch_line =~ m/^index ([0-9a-fA-F]{40})..([0-9a-fA-F]{40})/);
- # my ($from_id, $to_id) =
- # ($diffinfo->{'from_id'}, $diffinfo->{'to_id'});
- # ($from_hash eq $from_id) && ($to_hash eq $to_id);
- #} if DEBUG;
- my ($from_id, $to_id) = ($diffinfo->{'from_id'}, $diffinfo->{'to_id'});
- $patch_line =~ s!$from_id\.\.$to_id!$from_link..$to_link!;
- }
- print $patch_line . "<br/>\n";
+ print format_extended_diff_header_line($patch_line, $diffinfo,
+ \%from, \%to);
}
print "</div>\n" if (@diff_header > 0); # class="diff extended_header"
@@ -2918,24 +3019,14 @@ sub git_patchset_body {
}
next PATCH if ($patch_line =~ m/^diff /);
#assert($patch_line =~ m/^---/) if DEBUG;
- if (!$diffinfo->{'nparents'} && # not from-file line for combined diff
- $from{'href'} && $patch_line =~ m!^--- "?a/!) {
- $patch_line = '--- a/' .
- $cgi->a({-href=>$from{'href'}, -class=>"path"},
- esc_path($from{'file'}));
- }
- print "<div class=\"diff from_file\">$patch_line</div>\n";
+ #assert($patch_line eq $last_patch_line) if DEBUG;
$patch_line = <$fd>;
chomp $patch_line;
+ #assert($patch_line =~ m/^\+\+\+/) if DEBUG;
- #assert($patch_line =~ m/^+++/) if DEBUG;
- if ($to{'href'} && $patch_line =~ m!^\+\+\+ "?b/!) {
- $patch_line = '+++ b/' .
- $cgi->a({-href=>$to{'href'}, -class=>"path"},
- esc_path($to{'file'}));
- }
- print "<div class=\"diff to_file\">$patch_line</div>\n";
+ print format_diff_from_to_header($last_patch_line, $patch_line,
+ $diffinfo, \%from, \%to);
# the patch itself
LINE:
^ permalink raw reply related
* [PATCH 4/6] gitweb: Create special from-file/to-file header for combined diff
From: Jakub Narebski @ 2007-06-08 11:29 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
Instead of using default, diff(1) like from-file/to-file header for
combined diff (for a merge commit), which looks like:
--- a/git-gui/git-gui.sh
+++ b/_git-gui/git-gui.sh_
(where _link_ denotes [hidden] hyperlink), create from-file(n)/to-file
header, using "--- <n>/_<filename>_" for each of parents, e.g.:
--- 1/_git-gui/git-gui.sh_
--- 2/_git-gui.sh_
+++ b/_git-gui/git-gui.sh_
Test it on one of merge commits involving rename, e.g.
95f97567c1887d77f3a46b42d8622c76414d964d (rename at top)
5bac4a671907604b5fb4e24ff682d5b0e8431931 (file from one branch)
This is mainly meant to easier see renames in a merge commit.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Junio and Pasky likes this, and were source of inspiration for
the next patch.
gitweb/gitweb.perl | 38 +++++++++++++++++++++++++++-----------
1 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index aee4f23..13114bc 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1064,19 +1064,35 @@ sub format_diff_from_to_header {
$line = $from_line;
#assert($line =~ m/^---/) if DEBUG;
- # no extra formatting "^--- /dev/null"
- if ($line =~ m!^--- "?a/!) {
- if (!$diffinfo->{'nparents'} && # multiple 'from'
- $from->{'href'}) {
- $line = '--- a/' .
- $cgi->a({-href=>$from->{'href'}, -class=>"path"},
- esc_path($from->{'file'}));
- } else {
- $line = '--- a/' .
- esc_path($from->{'file'});
+ # no extra formatting for "^--- /dev/null"
+ if (! $diffinfo->{'nparents'}) {
+ # ordinary (single parent) diff
+ if ($line =~ m!^--- "?a/!) {
+ if ($from->{'href'}) {
+ $line = '--- a/' .
+ $cgi->a({-href=>$from->{'href'}, -class=>"path"},
+ esc_path($from->{'file'}));
+ } else {
+ $line = '--- a/' .
+ esc_path($from->{'file'});
+ }
+ }
+ $result .= qq!<div class="diff from_file">$line</div>\n!;
+
+ } else {
+ # combined diff (merge commit)
+ for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
+ if ($from->{'href'}[$i]) {
+ $line = '--- ' .
+ ($i+1) . "/" .
+ $cgi->a({-href=>$from->{'href'}[$i], -class=>"path"},
+ esc_path($from->{'file'}[$i]));
+ } else {
+ $line = '--- /dev/null';
+ }
+ $result .= qq!<div class="diff from_file">$line</div>\n!;
}
}
- $result .= qq!<div class="diff from_file">$line</div>\n!;
$line = $to_line;
#assert($line =~ m/^\+\+\+/) if DEBUG;
^ permalink raw reply related
* [PATCH 5/6] gitweb: Add links to blobdiffs in from-file/to-file header for merges
From: Jakub Narebski @ 2007-06-08 11:32 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
Add links to diff to file ('blobdiff' view) for each of individual
versions of the file in a merge commit to the from-file/to-file header
in the patch part of combined 'commitdiff' view for merges.
The from-file/to-file header for combined diff now looks like:
--- _1_/_git-gui/git-gui.sh_
--- _2_/_git-gui.sh_
+++ b/_git-gui/git-gui.sh_
where _<filename>_ link is link to appropriate version of a file
('blob' view), and _<n>_ is link to respective diff to mentioned
version of a file ('blobdiff' view). There is even hint provided in
the form of title attribute.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
As requested by Junio C Hamano and Petr "Pasky" Baudis in:
Message-ID: <7v1wh1en8k.fsf@assigned-by-dhcp.cox.net>
Message-ID: <20070528132959.GT4489@pasky.or.cz>
I don't know if the link placement is best possible; I tried for
combined diff output be similar to ordinary diff output, but also
provide reqeusted additional functionality (which does not make
sense for ordinary diff). You have to know ehere to search for
the link.
gitweb/gitweb.perl | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 13114bc..c7acfad 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1058,7 +1058,7 @@ sub format_extended_diff_header_line {
# format from-file/to-file diff header
sub format_diff_from_to_header {
- my ($from_line, $to_line, $diffinfo, $from, $to) = @_;
+ my ($from_line, $to_line, $diffinfo, $from, $to, @parents) = @_;
my $line;
my $result = '';
@@ -1084,7 +1084,17 @@ sub format_diff_from_to_header {
for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
if ($from->{'href'}[$i]) {
$line = '--- ' .
- ($i+1) . "/" .
+ $cgi->a({-href=>href(action=>"blobdiff",
+ hash_parent=>$diffinfo->{'from_id'}[$i],
+ hash_parent_base=>$parents[$i],
+ file_parent=>$from->{'file'}[$i],
+ hash=>$diffinfo->{'to_id'},
+ hash_base=>$hash,
+ file_name=>$to->{'file'}),
+ -class=>"path",
+ -title=>"diff" . ($i+1)},
+ $i+1) .
+ '/' .
$cgi->a({-href=>$from->{'href'}[$i], -class=>"path"},
esc_path($from->{'file'}[$i]));
} else {
@@ -3042,7 +3052,8 @@ sub git_patchset_body {
#assert($patch_line =~ m/^\+\+\+/) if DEBUG;
print format_diff_from_to_header($last_patch_line, $patch_line,
- $diffinfo, \%from, \%to);
+ $diffinfo, \%from, \%to,
+ @hash_parents);
# the patch itself
LINE:
^ permalink raw reply related
* [PATCH 6/6] gitweb: '--cc' for merges in 'commitdiff' view
From: Jakub Narebski @ 2007-06-08 11:33 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>
Allow choosing between '-c' (combined diff) and '--cc' (compact
combined) diff format in 'commitdiff' view for merge (multiparent)
commits. Default is now '--cc'.
In the bottom part of navigation bar there is link allowing to change
diff format: "combined" for '-c' (when using '--cc') and "compact" for
'--cc' (when using '-c'), just on the right of "raw" link to
'commitdiff_plain" view.
About patchset part of diff --cc output: the difftree (whatchanged
table) has "patch" links to anchors to individual patches (on the same
page). The --cc option further compresses the patch output by
omitting some hunks; when this optimization makes all hunks disappear,
the patch is not shown (like in any other "empty diff" case). But the
fact that patch has been simplified out is not reflected in the raw
(difftree) part of diff output; the raw part is the same for '-c' and
'--cc' options. As correcting difftree is rather out of the question,
as it would require scanning patchset part before writing out
difftree, we add "Simple merge" empty diffs as a place to have anchor
to in place of those simplified out and removed patches.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Linus wanted '--cc' for merges as it is more compact. Here it is.
gitweb/gitweb.perl | 111 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 99 insertions(+), 12 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c7acfad..a6383dc 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1122,6 +1122,31 @@ sub format_diff_from_to_header {
return $result;
}
+# create note for patch simplified by combined diff
+sub format_diff_cc_simplified {
+ my ($diffinfo, @parents) = @_;
+ my $result = '';
+
+ $result .= "<div class=\"diff header\">" .
+ "diff --cc ";
+ if (!is_deleted($diffinfo)) {
+ $result .= $cgi->a({-href => href(action=>"blob",
+ hash_base=>$hash,
+ hash=>$diffinfo->{'to_id'},
+ file_name=>$diffinfo->{'to_file'}),
+ -class => "path"},
+ esc_path($diffinfo->{'to_file'}));
+ } else {
+ $result .= esc_path($diffinfo->{'to_file'});
+ }
+ $result .= "</div>\n" . # class="diff header"
+ "<div class=\"diff nodifferences\">" .
+ "Simple merge" .
+ "</div>\n"; # class="diff nodifferences"
+
+ return $result;
+}
+
# format patch (diff) line (not to be used for diff headers)
sub format_diff_line {
my $line = shift;
@@ -2973,13 +2998,33 @@ sub git_patchset_body {
# advance raw git-diff output if needed
$patch_idx++ if defined $diffinfo;
- # read and prepare patch information
- if (ref($difftree->[$patch_idx]) eq "HASH") {
- # pre-parsed (or generated by hand)
- $diffinfo = $difftree->[$patch_idx];
- } else {
- $diffinfo = parse_difftree_raw_line($difftree->[$patch_idx]);
+ # compact combined diff output can have some patches skipped
+ # find which patch (using pathname of result) we are at now
+ my $to_name;
+ if ($diff_header[0] =~ m!^diff --cc "?(.*)"?$!) {
+ $to_name = $1;
}
+
+ do {
+ # read and prepare patch information
+ if (ref($difftree->[$patch_idx]) eq "HASH") {
+ # pre-parsed (or generated by hand)
+ $diffinfo = $difftree->[$patch_idx];
+ } else {
+ $diffinfo = parse_difftree_raw_line($difftree->[$patch_idx]);
+ }
+
+ # check if current raw line has no patch (it got simplified)
+ if (defined $to_name && $to_name ne $diffinfo->{'to_file'}) {
+ print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n" .
+ format_diff_cc_simplified($diffinfo, @hash_parents) .
+ "</div>\n"; # class="patch"
+
+ $patch_idx++;
+ $patch_number++;
+ }
+ } until (!defined $to_name || $to_name eq $diffinfo->{'to_file'} ||
+ $patch_idx > $#$difftree);
# modifies %from, %to hashes
parse_from_to_diffinfo($diffinfo, \%from, \%to, @hash_parents);
if ($diffinfo->{'nparents'}) {
@@ -3069,6 +3114,27 @@ sub git_patchset_body {
print "</div>\n"; # class="patch"
}
+ # for compact combined (--cc) format, with chunk and patch simpliciaction
+ # patchset might be empty, but there might be unprocessed raw lines
+ for ($patch_idx++ if $patch_number > 0;
+ $patch_idx < @$difftree;
+ $patch_idx++) {
+ # read and prepare patch information
+ if (ref($difftree->[$patch_idx]) eq "HASH") {
+ # pre-parsed (or generated by hand)
+ $diffinfo = $difftree->[$patch_idx];
+ } else {
+ $diffinfo = parse_difftree_raw_line($difftree->[$patch_idx]);
+ }
+
+ # generate anchor for "patch" links in difftree / whatchanged part
+ print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n" .
+ format_diff_cc_simplified($diffinfo, @hash_parents) .
+ "</div>\n"; # class="patch"
+
+ $patch_number++;
+ }
+
if ($patch_number == 0) {
if (@hash_parents > 1) {
print "<div class=\"diff nodifferences\">Trivial merge</div>\n";
@@ -4582,7 +4648,11 @@ sub git_commitdiff {
die_error(undef, "Unknown commit object");
}
- # we need to prepare $formats_nav before any parameter munging
+ # choose format for commitdiff for merge
+ if (! defined $hash_parent && @{$co{'parents'}} > 1) {
+ $hash_parent = '--cc';
+ }
+ # we need to prepare $formats_nav before almost any parameter munging
my $formats_nav;
if ($format eq 'html') {
$formats_nav =
@@ -4590,7 +4660,8 @@ sub git_commitdiff {
hash=>$hash, hash_parent=>$hash_parent)},
"raw");
- if (defined $hash_parent) {
+ if (defined $hash_parent &&
+ $hash_parent ne '-c' && $hash_parent ne '--cc') {
# commitdiff with two commits given
my $hash_parent_short = $hash_parent;
if ($hash_parent =~ m/^[0-9a-fA-F]{40}$/) {
@@ -4622,6 +4693,17 @@ sub git_commitdiff {
')';
} else {
# merge commit
+ if ($hash_parent eq '--cc') {
+ $formats_nav .= ' | ' .
+ $cgi->a({-href => href(action=>"commitdiff",
+ hash=>$hash, hash_parent=>'-c')},
+ 'combined');
+ } else { # $hash_parent eq '-c'
+ $formats_nav .= ' | ' .
+ $cgi->a({-href => href(action=>"commitdiff",
+ hash=>$hash, hash_parent=>'--cc')},
+ 'compact');
+ }
$formats_nav .=
' (merge: ' .
join(' ', map {
@@ -4634,9 +4716,10 @@ sub git_commitdiff {
}
my $hash_parent_param = $hash_parent;
- if (!defined $hash_parent) {
+ if (!defined $hash_parent_param) {
+ # --cc for multiple parents, --root for parentless
$hash_parent_param =
- @{$co{'parents'}} > 1 ? '-c' : $co{'parent'} || '--root';
+ @{$co{'parents'}} > 1 ? '--cc' : $co{'parent'} || '--root';
}
# read commitdiff
@@ -4713,10 +4796,14 @@ TEXT
# write patch
if ($format eq 'html') {
- git_difftree_body(\@difftree, $hash, $hash_parent || @{$co{'parents'}});
+ my $use_parents = !defined $hash_parent ||
+ $hash_parent eq '-c' || $hash_parent eq '--cc';
+ git_difftree_body(\@difftree, $hash,
+ $use_parents ? @{$co{'parents'}} : $hash_parent);
print "<br/>\n";
- git_patchset_body($fd, \@difftree, $hash, $hash_parent || @{$co{'parents'}});
+ git_patchset_body($fd, \@difftree, $hash,
+ $use_parents ? @{$co{'parents'}} : $hash_parent);
close $fd;
print "</div>\n"; # class="page_body"
git_footer_html();
^ permalink raw reply related
* Re: [PATCH] gitweb: change filename/directory name of snapshots
From: Jakub Narebski @ 2007-06-08 11:46 UTC (permalink / raw)
To: git
In-Reply-To: <7v4pliltuv.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Matthias Lederhofer <matled@gmx.net> writes:
>
>> /.git or .git is removed from the project name and the
>> basename of the remaining path is used as the beginning of
>> the filename and as the directory in the archive.
>>
>> The regexp will actually not strip off /.git or .git if there
>> wouldn't be anything left after removing it.
>>
>> Currently the full project name is used as directory in the
>> archive and the basename is used as filename. For example a
>> repository named foo/bar/.git will have a archive named
>> .git-<version>.* and extract to foo/bar/.git. With this patch
>> the file is named bar-<version>.* and extracts to bar.
>
> Makes sense to me for "foo/bar/.git", but I am not sure if we
> would want to do this to "foo/bar.git". Opinions?
I'd like to have snapshot called bar-<sha1>.tar.gz in first case,
and bar.git-<sha1>.tar.gz (without stripping .git) in the second,
but I wouldn't protest too much about having bar-<sha1>.tar.gz
also in second case.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH v2] Remove useless uses of cat, and replace with filename arguments or redirection
From: Johannes Schindelin @ 2007-06-08 12:52 UTC (permalink / raw)
To: Martin Langhoff; +Cc: Josh Triplett, Junio C Hamano, git
In-Reply-To: <46a038f90706080342j3a5bb7abv58c78d7b532e29de@mail.gmail.com>
Hi,
On Fri, 8 Jun 2007, Martin Langhoff wrote:
> On 6/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Things like that are known to happen, and that's why "wc -l < file" is a
> > better fix than "wc -l file | tr -dc 0-9". In this case, it might not
> > matter for a long time, but why not stop being sloppy here and now?
>
> Not sure if I'd call is sloppy, but I also prefer wc -l < file -- it's
> definitely safer.
Okay, so I sounded harsher than intended.
I should have phrased it like that: I consider "wc -l < file"
substantially more future-proof, and it is in general a good practice
IMVHO not to generate something you throw away just after that, when there
is a way to avoid generating the unwanted part consistently.
Sorry,
Dscho
^ permalink raw reply
* Re: [PATCH] Teach filter-branch about subdirectory filtering
From: Johannes Schindelin @ 2007-06-08 13:03 UTC (permalink / raw)
To: Johannes Sixt, git; +Cc: Junio C Hamano
In-Reply-To: <46690315.8244CAF7@eudaptics.com>
Hi,
On Fri, 8 Jun 2007, Johannes Sixt wrote:
> Johannes Schindelin wrote:
> > It's just a guess, but now that we come really, really close to having
> > a concise implementation of git-subproject which will probably soon
> > propagate to master, and then maint, I gather that more and more
> > people come and want to split their projects (which they maintained as
> > one big project) into several subprojects (which they should have been
> > from the start, but the tool did not easily allow for that).
>
> I think that --subdirectry-filter needs to become a bit smarter to be
> really useful for splitting a big project into sub-projects plus a
> super-project. The reason is that once you have extracted the
> sub-project(s), you have a hard time to find out which commits to
> gitlink into the super-project. I don't have a plan how to make it
> smarter, though.
Yes, it seems a good direction to follow.
I will have to think about it, but I guess that with yet another set of
files in ../map/ (probably prefixed by the subdirectory name), we should
even be able to smartly filter a huge project into a super-project
together with its subprojects.
The command line option would be something like "--split-superproject
dir1,dir2,dir3", where dir<n> are the subdirectories that are to become
the subprojects.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Teach filter-branch about subdirectory filtering
From: Johannes Sixt @ 2007-06-08 13:19 UTC (permalink / raw)
To: git
In-Reply-To: <Pine.LNX.4.64.0706080130000.4046@racer.site>
Johannes Schindelin wrote:
> # list all parent's object names for a given commit
> get_parents () {
> - git-rev-list -1 --parents "$1" | sed "s/^[0-9a-f]*//"
> + case "$filter_subdir" in
> + "")
> + git-rev-list -1 --parents "$1"
> + ;;
> + *)
> + git-rev-list -1 --parents "$1" -- "$filter_subdir"
> + esac | sed "s/^[0-9a-f]*//"
> }
I think --full-history in the subdir case would make a lot of sense.
-- Hannes
^ permalink raw reply
* interaction between cvsimport and cvsexportcommit
From: picca @ 2007-06-08 13:42 UTC (permalink / raw)
To: git
Hello
In the institut where I am working www.synchrotron-soleil.fr, the
"computing department" use CVS for all their projects. As I am not from
this department (I am a scientist), I can use my own tools and git is
one of them.
Nevertheless I need to interact with them (I am writting a C++
library to control diffractometers) so I use cvsimport and
cvsexportcommit.
The point is that I find this over complicate compare to my git
day-to-day experience.
I do not understand why cvsimport and cvsexportcommit do not
interact nicelly to ease git <-> cvs.
For example as a neeby I expect this to work out of the box
after the first cvsimport
git cvsimport
do some work
git commit -a
git cvsexportcommit
and that's all
Instead of this we have this:
$ export GIT_DIR=~/project/.git
$ cd ~/project_cvs_checkout
$ git-cvsexportcommit -v <commit-sha1>
$ cvs commit -F .mgs <files>
or even worse
$ export GIT_DIR=~/project/.git
$ cd ~/project_cvs_checkout
$ git-cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1
git-cvsexportcommit -c -p -v
what is missing in cvsexportcommit and cvsimport to lower the git <->
cvs barrier.
Thank you.
Frederic
PS: Sorry for my poor english.
^ permalink raw reply
* Re: fatal: serious inflate inconsistency
From: Nicolas Pitre @ 2007-06-08 13:48 UTC (permalink / raw)
To: Thomas Glanzmann; +Cc: GIT
In-Reply-To: <20070608110536.GD2335@cip.informatik.uni-erlangen.de>
On Fri, 8 Jun 2007, Thomas Glanzmann wrote:
> Hello,
> and here is another one I guess: ;-(
>
> (tomcat-05) [/usr/src] git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> Initialized empty Git repository in /usr/src/linux-2.6/.git/
> remote: Generating pack...
> remote: Done counting 496911 objects.
> remote: Deltifying 496911 objects...
> remote: 100% (496911/496911) done
> Indexing 496911 objects...
> remote: Total 496911 (delta 401539), reused 493712 (delta 398653)
> 100% (496911/496911) done
> Resolving 401539 deltas...
> fatal: serious inflate inconsistency
> fatal: index-pack died with error code 128
> fetch-pack from
> 'git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git' failed.
> (tomcat-05) [/usr/src] git version
> git version 1.5.2.1
This is bad.
index-pack works like this:
1) it receives data over the network:
1a) it writes a copy of that data to disk to create a pack
1b) it deflates that data in parallel to compute its SHA1
2) when done, it resolves deltas and to do so:
2a) it deflates the base object data from 1a
2b) it applies the delta over the base object data then compute its
SHA1
In your case it seems that 1B and 2A don't produce the same deflated
data somehow.
Is it reproducible?
Are you using Linux? What kernel version?
Are you using NFS?
If it isn't reproducible then you might possibly have been the victim of
faulty hardware.
Nicolas
^ permalink raw reply
* Re: fatal: serious inflate inconsistency
From: Thomas Glanzmann @ 2007-06-08 13:50 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: GIT
In-Reply-To: <alpine.LFD.0.99.0706080931330.12885@xanadu.home>
Hello,
> Is it reproducible?
I can try. But that produces 150 Mbyte Traffic on Kernel.org
> Are you using Linux? What kernel version?
Yes, I do. Debian etch; 2.6.20
> Are you using NFS?
Nope.
> If it isn't reproducible then you might possibly have been the victim
> of faulty hardware.
I give it a try and come back to you. I am off the net for 1 hour.
Thomas
^ permalink raw reply
* Re: git-svn removes merge
From: Joakim Tjernlund @ 2007-06-08 13:52 UTC (permalink / raw)
To: git
In-Reply-To: <1181236096.30670.66.camel@gentoo-jocke.transmode.se>
On Thu, 2007-06-07 at 19:08 +0200, Joakim Tjernlund wrote:
> If I do this:
>
> git checkout --track -b svn remotes/trunk
> git checkout -b merge
> git-am ../mbox
> git checkout svn
> #edit Makefile and commit
> git-svn dcommit #Note 1
> git pull . merge
> git-svn dcommit
>
> then git-svn dcommit removes the merge beteen svn and merge.
> git log svn..merge shows all the commits that git-am ../mbox added.
>
> How do I avoid this?
>
> Jocke
>
> Note 1:
> If I skip this step then the last git-svn dcommit fails, why is that?
Forgot to mention the error msg I get here:
Transaction is out of date: Out of date: '/trunk/board/tmcu/of-tmtu.dts'
in transaction '101-1' at /usr/bin/git-svn line 405
Jocke
^ 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