Git development
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Jakub Narebski @ 2008-12-10  2:13 UTC (permalink / raw)
  To: git
In-Reply-To: <20081209224814.28106.83387.stgit@localhost.localdomain>

Jakub Narebski wrote:

I'm sorry, there should be

  +       my $ftype = "blob";
>         if (!defined $hash) {
>                 $hash = git_get_hash_by_path($hash_base, $file_name, "blob")
>                         or die_error(404, "Error looking up file");
> +       } else {
> +               $ftype = git_get_type($hash);
> +               if ($ftype !~ "blob") {
> +                       die_error(400, "Object is not a blob");
> +               }

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: Recovering from epic fail (deleted .git/objects/pack)
From: Junio C Hamano @ 2008-12-10  0:19 UTC (permalink / raw)
  To: R. Tyler Ballance; +Cc: git
In-Reply-To: <1228867861.14165.19.camel@starfruit.local>

"R. Tyler Ballance" <tyler@slide.com> writes:

> I really wish I didn't have to ask this question, as we discussed in
> #git early this morning, whiskey is the likely answer.
>
> For unexplainable reasons one of our sysadmins got trigger-happy when he
> tried to prune a temp_pack file generated and left in a
> developer's .git/ directory after a git operation aborted (disk quota
> exceeded)
>
> As a result, the sysadmin killed the developers
> entire .git/objects/pack/ directory. (insert copious amounts of whiskey
> here)
>
> He did not however delete all the other contents of .git/objects (00/,
> 01/, etc)
>
> Is there a feasible way that I can properly recover
> the .git/objects/pack directory such that the developer who had their
> last two weeks of local work thrashed can get it back?

I do not know about "feasible" and "properly", but ...

 (0) take backup of the repository of this unfortunate developer.

 (1) make a fresh clone of the central repository that this unfortunate
     developer's work started out from.

 (2) copy the contents of the .git/objects/pack/ of that clone to the
     developer's .git/objects/pack/.

See if "fsck --full" complains after that.  If the repository was not
repacked during that period, all objects created by the activity by the
unfortunate developer would be loose, so ...

^ permalink raw reply

* Recovering from epic fail (deleted .git/objects/pack)
From: R. Tyler Ballance @ 2008-12-10  0:11 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]

I really wish I didn't have to ask this question, as we discussed in
#git early this morning, whiskey is the likely answer.

For unexplainable reasons one of our sysadmins got trigger-happy when he
tried to prune a temp_pack file generated and left in a
developer's .git/ directory after a git operation aborted (disk quota
exceeded)

As a result, the sysadmin killed the developers
entire .git/objects/pack/ directory. (insert copious amounts of whiskey
here)

He did not however delete all the other contents of .git/objects (00/,
01/, etc)

Is there a feasible way that I can properly recover
the .git/objects/pack directory such that the developer who had their
last two weeks of local work thrashed can get it back?


Anything that can help (other than pummeling the sysadmin) would be
appreciated

Cheers
-- 
-R. Tyler Ballance
Slide, Inc.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* start with none of your own money
From: Jason Corley @ 2008-12-09 23:44 UTC (permalink / raw)
  To: git

go to http://investors2009.com/  to learn to buy residential and commercial real estate with none of your own money.
  
This email was sent from the Real Estate Investment Academy. To be removed please type your email address on the following site http://investors2009.com/remove/





--------------------------------------------
. 

^ permalink raw reply

* [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Jakub Narebski @ 2008-12-09 22:48 UTC (permalink / raw)
  To: git; +Cc: Luben Tuikov, Jakub Narebski
In-Reply-To: <20081209223703.28106.29198.stgit@localhost.localdomain>

Among others: 
 * move variable declaration closer to the place it is set and used,
   if possible,
 * uniquify and simplify coding style a bit, which includes removing
   unnecessary '()'.
 * check type only if $hash was defined, as otherwise from the way
   git_get_hash_by_path() is called (and works), we know that it is
   a blob,
 * use modern calling convention for git-blame,
 * remove unused variable,
 * don't use implicit variables ($_),
 * add some comments

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Not stricly necessary... but the code looked not very nice

 gitweb/gitweb.perl |   65 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 37 insertions(+), 28 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 916396a..68aa3f8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4575,28 +4575,32 @@ sub git_tag {
 }
 
 sub git_blame {
-	my $fd;
-	my $ftype;
-
+	# permissions
 	gitweb_check_feature('blame')
-	    or die_error(403, "Blame view not allowed");
+		or die_error(403, "Blame view not allowed");
 
+	# error checking
 	die_error(400, "No file name given") unless $file_name;
 	$hash_base ||= git_get_head_hash($project);
-	die_error(404, "Couldn't find base commit") unless ($hash_base);
+	die_error(404, "Couldn't find base commit") unless $hash_base;
 	my %co = parse_commit($hash_base)
 		or die_error(404, "Commit not found");
 	if (!defined $hash) {
 		$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
 			or die_error(404, "Error looking up file");
+	} else {
+		my $ftype = git_get_type($hash);
+		if ($ftype !~ "blob") {
+			die_error(400, "Object is not a blob");
+		}
 	}
-	$ftype = git_get_type($hash);
-	if ($ftype !~ "blob") {
-		die_error(400, "Object is not a blob");
-	}
-	open ($fd, "-|", git_cmd(), "blame", '-p', '--',
-	      $file_name, $hash_base)
+
+	# run git-blame --porcelain
+	open my $fd, "-|", git_cmd(), "blame", '-p',
+		$hash_base, '--', $file_name
 		or die_error(500, "Open git-blame failed");
+
+	# page header
 	git_header_html();
 	my $formats_nav =
 		$cgi->a({-href => href(action=>"blob", -replay=>1)},
@@ -4610,40 +4614,43 @@ sub git_blame {
 	git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
 	git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
 	git_print_page_path($file_name, $ftype, $hash_base);
-	my @rev_color = (qw(light2 dark2));
+
+	# page body
+	my @rev_color = qw(light2 dark2);
 	my $num_colors = scalar(@rev_color);
 	my $current_color = 0;
-	my $last_rev;
+	my %metainfo = ();
+
 	print <<HTML;
 <div class="page_body">
 <table class="blame">
 <tr><th>Commit</th><th>Line</th><th>Data</th></tr>
 HTML
-	my %metainfo = ();
-	while (1) {
-		$_ = <$fd>;
-		last unless defined $_;
+ LINE:
+	while (my $line = <$fd>) {
+		chomp $line;
+		# the header: <SHA-1> <src lineno> <dst lineno> [<lines in group>]
+		# no <lines in group> for subsequent lines in group of lines
 		my ($full_rev, $orig_lineno, $lineno, $group_size) =
-		    /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/;
+		   ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/);
 		if (!exists $metainfo{$full_rev}) {
 			$metainfo{$full_rev} = {};
 		}
 		my $meta = $metainfo{$full_rev};
-		while (<$fd>) {
-			last if (s/^\t//);
-			if (/^(\S+) (.*)$/) {
+		while (my $data = <$fd>) {
+			chomp $data;
+			last if ($data =~ s/^\t//); # contents of line
+			if ($data =~ /^(\S+) (.*)$/) {
 				$meta->{$1} = $2;
 			}
 		}
-		my $data = $_;
-		chomp $data;
-		my $rev = substr($full_rev, 0, 8);
+		my $short_rev = substr($full_rev, 0, 8);
 		my $author = $meta->{'author'};
-		my %date = parse_date($meta->{'author-time'},
-		                      $meta->{'author-tz'});
+		my %date =
+			parse_date($meta->{'author-time'}, $meta->{'author-tz'});
 		my $date = $date{'iso-tz'};
 		if ($group_size) {
-			$current_color = ++$current_color % $num_colors;
+			$current_color = ($current_color + 1) % $num_colors;
 		}
 		print "<tr id=\"l$lineno\" class=\"$rev_color[$current_color]\">\n";
 		if ($group_size) {
@@ -4654,7 +4661,7 @@ HTML
 			print $cgi->a({-href => href(action=>"commit",
 			                             hash=>$full_rev,
 			                             file_name=>$file_name)},
-			              esc_html($rev));
+			              esc_html($short_rev));
 			print "</td>\n";
 		}
 		my $parent_commit;
@@ -4683,6 +4690,8 @@ HTML
 	print "</div>";
 	close $fd
 		or print "Reading blob failed\n";
+
+	# page footer
 	git_footer_html();
 }
 

^ permalink raw reply related

* [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
From: Jakub Narebski @ 2008-12-09 22:48 UTC (permalink / raw)
  To: git; +Cc: Luben Tuikov, Jakub Narebski
In-Reply-To: <20081209223703.28106.29198.stgit@localhost.localdomain>

Luben Tuikov changed 'lineno' link from leading to commit which lead
to current version of given block of lines, to leading to parent of
this commit in 244a70e (Blame "linenr" link jumps to previous state at
"orig_lineno").  This supposedly made data mining possible (or just
better).

Unfortunately the implementation in 244a70e used one call for
git-rev-parse to find parent revision per line in file, instead of
using long lived "git cat-file --batch-check" (which might not existed
then), or changing validate_refname to validate_revision and made it
accept <rev>^, <rev>^^, <rev>^^^ etc. syntax.

This patch attempts to migitate issue a bit by caching $parent_commit
info in %metainfo, which makes gitweb to call git-rev-parse only once
per unique commit in blame output.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
That is what I have noticed during browsing git_blame() code.

We can change it to even more effective implementation (like the ones
proposed above in the commit message) later.

Indenting is cause for artifically large diff

 gitweb/gitweb.perl |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1b800f4..916396a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4657,11 +4657,17 @@ HTML
 			              esc_html($rev));
 			print "</td>\n";
 		}
-		open (my $dd, "-|", git_cmd(), "rev-parse", "$full_rev^")
-			or die_error(500, "Open git-rev-parse failed");
-		my $parent_commit = <$dd>;
-		close $dd;
-		chomp($parent_commit);
+		my $parent_commit;
+		if (!exists $meta->{'parent'}) {
+			open (my $dd, "-|", git_cmd(), "rev-parse", "$full_rev^")
+				or die_error(500, "Open git-rev-parse failed");
+			$parent_commit = <$dd>;
+			close $dd;
+			chomp($parent_commit);
+			$meta->{'parent'} = $parent_commit;
+		} else {
+			$parent_commit = $meta->{'parent'};
+		}
 		my $blamed = href(action => 'blame',
 		                  file_name => $meta->{'filename'},
 		                  hash_base => $parent_commit);

^ permalink raw reply related

* [PATCH 1/3] gitweb: Move 'lineno' id from link to row element in git_blame
From: Jakub Narebski @ 2008-12-09 22:46 UTC (permalink / raw)
  To: git; +Cc: Luben Tuikov, Jakub Narebski
In-Reply-To: <20081209223703.28106.29198.stgit@localhost.localdomain>

Move l<line number> ID from <a> link element inside table row (inside
cell element for column with line numbers), to encompassing <tr> table
row element.  It was done to make it easier to manipulate result HTML
with DOM, and to be able write 'blame_incremental' view with the same,
or nearly the same result.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
For blame_incremental I need easy way to manipulate rows of blame
table, to add information about blamed commits as it arrives.

So there it is.

 gitweb/gitweb.perl |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6eb370d..1b800f4 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4645,7 +4645,7 @@ HTML
 		if ($group_size) {
 			$current_color = ++$current_color % $num_colors;
 		}
-		print "<tr class=\"$rev_color[$current_color]\">\n";
+		print "<tr id=\"l$lineno\" class=\"$rev_color[$current_color]\">\n";
 		if ($group_size) {
 			print "<td class=\"sha1\"";
 			print " title=\"". esc_html($author) . ", $date\"";
@@ -4667,7 +4667,6 @@ HTML
 		                  hash_base => $parent_commit);
 		print "<td class=\"linenr\">";
 		print $cgi->a({ -href => "$blamed#l$orig_lineno",
-		                -id => "l$lineno",
 		                -class => "linenr" },
 		              esc_html($lineno));
 		print "</td>";

^ permalink raw reply related

* [PATCH 0/3] gitweb: Improve git_blame in preparation for incremental blame
From: Jakub Narebski @ 2008-12-09 22:43 UTC (permalink / raw)
  To: git; +Cc: Luben Tuikov

The following series implements a few improvements to git_blame code
and 'blame' view output to prepare for WIP/RFC patch adding incremental
blame output to gitweb using AJAX (JavaScript and XMLHttpRequest); the
code in question is based on code by Petr Baudis from 26 Aug 2007
  http://permalink.gmane.org/gmane.comp.version-control.git/56657
which in turn was based on Fredrik Kuivinen proof of concept patch.


The first patch in series (moving id to tr element) is needed in
blame_incremental, and it makes it easier to use DOM to manipulate
gitweb blame output.

Second patch is about what I have noticed when examining git_blame
code.

The last patch is not necessarily required; but please tell me if it
is to be accepted or to be dropped, to know whether to base
incremental blame on it.

---
Jakub Narebski (3):
      gitweb: A bit of code cleanup in git_blame()
      gitweb: Cache $parent_commit info in git_blame()
      gitweb: Move 'lineno' id from link to row element in git_blame

 gitweb/gitweb.perl |   84 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 49 insertions(+), 35 deletions(-)

-- 
Jakub Narebski
ShadeHawk on #git
Poland

^ permalink raw reply

* Re: Forcing --no-ff on pull
From: Daniel Barkalow @ 2008-12-09 22:32 UTC (permalink / raw)
  To: R. Tyler Ballance; +Cc: Nanako Shiraishi, git
In-Reply-To: <1228819087.18611.73.camel@starfruit.local>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3180 bytes --]

On Tue, 9 Dec 2008, R. Tyler Ballance wrote:

> On Tue, 2008-12-09 at 19:17 +0900, Nanako Shiraishi wrote:
> > Quoting "R. Tyler Ballance" <tyler@slide.com>:
> > 
> > > The most common use-case involves a user merging a project branch into a
> > > stabilization branch (`git checkout stable && git pull . project`) in
> > > such a way that no merge commit is generated. Of course, without
> > > thinking they'll push these changes up to the centralized repository.
> > > Not 15 minutes later they realize "ruh roh! I didn't want to do that"
> > 
> > Why does the user not want to fast-forward, if the merge she wants to do is actually a fast-forward?
> 
> I agree with you, this is more about preventing coworkers who are too
> lazy to understand the entirety of what they're doing from hurting the
> workflow of "the rest of us". It's a technically solution to a people
> problem (I understand technology far more than people ;))
> 
> Consider the following scenarion:
>   % git checkout -b project
>   % <work>
>   % git commit -am "A"
>   % <work>
>   % git commit -am "B"
>   % <work>
>   % git commit -am "C"
>   % <work>
>   % git commit -am "D"
>   % git checkout stable
>   % git pull . project
>   % <fast-forward>
>   % git push origin stable
> 
> At this point, QA is involved and what can happen is that QA realizes
> that this code is *not* stable and *never* should have been brought into
> the stable branch.

How do you prevent the (IMHO more likely) case of:

% git checkout -b project
% git checkout stable
<fix some bug in stable>
% git commit -a
<forget to switch branches back>
<work>
% git commit -am "A"
<work>
% git commit -am "B"
...
% git push origin stable

That is, the developer makes a whole bunch of inappropriate commits on 
their stable branch instead of their project branch and then pushes it out 
(perhaps as part of a push rule, or thinking only the bug fix went there). 
I suspect that "pull" step there isn't the point where things are going 
wrong.

If you've actually got QA in the process, have developers push to a 
per-developer location and send a pull request to QA. QA can reject bad 
changes instead of putting them into the stable branch at all, and then 
they can reply to the pull requests with snide comments instead of having 
to beat up the developers, because the developer doesn't inconvenience 
anybody (except QA, whose job is to be inconvenienced by developers).

> I'm less concerned at this point, the company switched entirely to Git
> two weeks ago, with the history containing possible unwanted merges. I'm
> more concerned however with LazyDeveloper inadvertently polluting stable
> branches as LazyDeveloper does not yet fully grasp the concepts that Git
> offers

I think such developers are more likely to push some bad commits to 
"stable" directly than they are to make their bad commits on a branch, 
merge it (fast-forward or otherwise) and push the result. It's also easy 
to discover:

% git push origin project:stable

And not generate a merge commit simply by virtue of not merging branches.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply

* Re: git fsck segmentation fault
From: Martin Koegler @ 2008-12-09 21:57 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Simon Hausmann, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0812091408560.14328@xanadu.home>

On Tue, Dec 09, 2008 at 02:09:58PM -0500, Nicolas Pitre wrote:
> Has this been looked at?  Martin?

I have not noticed this message.

> #54 0x0000000000493c6d in parse_tree (item=0x20d0178) at tree.c:224
> #55 0x0000000000424ca2 in mark_object (obj=0x20d0178, type=2, data=<value 
> optimized out>) at builtin-fsck.c:102
> #56 0x0000000000468d1c in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x20d0128) at fsck.c:26
> #57 0x0000000000424cba in mark_object (obj=0x20d0128, type=2, data=<value 
> optimized out>) at builtin-fsck.c:105
> #58 0x0000000000468d1c in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x1edb448) at fsck.c:26
> #59 0x0000000000424cba in mark_object (obj=0x1edb448, type=2, data=<value 
> optimized out>) at builtin-fsck.c:105
> #60 0x0000000000468d1c in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x1edb420) at fsck.c:26
> #61 0x0000000000424cba in mark_object (obj=0x1edb420, type=2, data=<value 
> optimized out>) at builtin-fsck.c:105
> #62 0x0000000000468bf9 in fsck_walk (obj=0x241a750, walk=0x424af0 
> <mark_object>, data=0x241a750) at fsck.c:50
> #63 0x0000000000424b7d in mark_object (obj=0x241a750, type=1, data=<value 
> optimized out>) at builtin-fsck.c:105
> #64 0x0000000000468c31 in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x241a708) at fsck.c:57
> #65 0x0000000000424b7d in mark_object (obj=0x241a708, type=1, data=<value 
> optimized out>) at builtin-fsck.c:105
> #66 0x0000000000468c31 in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x4dea0b0) at fsck.c:57
> #67 0x0000000000424b7d in mark_object (obj=0x4dea0b0, type=1, data=<value 
> optimized out>) at builtin-fsck.c:105
> #68 0x0000000000468c31 in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x488ff78) at fsck.c:57
> #69 0x0000000000424b7d in mark_object (obj=0x488ff78, type=1, data=<value 
> optimized out>) at builtin-fsck.c:105
> #70 0x0000000000468c31 in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x488bd18) at fsck.c:57
> #71 0x0000000000424b7d in mark_object (obj=0x488bd18, type=1, data=<value 
> optimized out>) at builtin-fsck.c:105
> #72 0x0000000000468c31 in fsck_walk (obj=<value optimized out>, walk=0x424af0 
> <mark_object>, data=0x313c0b0) at fsck.c:57
> #73 0x0000000000424b7d in mark_object (obj=0x313c0b0, type=1, data=<value 
> optimized out>) at builtin-fsck.c:105
> [recursion between line 105 and 57]

If I look at the backtrace, nothing seems wrong. The obj pointers for
mark_object are all different, so its not stuck in a loop. If you look
at type, you will see that it traverses commits (type=1) untils
#63. Then it traverses trees (type=2).

At my option, there is a commit with a very long ancestory (~40.000
[stack frame count/2]). As we do depth first search for the reachability
check, we need about 80.000 frames.

I suggest, that you retry with a very much bigger stack (ulimit -s).

mfg Martin Kögler

^ permalink raw reply

* Re: How to clone git repository with git-svn meta-data included?
From: Grzegorz Kossakowski @ 2008-12-09 20:57 UTC (permalink / raw)
  To: Sam Vilain, git
In-Reply-To: <1228813734.28186.77.camel@maia.lan>

Sam Vilain pisze:
> It's up to the git-svn user to make sure that they prepare the refs to
> be what git-svn expects.  This is something probably requiring more
> documentation and/or git-svn features to be easier.

What I was asking if we should add trunk ref to svn mirror so others cloning it will have
'origin/trunk' reference created automatically during clone process so no extra steps would be needed.

To be honest, I don't understand how Git exactly handles all this refs mapping and rewriting (e.g.
during cloning). Having said that, I cannot foresee all possible implications of choosing particular
method of solving current issues thus asking you.

>> Would it be the best practice?
> 
> Well, obscure stuff should never really be best practice.  The best practice
> is to have a single git repository that is where the svn -> git migration
> happens.  And git-svn could perhaps auto-init based on information in the
> commit log or something.  Best practice is to enhance the tool to work the
> way it Should(tm) :)

Cannot follow you here. We want single svn mirror but at the same time we want to our committers to
be able to push back to svn. What has been already proposed satisfies my need apart from the fact
that currently there is  small problem with our mirror setup.

-- 
Best regards,
Grzegorz Kossakowski

^ permalink raw reply

* Re: is gitosis secure?
From: Sam Vilain @ 2008-12-09  9:04 UTC (permalink / raw)
  To: Thomas Koch; +Cc: Git Mailing List, dabe
In-Reply-To: <200812090956.48613.thomas@koch.ro>

On Tue, 2008-12-09 at 09:56 +0100, Thomas Koch wrote:
> Sorry for the shameless subject, but I presented gitosis yesterday to
> our sysadmin and he wasn't much delighted to learn, that write access to
> repositories hosted with gitosis would need SSH access.
> 
> So could you help me out in this discussion, whether to use or not to
> use gitosis? 
> Our admin would prefer to not open SSH at all outside our LAN, but
> developers would need to have write access also outside the office.

Restricted unix shells are a technology which has been proven secure for
decades now.  If you use git-shell, you are keeping the secure part of
SSH - the authentication and encryption - and restricting the SSH access
part to the bare minimum required for useful access to the required
services.

ie ... it all comes down to the shell you give those 'login' users as to
what they can do.

Sam.

^ permalink raw reply

* Re: How to clone git repository with git-svn meta-data included?
From: Sam Vilain @ 2008-12-09  9:08 UTC (permalink / raw)
  To: Grzegorz Kossakowski; +Cc: Peter Harris, Michael J Gruber, git
In-Reply-To: <493D6AE9.6020504@tuffmail.com>

On Mon, 2008-12-08 at 19:43 +0100, Grzegorz Kossakowski wrote:
> > Yes. The rfoo = sha1hash part is git-svn rebuilding its index.
> > "Current branch master is up to date" is git-svn calling "git rebase
> > <svn-branch>", and git saying that there is nothing to do, since there
> > have been no svn commits to that branch since the last time you ran
> > git svn rebase (or since you cloned the git mirror, or since the last
> > time the git mirror pulled from svn).
> 
> Thanks for confirmation and explanation.
> 
> The remaining question is who should address this issue with non-existing trunk ref? Should I ask
> Jukka, who maintains svn mirrors, to put instruction into his scripts that will add trunk reference?

It's up to the git-svn user to make sure that they prepare the refs to
be what git-svn expects.  This is something probably requiring more
documentation and/or git-svn features to be easier.

> Would it be the best practice?

Well, obscure stuff should never really be best practice.  The best practice
is to have a single git repository that is where the svn -> git migration
happens.  And git-svn could perhaps auto-init based on information in the
commit log or something.  Best practice is to enhance the tool to work the
way it Should(tm) :)

Sam

^ permalink raw reply

* Re: Problems Cloning an SVN repo.
From: Tim Visher @ 2008-12-09 19:41 UTC (permalink / raw)
  To: Peter Harris; +Cc: git
In-Reply-To: <eaa105840812091009k292ced25vcd638808c913b76@mail.gmail.com>

> Did you install the subversion-perl cygwin package?

That was it.  Thanks everyone!

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply

* Re: [PATCH] make sure packs to be replaced are closed beforehand
From: Alex Riesen @ 2008-12-09 19:33 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Johannes Sixt, Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0812091414030.14328@xanadu.home>

Nicolas Pitre, Tue, Dec 09, 2008 20:26:52 +0100:
> Especially on Windows where an opened file cannot be replaced, make
> sure pack-objects always close packs it is about to replace. Even on
> non Windows systems, this could save potential bad results if ever
> objects were to be read from the new pack file using offset from the old
> index.
> 
> This should fix t5303 on Windows.
> 
> Signed-off-by: Nicolas Pitre <nico@cam.org>
> ---
...
> OK, here it is at last.  Please confirm it works on Windows before Junio 
> merges it.
> 

Will do in about 16 hours.

^ permalink raw reply

* [PATCH] make sure packs to be replaced are closed beforehand
From: Nicolas Pitre @ 2008-12-09 19:26 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Johannes Sixt, Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0811260931030.14328@xanadu.home>

Especially on Windows where an opened file cannot be replaced, make
sure pack-objects always close packs it is about to replace. Even on
non Windows systems, this could save potential bad results if ever
objects were to be read from the new pack file using offset from the old
index.

This should fix t5303 on Windows.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---

On Wed, 26 Nov 2008, Nicolas Pitre wrote:
> On Wed, 26 Nov 2008, Alex Riesen wrote:
> > 2008/11/19 Nicolas Pitre <nico@cam.org>:
> > > On Wed, 19 Nov 2008, Johannes Sixt wrote:
> > >> Oh, the patch only works around the failure in the test case. In a real
> > >> repository there is usually no problem because the destination pack file
> > >> does not exist.
> > >>
> > >> The unusual case is where you do this:
> > >>
> > >>  $ git rev-list -10 HEAD | git pack-objects foobar
> > >>
> > >> twice in a row: In this case the second invocation fails on Windows
> > >> because the destination pack file already exists *and* is open. But not
> > >> even git-repack does this even if it is called twice. OTOH, the test case
> > >> *does* exactly this.
> > >
> > > OK.... Well, despite my earlier assertion, I think the above should be a
> > > valid operation.
> > >
> > > I'm looking at it now.  I'm therefore revoking my earlier ACK as well
> > > (better keep that test case alive).
> > >
> > 
> > Any news here?
> 
> Yes: my hard disk crashed a couple hours after I mentioned this, so most 
> of my time has been spent on recovery since then.  I'll come back to it 
> eventually.

OK, here it is at last.  Please confirm it works on Windows before Junio 
merges it.

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 67eefa2..cedef52 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -535,6 +535,7 @@ static void write_pack_file(void)
 
 			snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
 				 base_name, sha1_to_hex(sha1));
+			free_pack_by_name(tmpname);
 			if (adjust_perm(pack_tmp_name, mode))
 				die("unable to make temporary pack file readable: %s",
 				    strerror(errno));
diff --git a/cache.h b/cache.h
index f15b3fc..231c06d 100644
--- a/cache.h
+++ b/cache.h
@@ -820,6 +820,7 @@ extern int open_pack_index(struct packed_git *);
 extern unsigned char* use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *);
 extern void close_pack_windows(struct packed_git *);
 extern void unuse_pack(struct pack_window **);
+extern void free_pack_by_name(const char *);
 extern struct packed_git *add_packed_git(const char *, int, int);
 extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t);
 extern off_t nth_packed_object_offset(const struct packed_git *, uint32_t);
diff --git a/sha1_file.c b/sha1_file.c
index 6c0e251..0e021c5 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -673,6 +673,37 @@ void unuse_pack(struct pack_window **w_cursor)
 }
 
 /*
+ * This is used by git-repack in case a newly created pack happens to
+ * contain the same set of objects as an existing one.  In that case
+ * the resulting file might be different even if its name would be the
+ * same.  It is best to close any reference to the old pack before it is
+ * replaced on disk.  Of course no index pointers nor windows for given pack
+ * must subsist at this point.  If ever objects from this pack are requested
+ * again, the new version of the pack will be reinitialized through
+ * reprepare_packed_git().
+ */
+void free_pack_by_name(const char *pack_name)
+{
+	struct packed_git *p, **pp = &packed_git;
+
+	while (*pp) {
+		p = *pp;
+		if (strcmp(pack_name, p->pack_name) == 0) {
+			close_pack_windows(p);
+			if (p->pack_fd != -1)
+				close(p->pack_fd);
+			if (p->index_data)
+				munmap((void *)p->index_data, p->index_size);
+			free(p->bad_object_sha1);
+			*pp = p->next;
+			free(p);
+			return;
+		}
+		pp = &p->next;
+	}
+}
+
+/*
  * Do not call this directly as this leaks p->pack_fd on error return;
  * call open_packed_git() instead.
  */

^ permalink raw reply related

* Re: is gitosis secure?
From: Garry Dolley @ 2008-12-09 19:18 UTC (permalink / raw)
  To: Thomas Koch; +Cc: Git Mailing List, dabe
In-Reply-To: <200812090956.48613.thomas@koch.ro>

On Tue, Dec 09, 2008 at 09:56:48AM +0100, Thomas Koch wrote:
> Sorry for the shameless subject, but I presented gitosis yesterday to
> our sysadmin and he wasn't much delighted to learn, that write access to
> repositories hosted with gitosis would need SSH access.
> 
> So could you help me out in this discussion, whether to use or not to
> use gitosis? 
> Our admin would prefer to not open SSH at all outside our LAN, but
> developers would need to have write access also outside the office.

If your admin doesn't want to open SSH to the outside, then the
people who need it would need to VPN into your LAN first.  That's
how I do it on networks that don't allow any traffic from the
outside.

But like someone else ask, what alternative *would* your admin
prefer?  I'd rather use SSH than a yet-to-be-proven-secure
alternative app.

-- 
Garry Dolley
ARP Networks, Inc.                          http://www.arpnetworks.com
Data center, VPS, and IP transit solutions  (818) 206-0181
Member Los Angeles County REACT, Unit 336   WQGK336
Blog                                        http://scie.nti.st

^ permalink raw reply

* Re: git fsck segmentation fault
From: Nicolas Pitre @ 2008-12-09 19:09 UTC (permalink / raw)
  To: Simon Hausmann; +Cc: Martin Koegler, Git Mailing List
In-Reply-To: <200811280919.10685.simon@lst.de>


Has this been looked at?  Martin?

On Fri, 28 Nov 2008, Simon Hausmann wrote:

> On Thursday 27 November 2008 Nicolas Pitre, wrote:
> > On Thu, 27 Nov 2008, Simon Hausmann wrote:
> > > On Thursday 27 November 2008 20:10:20 Simon Hausmann wrote:
> > > > On Thursday 27 November 2008 18:47:41 Nicolas Pitre wrote:
> > > > > On Thu, 27 Nov 2008, Simon Hausmann wrote:
> > > > > > Hi,
> > > > > >
> > > > > > when running git fsck --full -v (version 1.6.0.4.26.g7c30c) on a
> > > > > > medium sized
> > > > >
> > > > > That version doesn't exist in the git repo.
> > > >
> > > > Ah, oops, it was a merge commit, corresponding to maint as of 5aa3bd.
> > > >
> > > > > > (930M) repository I get a segfault.
> > > > > >
> > > > > > The backtrace indicates an infinite recursion. Here's the output
> > > > > > from the last few lines:
> > > > >
> > > > > [...]
> > > > >
> > > > > Could you try with latest master branch please?  It is more robust
> > > > > against some kind of pack corruptions that could send the code into
> > > > > infinite loops.
> > > >
> > > > Same problem with git version 1.6.0.4.790.gaa14a
> > >
> > > Forgot to paste the changed line numbers of the recursion:
> >
> > [...]
> >
> > Well... Your initial backtrace showed recursion in unpack_entry() which
> > was rather odd in the first place.  Your latest backtrace shows a loop
> > in make_object() which has nothing to do what so ever with
> > unpack_entry().  So the backtrace might not be really useful.
> >
> > I suspect you'll have to bisect git to find the issue, given that some
> > old version can be found to be good.  For example, does it work with
> > v1.5.2.5?
> 
> Ah yes, v1.5.2.5 works! (phew, and it verified that the repo is fine)
> 
> Ok, I bisected and "git bisect run" identified the following commit as first bad 
> commit:
> 
> commit 271b8d25b25e49b367087440e093e755e5f35aa9
> Author: Martin Koegler <mkoegler@auto.tuwien.ac.at>
> Date:   Mon Feb 25 22:46:05 2008 +0100
> 
>     builtin-fsck: move away from object-refs to fsck_walk
> 
> 
> 
> 
> Simon
> 

^ permalink raw reply

* Re: Problems Cloning an SVN repo.
From: Deskin Miller @ 2008-12-09 18:12 UTC (permalink / raw)
  To: Tim Visher; +Cc: git
In-Reply-To: <c115fd3c0812090954n6e5e527anadf04936e1ca01f@mail.gmail.com>

On Tue, Dec 09, 2008 at 12:54:20PM -0500, Tim Visher wrote:
>     Can't locate SVN/Core.pm in @INC (@INC contains:

This is perl's way of saying "you don't have the SVN perl bindings in
some place I can find them".  I've not used git-svn under cygwin and
lack a windows computer to test, but on debian the SVN perl bindings are
in packages called libsvn-perl or libsvn-core-perl; I'd look for
similarly-named packages in cygwin's installer, or alternately packages
related to SVN.  If you're sure that the bindings are already installed,
you can fiddle with perl's module search path to detect them in an
unusual location: look at the -I flag to perl.

If that doesn't work, you can try building svn from source under cygwin,
and installing the perl bindings that way.

Hope that helps,
Deskin Miller

^ permalink raw reply

* Re: Problems Cloning an SVN repo.
From: Peter Harris @ 2008-12-09 18:09 UTC (permalink / raw)
  To: Tim Visher; +Cc: git
In-Reply-To: <c115fd3c0812090954n6e5e527anadf04936e1ca01f@mail.gmail.com>

On Tue, Dec 9, 2008 at 12:54 PM, Tim Visher wrote:
> Hello everyone,
>
> I'm trying to use `git svn clone` to begin to work with a project
> stored in subversion through git for the work I do on the project
> locally.  I installed git through cygwin and I'm getting the following
> error when executing the command.
>
>    Can't locate SVN/Core.pm in @INC (@INC contains:
> /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/5.10/i686-cygwin
> /usr/lib/perl5/5.10 /usr/lib/perl5/site_perl/5.10/i686-cygwin
> /usr/lib/perl5/vendor_perl/5.10/i686-cygwin
> /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8
> /usr/lib/perl5/vendor_perl/5.8 .) at /usr/sbin/git-core//git-svn line
> 29.
>
> Any help?

Did you install the subversion-perl cygwin package?

Peter Harris

^ permalink raw reply

* Problems Cloning an SVN repo.
From: Tim Visher @ 2008-12-09 17:54 UTC (permalink / raw)
  To: git

Hello everyone,

I'm trying to use `git svn clone` to begin to work with a project
stored in subversion through git for the work I do on the project
locally.  I installed git through cygwin and I'm getting the following
error when executing the command.

    Can't locate SVN/Core.pm in @INC (@INC contains:
/usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/5.10/i686-cygwin
/usr/lib/perl5/5.10 /usr/lib/perl5/site_perl/5.10/i686-cygwin
/usr/lib/perl5/vendor_perl/5.10/i686-cygwin
/usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/vendor_perl/5.8 .) at /usr/sbin/git-core//git-svn line
29.

Any help?

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply

* Re: git-bpush: Pushing to a bundle
From: Junio C Hamano @ 2008-12-09 17:32 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Johannes Schindelin, git list
In-Reply-To: <adf1fd3d0812090221t2264a4f9i87b5e23be897ee84@mail.gmail.com>

"Santi Béjar" <santi@agolina.net> writes:

> I do not find convenient strictly incremental bundles, because then
> you (or the other people) needs to fetch every single bundle. What I
> do is add new objects until the bundle is too big and then create a
> bundle with a new base. This way you don't have to worry if the other
> person has applied the last bundle or not.

You both have good points.  I sort of tend to side with your argument from
convenience point of view, if only because that resembles the way how
people traditionally arrange incremental backups "a full dump on Sunday
night, and every day incremental relative to the last full dump".  Dscho's
suggestion is akin to "a full dump on Sunday night, and every day
incremental relative to the previous day".  Both form obviously can
recreate the same contents, but often "incremental since the last full
synchronization point", even though it may make bigger dumps, is easier to
handle for humans.

>>  IOW if you already have a bundle,
>> you want to create a new bundle that contains everything that is new, _in
>> addition_ to the existing bundle.
>
>>> while [ $# != 0 ] ; do
>>
>> Heh, I did not realize just how _used_ I got to the conventions in Git's
>> shell programming, until I thought "Should this not use 'test' instead
>> of brackets?"

Now I see you are improving ;-)

>>> while [ $# != 0 ] ; do
>>>     refs="$refs$LF$1" && shift
>>> done
>>
>> That is equivalent to refs="$*", no?
>
> Almost, IFS is set to line-feed so I needed to put $LF instead of spaces.

If $IFS is set to LF, "$*" will be $1, $2, $3 concatenated with LF in
between.  The first character in $IFS is used for that purpose..

^ permalink raw reply

* Re: Getting submodules to follow symlinks?
From: Edward Z. Yang @ 2008-12-09 17:29 UTC (permalink / raw)
  To: git
In-Reply-To: <57518fd10812090455wd109843mfece11eae9e4f593@mail.gmail.com>

Jonathan del Strother wrote:
> My git repository contains a symlink to another repository.  I'd like
> to make that second repository a submodule of the first, in such a way
> that when someone else clones the repository, there's no trace of the
> original symlink.

Yeah. If you register the submodule and then commit, the first
repository would contain the submodule information, and anyone who loads
submodules in another clone will not see the symlink.

Cheers,
Edward

^ permalink raw reply

* [PATCH] Fix typos in documentation
From: Alexander Potashev @ 2008-12-09 17:26 UTC (permalink / raw)
  To: git; +Cc: gitster, Alexander Potashev

Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
---
 Documentation/git-send-email.txt     |    2 +-
 Documentation/technical/racy-git.txt |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index acf8bf4..1278866 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -46,7 +46,7 @@ The --cc option must be repeated for each user you want on the cc list.
 	Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
 	introductory message for the patch series.
 +
-When compose is in used, git send-email gets less interactive will use the
+When '--compose' is used, git send-email gets less interactive will use the
 values of the headers you set there. If the body of the email (what you type
 after the headers and a blank line) only contains blank (or GIT: prefixed)
 lines, the summary won't be sent, but git-send-email will still use the
diff --git a/Documentation/technical/racy-git.txt b/Documentation/technical/racy-git.txt
index 6bdf034..48bb97f 100644
--- a/Documentation/technical/racy-git.txt
+++ b/Documentation/technical/racy-git.txt
@@ -135,7 +135,7 @@ them, and give the same timestamp to the index file:
 
 This will make all index entries racily clean.  The linux-2.6
 project, for example, there are over 20,000 files in the working
-tree.  On my Athron 64X2 3800+, after the above:
+tree.  On my Athlon 64 X2 3800+, after the above:
 
   $ /usr/bin/time git diff-files
   1.68user 0.54system 0:02.22elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
-- 
1.6.0.4

^ permalink raw reply related

* Re: Forcing --no-ff on pull
From: Stephen Haberman @ 2008-12-09 16:39 UTC (permalink / raw)
  To: R. Tyler Ballance; +Cc: git
In-Reply-To: <1228817565.18611.54.camel@starfruit.local>


> > $ git config branch.stable.mergeoptions "--no-ff"
> 
> I recall stumbling across this a while ago looking at the git-config(1)
> man page, but this isn't /quite/ what we need.
> 
> I'm talking about forcing for *every* pull, it's a safe assumption to
> make that we want a merge commit every time somebody fast-forwards a
> branch. 
> 
> The only way I could think to make use of branch.<name>.mergeoptions
> would be to automagically set it up in a "pre-merge" hook, but alas
> post-merge exists but not pre-merge.

I had done something like this with a post-checkout hook. After checking
out any branch, the hook sets various branch.<name>.options.

Also, I wrote a hook to enforce "only no-ff commits can move stable" and
other fun stuff. It's out on github, in a semi-documented/unannounced
project with the email/trac/etc. hooks we put in place:

http://github.com/stephenh/gc/tree/master/server/update-stable

- Stephen

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox