threads / discuss / 3012

What's new in git.git

Subject: What's new in git.git

## tl;dr

3 messages between Jan 9, 2006 and Jan 9, 2006.

replies: 2people: 2as markdown or json

Junio C Hamano· Jan 9, 2006, 01:20 UTC · lore

Latest maintenance release for GIT 1.0 (1.0.8) and the new feature release GIT 1.1.0 have been pushed out.

Waiting in the proposed updates branch are two backward incompatible changes.

 - Require packfiles to be named pack-[0-9a-f]{40}.pack, and
   issue an warning if [0-9a-f]{40} part does not match the SHA1
   checksum of sorted object names that are contained in the
   pack.  Later I would like to promote the warning to an error,
   and there is a tool to help renaming packs created with older
   git-pack-objects.  When the warning is promoted to an error,
   this will break existing packfiles.
 - Use textual symbolic refs to represent .git/HEAD everywhere,
   not just on filesystems without symbolic link supports.  This
   was proposed by Pavel mid November 2005, but is known to
   break Porcelains that read(2) from .git/HEAD and expect to
   read an object name for the current branch head (use "git
   rev-parse --verify HEAD" instead), and write(2) into
   .git/HEAD and expect to update the current branch head (use
   "git update-ref HEAD $commit [$old]" instead).  Last time I
   checked, gitweb would break with this change.

Also there are patches floating around to update format-patch and rebase. I rejected the initial round, but consider what the latter wants to achieve a worthwhile goal, and expect to update rebase in some form.

Now the core and the barebone Porcelain are more or less stable and changes have significantly slowed down, I think it is a good time to start revisiting the libification effort, started by Smurf. I haven't taken a look at his tree for a while.

Another area that needs attention is to see how we can improve handling of merges between branches that have renamed things (i.e. HPA's klibc repositories). I'd also like to teach renaming merge to resolve strategy somehow.

Other small things I have in mind, in random order, are:
 - Give extra option to "diff-tree -m -p" to show difference
   between natural merge among parents and the actual merge
   result.  I do not think this would make sense for non patch
   format.
 - The recent "git-daemon --base=/pub/git" is a good addition
   (git://host/frotz.git is mapped to /pub/git/frotz.git
   directory), but with the current implementation whitelist
   needs to start with /pub/git/.  I initially thought it was
   not so nice, but maybe it is OK; but this needs to be
   documented.  It also forbids user relative paths, which
   should be made an independent switch.
 - Also in "git-daemon", I outlined --strict-symlink option a
   while ago, which forbids symbolic links to step outside of
   whitelisted areas.  This has not been implemented, and we may
   want to add it.
 - Although Linus has been pretty negative about improving the
   current dumb http transport, many people seem to rely on it.
   It "works" with packfiles in the sense that it does not barf,
   but the server file packing strategy to reduce duplicated
   download needs to be worked out to make it more efficient.
 - If the same cloning requests are made number of times, we
   should be able to cache the packfile we sent out and reuse,
   to reduce the load on the server side.  When used with
   git-daemon, this requires the daemon to be able to write
   somewhere (not necessarily the original repository itself),
   so there is certain security implications.
Junio C Hamano· Jan 9, 2006, 08:42 UTC · re: Junio C Hamano · lore

[PATCH] gitweb: allow working in repositories with textual symref HEAD

There is a change to git-core, proposed by Pavel and cooking for the last 6 weeks, to use textual symref to represent HEAD even on filesystems that support symbolic links. It would break gitweb without this even on UNIX.

The current code is already broken on filesystems that do not handle symbolic links. With this change, gitweb keeps working with repositories whose HEADs are symbolic links.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 Junio C Hamano <junkio@cox.net> writes:
 
 > Waiting in the proposed updates branch are two backward
 > incompatible changes.
 > ...
 >  - Use textual symbolic refs to represent .git/HEAD everywhere,
 >    not just on filesystems without symbolic link supports.  This
 >    was proposed by Pavel mid November 2005, but is known to
 >    break Porcelains that read(2) from .git/HEAD and expect to
 >    read an object name for the current branch head (use "git
 >    rev-parse --verify HEAD" instead), and write(2) into
 >    .git/HEAD and expect to update the current branch head (use
 >    "git update-ref HEAD $commit [$old]" instead).  Last time I
 >    checked, gitweb would break with this change.
 Here is a proposed fix.  It was not clear to me what your
 $ENV{'GIT_DIR'} policy was, so git_read_head tries to play
 safer, but please feel free to drop that part if the rest of
 the code is safe without them.
 gitweb.cgi |   49 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 16 deletions(-)
c903862d1c5d77fe5a1633eb7a40171d98a8dd73
diff --git a/gitweb.cgi b/gitweb.cgi
index 1814f7f..26c7395 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -396,6 +396,23 @@ sub git_get_type {
 	return $type;
 }
 
+sub git_read_head {
+	my $project = shift;
+	my $oENV = $ENV{'GIT_DIR'};
+	my $retval = undef;
+	$ENV{'GIT_DIR'} = "$projectroot/$project";
+	if (open my $fd, "-|", "$gitbin/git-rev-parse", "--verify", "HEAD") {
+		my $head = <$fd>;
+		close $fd;
+		chomp $head;
+		if ($head =~ m/^[0-9a-fA-F]{40}$/) {
+			$retval = $head;
+		}
+	}
+	$ENV{'GIT_DIR'} = $oENV;
+	return $retval;
+}
+
 sub git_read_hash {
 	my $path = shift;
 
@@ -823,7 +840,7 @@ sub git_project_list {
 		die_error(undef, "No project found.");
 	}
 	foreach my $pr (@list) {
-		my $head = git_read_hash("$pr->{'path'}/HEAD");
+		my $head = git_read_head($pr->{'path'});
 		if (!defined $head) {
 			next;
 		}
@@ -994,7 +1011,7 @@ sub git_read_refs {
 
 sub git_summary {
 	my $descr = git_read_description($project) || "none";
-	my $head = git_read_hash("$project/HEAD");
+	my $head = git_read_head($project);
 	my %co = git_read_commit($head);
 	my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
 
@@ -1034,7 +1051,7 @@ sub git_summary {
 	      "<tr><td>owner</td><td>$owner</td></tr>\n" .
 	      "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
 	      "</table>\n";
-	open my $fd, "-|", "$gitbin/git-rev-list --max-count=17 " . git_read_hash("$project/HEAD") or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$gitbin/git-rev-list --max-count=17 " . git_read_head($project) or die_error(undef, "Open failed.");
 	my (@revlist) = map { chomp; $_ } <$fd>;
 	close $fd;
 	print "<div>\n" .
@@ -1172,7 +1189,7 @@ sub git_summary {
 }
 
 sub git_tag {
-	my $head = git_read_hash("$project/HEAD");
+	my $head = git_read_head($project);
 	git_header_html();
 	print "<div class=\"page_nav\">\n" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
@@ -1211,7 +1228,7 @@ sub git_tag {
 }
 
 sub git_tags {
-	my $head = git_read_hash("$project/HEAD");
+	my $head = git_read_head($project);
 	git_header_html();
 	print "<div class=\"page_nav\">\n" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
@@ -1270,7 +1287,7 @@ sub git_tags {
 }
 
 sub git_heads {
-	my $head = git_read_hash("$project/HEAD");
+	my $head = git_read_head($project);
 	git_header_html();
 	print "<div class=\"page_nav\">\n" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
@@ -1343,7 +1360,7 @@ sub git_get_hash_by_path {
 
 sub git_blob {
 	if (!defined $hash && defined $file_name) {
-		my $base = $hash_base || git_read_hash("$project/HEAD");
+		my $base = $hash_base || git_read_head($project);
 		$hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
 	}
 	open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error(undef, "Open failed.");
@@ -1407,13 +1424,13 @@ sub git_blob_plain {
 
 sub git_tree {
 	if (!defined $hash) {
-		$hash = git_read_hash("$project/HEAD");
+		$hash = git_read_head($project);
 		if (defined $file_name) {
-			my $base = $hash_base || git_read_hash("$project/HEAD");
+			my $base = $hash_base || $hash;
 			$hash = git_get_hash_by_path($base, $file_name, "tree");
 		}
 		if (!defined $hash_base) {
-			$hash_base = git_read_hash("$project/HEAD");
+			$hash_base = $hash;
 		}
 	}
 	$/ = "\0";
@@ -1497,7 +1514,7 @@ sub git_tree {
 
 sub git_rss {
 	# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
-	open my $fd, "-|", "$gitbin/git-rev-list --max-count=150 " . git_read_hash("$project/HEAD") or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$gitbin/git-rev-list --max-count=150 " . git_read_head($project) or die_error(undef, "Open failed.");
 	my (@revlist) = map { chomp; $_ } <$fd>;
 	close $fd or die_error(undef, "Reading rev-list failed.");
 	print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
@@ -1566,7 +1583,7 @@ sub git_opml {
 
 	foreach my $pr (@list) {
 		my %proj = %$pr;
-		my $head = git_read_hash("$proj{'path'}/HEAD");
+		my $head = git_read_head($proj{'path'});
 		if (!defined $head) {
 			next;
 		}
@@ -1587,7 +1604,7 @@ sub git_opml {
 }
 
 sub git_log {
-	my $head = git_read_hash("$project/HEAD");
+	my $head = git_read_head($project);
 	if (!defined $hash) {
 		$hash = $head;
 	}
@@ -2083,7 +2100,7 @@ sub git_commitdiff_plain {
 
 sub git_history {
 	if (!defined $hash) {
-		$hash = git_read_hash("$project/HEAD");
+		$hash = git_read_head($project);
 	}
 	my %co = git_read_commit($hash);
 	if (!%co) {
@@ -2159,7 +2176,7 @@ sub git_search {
 		die_error("", "Text field empty.");
 	}
 	if (!defined $hash) {
-		$hash = git_read_hash("$project/HEAD");
+		$hash = git_read_head($project);
 	}
 	my %co = git_read_commit($hash);
 	if (!%co) {
@@ -2300,7 +2317,7 @@ sub git_search {
 }
 
 sub git_shortlog {
-	my $head = git_read_hash("$project/HEAD");
+	my $head = git_read_head($project);
 	if (!defined $hash) {
 		$hash = $head;
 	}
-- 
1.1.0
Kay Sievers· Jan 9, 2006, 12:27 UTC · re: Junio C Hamano · lore

Re: [PATCH] gitweb: allow working in repositories with textual symref HEAD

On Mon, Jan 09, 2006 at 12:42:41AM -0800, Junio C Hamano wrote:
> There is a change to git-core, proposed by Pavel and cooking for
> the last 6 weeks, to use textual symref to represent HEAD even
> on filesystems that support symbolic links.  It would break
> gitweb without this even on UNIX.
Applied and installed on kernel.org.

Thanks, Kay

← back to recent threads