Git development
 help / color / mirror / Atom feed
* [PATCH] gitweb: Restore object-named links in item lists
From: Petr Baudis @ 2006-10-24  3:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <20061024031240.2500.93420.stgit@rover>

This restores the redundant links removed earlier. It supersedes my patch
to stick slashes to tree entries.

Sorry about the previous version of the patch, an unrelated snapshot link
addition to tree entries slipped through (and it it didn't even compile);
I've dropped the idea of snapshot links in tree entries in the meantime
anyway.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4a2025c..661d1dd 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1793,16 +1793,18 @@ sub git_print_tree_entry {
 			                       file_name=>"$basedir$t->{'name'}", %base_key),
 			        -class => "list"}, esc_html($t->{'name'})) . "</td>\n";
 		print "<td class=\"link\">";
+		print $cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
+					     file_name=>"$basedir$t->{'name'}", %base_key)},
+			      "blob");
 		if ($have_blame) {
-			print $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
+			print " | " .
+			      $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
 				                           file_name=>"$basedir$t->{'name'}", %base_key)},
 				            "blame");
 		}
 		if (defined $hash_base) {
-			if ($have_blame) {
-				print " | ";
-			}
-			print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+			print " | " .
+			      $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
 			                             hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
 			              "history");
 		}
@@ -1819,8 +1821,12 @@ sub git_print_tree_entry {
 		              esc_html($t->{'name'}));
 		print "</td>\n";
 		print "<td class=\"link\">";
+		print $cgi->a({-href => href(action=>"tree", hash=>$t->{'hash'},
+					     file_name=>"$basedir$t->{'name'}", %base_key)},
+			      "tree");
 		if (defined $hash_base) {
-			print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+			print " | " .
+			      $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
 			                             file_name=>"$basedir$t->{'name'}")},
 			              "history");
 		}
@@ -1903,6 +1909,9 @@ sub git_difftree_body {
 				print $cgi->a({-href => "#patch$patchno"}, "patch");
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
+			                             hash_base=>$parent, file_name=>$diff{'file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
 			                             file_name=>$diff{'file'})},
 			              "blame") . " | ";
@@ -1948,6 +1957,9 @@ sub git_difftree_body {
 				}
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
+						     hash_base=>$hash, file_name=>$diff{'file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
 			                             file_name=>$diff{'file'})},
 			              "blame") . " | ";
@@ -1988,6 +2000,9 @@ sub git_difftree_body {
 				}
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
+						     hash_base=>$parent, file_name=>$diff{'from_file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
 			                             file_name=>$diff{'from_file'})},
 			              "blame") . " | ";
@@ -2155,6 +2170,7 @@ sub git_shortlog_body {
 		                          href(action=>"commit", hash=>$commit), $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
+		      $cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
 		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
 		      $cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree");
 		if (gitweb_have_snapshot()) {

^ permalink raw reply related

* [PATCH] gitweb: Support for 'forks'
From: Petr Baudis @ 2006-10-24  3:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On repo.or.cz, I want to support project 'forks', which are meant
for repositories which are spinoffs of a given project and share
its objects database through the alternates mechanism. But another
(and perhaps even greater) incentive for that is that those 'forked
projects' do not clutter the main project index but are completely
grouped inside of the project view.

A forked project is just like a normal project, but given project
$projectroot/$projname.git, the forked project resides in directory
$projectroot/$projname/$forkname.git. This is a somewhat arbitrary
naming rule, but I think that for now it's fine; if someone will need
something wildly different, let them submit a patch. The 'forked'
mode is by default off and can be turned on in runtime gitweb
configuration just like other features.

A project having forks is marked by a '+' (pointing to the list of
forks) in the project list (this could become some cutesy AJAXy
DHTML in the future), there is a forks section in the project
summary similar to the heads and tags sections, and of course
a forks view which looks the same as the root project list.

Forks can be recursive.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 gitweb/gitweb.perl |  256 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 174 insertions(+), 82 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 81adc71..f957aee 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -164,6 +164,21 @@ our %feature = (
 	'pathinfo' => {
 		'override' => 0,
 		'default' => [0]},
+
+	# Make gitweb consider projects in project root subdirectories
+	# to be forks of existing projects. Given project $projname.git,
+	# projects matching $projname/*.git will not be shown in the main
+	# projects list, instead a '+' mark will be added to $projname
+	# there and a 'forks' view will be enabled for the project, listing
+	# all the forks. This feature is supported only if project list
+	# is taken from a directory, not file.
+
+	# To enable system wide have in $GITWEB_CONFIG
+	# $feature{'forks'}{'default'} = [1];
+	# Project specific override is not supported.
+	'forks' => {
+		'override' => 0,
+		'default' => [0]},
 );
 
 sub gitweb_check_feature {
@@ -409,6 +424,7 @@ my %actions = (
 	"commitdiff" => \&git_commitdiff,
 	"commitdiff_plain" => \&git_commitdiff_plain,
 	"commit" => \&git_commit,
+	"forks" => \&git_forks,
 	"heads" => \&git_heads,
 	"history" => \&git_history,
 	"log" => \&git_log,
@@ -896,13 +912,19 @@ sub git_get_project_url_list {
 }
 
 sub git_get_projects_list {
+	my ($filter) = @_;
 	my @list;
 
+	$filter ||= '';
+	$filter =~ s/\.git$//;
+
 	if (-d $projects_list) {
 		# search in directory
-		my $dir = $projects_list;
+		my $dir = $projects_list . ($filter ? "/$filter" : '');
 		my $pfxlen = length("$dir");
 
+		my $check_forks = gitweb_check_feature('forks');
+
 		File::Find::find({
 			follow_fast => 1, # follow symbolic links
 			dangling_symlinks => 0, # ignore dangling symlinks, silently
@@ -914,8 +936,10 @@ sub git_get_projects_list {
 
 				my $subdir = substr($File::Find::name, $pfxlen + 1);
 				# we check related file in $projectroot
-				if (check_export_ok("$projectroot/$subdir")) {
-					push @list, { path => $subdir };
+				if ($check_forks and $subdir =~ m#/.#) {
+					$File::Find::prune = 1;
+				} elsif (check_export_ok("$projectroot/$filter/$subdir")) {
+					push @list, { path => ($filter ? "$filter/" : '') . $subdir };
 					$File::Find::prune = 1;
 				}
 			},
@@ -2160,6 +2184,124 @@ sub git_patchset_body {
 
 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
+sub git_project_list_body {
+	my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
+
+	my $check_forks = gitweb_check_feature('forks');
+
+	my @projects;
+	foreach my $pr (@$projlist) {
+		my (@aa) = git_get_last_activity($pr->{'path'});
+		unless (@aa) {
+			next;
+		}
+		($pr->{'age'}, $pr->{'age_string'}) = @aa;
+		if (!defined $pr->{'descr'}) {
+			my $descr = git_get_project_description($pr->{'path'}) || "";
+			$pr->{'descr'} = chop_str($descr, 25, 5);
+		}
+		if (!defined $pr->{'owner'}) {
+			$pr->{'owner'} = get_file_owner("$projectroot/$pr->{'path'}") || "";
+		}
+		if ($check_forks) {
+			my $pname = $pr->{'path'};
+			$pname =~ s/\.git$//;
+			$pr->{'forks'} = -d "$projectroot/$pname";
+		}
+		push @projects, $pr;
+	}
+
+	$order ||= "project";
+	$from = 0 unless defined $from;
+	$to = $#projects if (!defined $to || $#projects < $to);
+
+	print "<table class=\"project_list\">\n";
+	unless ($no_header) {
+		print "<tr>\n";
+		if ($check_forks) {
+			print "<th></th>\n";
+		}
+		if ($order eq "project") {
+			@projects = sort {$a->{'path'} cmp $b->{'path'}} @projects;
+			print "<th>Project</th>\n";
+		} else {
+			print "<th>" .
+			      $cgi->a({-href => href(project=>undef, order=>'project'),
+				       -class => "header"}, "Project") .
+			      "</th>\n";
+		}
+		if ($order eq "descr") {
+			@projects = sort {$a->{'descr'} cmp $b->{'descr'}} @projects;
+			print "<th>Description</th>\n";
+		} else {
+			print "<th>" .
+			      $cgi->a({-href => href(project=>undef, order=>'descr'),
+				       -class => "header"}, "Description") .
+			      "</th>\n";
+		}
+		if ($order eq "owner") {
+			@projects = sort {$a->{'owner'} cmp $b->{'owner'}} @projects;
+			print "<th>Owner</th>\n";
+		} else {
+			print "<th>" .
+			      $cgi->a({-href => href(project=>undef, order=>'owner'),
+				       -class => "header"}, "Owner") .
+			      "</th>\n";
+		}
+		if ($order eq "age") {
+			@projects = sort {$a->{'age'} <=> $b->{'age'}} @projects;
+			print "<th>Last Change</th>\n";
+		} else {
+			print "<th>" .
+			      $cgi->a({-href => href(project=>undef, order=>'age'),
+				       -class => "header"}, "Last Change") .
+			      "</th>\n";
+		}
+		print "<th></th>\n" .
+		      "</tr>\n";
+	}
+	my $alternate = 1;
+	for (my $i = $from; $i <= $to; $i++) {
+		my $pr = $projects[$i];
+		if ($alternate) {
+			print "<tr class=\"dark\">\n";
+		} else {
+			print "<tr class=\"light\">\n";
+		}
+		$alternate ^= 1;
+		if ($check_forks) {
+			print "<td>";
+			if ($pr->{'forks'}) {
+				print $cgi->a({-href => href(project=>$pr->{'path'}, action=>"forks")}, "+");
+			}
+			print "</td>\n";
+		}
+		print "<td>" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary"),
+		                        -class => "list"}, esc_html($pr->{'path'})) . "</td>\n" .
+		      "<td>" . esc_html($pr->{'descr'}) . "</td>\n" .
+		      "<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
+		print "<td class=\"". age_class($pr->{'age'}) . "\">" .
+		      $pr->{'age_string'} . "</td>\n" .
+		      "<td class=\"link\">" .
+		      $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary")   . " | " .
+		      $cgi->a({-href => '/git-browser/by-commit.html?r='.$pr->{'path'}}, "graphiclog") . " | " .
+		      $cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " .
+		      $cgi->a({-href => href(project=>$pr->{'path'}, action=>"tree")}, "tree") .
+		      ($pr->{'forks'} ? " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"forks")}, "forks") : '') .
+		      "</td>\n" .
+		      "</tr>\n";
+	}
+	if (defined $extra) {
+		print "<tr>\n";
+		if ($check_forks) {
+			print "<td></td>\n";
+		}
+		print "<td colspan=\"5\">$extra</td>\n" .
+		      "</tr>\n";
+	}
+	print "</table>\n";
+}
+
 sub git_shortlog_body {
 	# uses global variable $project
 	my ($revlist, $from, $to, $refs, $extra) = @_;
@@ -2378,25 +2520,9 @@ sub git_project_list {
 	}
 
 	my @list = git_get_projects_list();
-	my @projects;
 	if (!@list) {
 		die_error(undef, "No projects found");
 	}
-	foreach my $pr (@list) {
-		my (@aa) = git_get_last_activity($pr->{'path'});
-		unless (@aa) {
-			next;
-		}
-		($pr->{'age'}, $pr->{'age_string'}) = @aa;
-		if (!defined $pr->{'descr'}) {
-			my $descr = git_get_project_description($pr->{'path'}) || "";
-			$pr->{'descr'} = chop_str($descr, 25, 5);
-		}
-		if (!defined $pr->{'owner'}) {
-			$pr->{'owner'} = get_file_owner("$projectroot/$pr->{'path'}") || "";
-		}
-		push @projects, $pr;
-	}
 
 	git_header_html();
 	if (-f $home_text) {
@@ -2406,75 +2532,30 @@ sub git_project_list {
 		close $fd;
 		print "</div>\n";
 	}
-	print "<table class=\"project_list\">\n" .
-	      "<tr>\n";
-	$order ||= "project";
-	if ($order eq "project") {
-		@projects = sort {$a->{'path'} cmp $b->{'path'}} @projects;
-		print "<th>Project</th>\n";
-	} else {
-		print "<th>" .
-		      $cgi->a({-href => href(project=>undef, order=>'project'),
-		               -class => "header"}, "Project") .
-		      "</th>\n";
-	}
-	if ($order eq "descr") {
-		@projects = sort {$a->{'descr'} cmp $b->{'descr'}} @projects;
-		print "<th>Description</th>\n";
-	} else {
-		print "<th>" .
-		      $cgi->a({-href => href(project=>undef, order=>'descr'),
-		               -class => "header"}, "Description") .
-		      "</th>\n";
-	}
-	if ($order eq "owner") {
-		@projects = sort {$a->{'owner'} cmp $b->{'owner'}} @projects;
-		print "<th>Owner</th>\n";
-	} else {
-		print "<th>" .
-		      $cgi->a({-href => href(project=>undef, order=>'owner'),
-		               -class => "header"}, "Owner") .
-		      "</th>\n";
-	}
-	if ($order eq "age") {
-		@projects = sort {$a->{'age'} <=> $b->{'age'}} @projects;
-		print "<th>Last Change</th>\n";
-	} else {
-		print "<th>" .
-		      $cgi->a({-href => href(project=>undef, order=>'age'),
-		               -class => "header"}, "Last Change") .
-		      "</th>\n";
+	git_project_list_body(\@list, $order);
+	git_footer_html();
+}
+
+sub git_forks {
+	my $order = $cgi->param('o');
+	if (defined $order && $order !~ m/project|descr|owner|age/) {
+		die_error(undef, "Unknown order parameter");
 	}
-	print "<th></th>\n" .
-	      "</tr>\n";
-	my $alternate = 1;
-	foreach my $pr (@projects) {
-		if ($alternate) {
-			print "<tr class=\"dark\">\n";
-		} else {
-			print "<tr class=\"light\">\n";
-		}
-		$alternate ^= 1;
-		print "<td>" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary"),
-		                        -class => "list"}, esc_html($pr->{'path'})) . "</td>\n" .
-		      "<td>" . esc_html($pr->{'descr'}) . "</td>\n" .
-		      "<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
-		print "<td class=\"". age_class($pr->{'age'}) . "\">" .
-		      $pr->{'age_string'} . "</td>\n" .
-		      "<td class=\"link\">" .
-		      $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary")   . " | " .
-		      $cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " .
-		      $cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " .
-		      $cgi->a({-href => href(project=>$pr->{'path'}, action=>"tree")}, "tree") .
-		      "</td>\n" .
-		      "</tr>\n";
+
+	my @list = git_get_projects_list($project);
+	if (!@list) {
+		die_error(undef, "No forks found");
 	}
-	print "</table>\n";
+
+	git_header_html();
+	git_print_page_nav('','');
+	git_print_header_div('summary', "$project forks");
+	git_project_list_body(\@list, $order);
 	git_footer_html();
 }
 
 sub git_project_index {
-	my @projects = git_get_projects_list();
+	my @projects = git_get_projects_list($project);
 
 	print $cgi->header(
 		-type => 'text/plain',
@@ -2517,6 +2598,10 @@ sub git_summary {
 			push @taglist, $ref;
 		}
 	}
+	my @forklist;
+	if (gitweb_check_feature('forks')) {
+		@forklist = git_get_projects_list($project);
+	}
 
 	git_header_html();
 	git_print_page_nav('summary','', $head);
@@ -2567,6 +2652,13 @@ sub git_summary {
 		               $cgi->a({-href => href(action=>"heads")}, "..."));
 	}
 
+	if (@forklist) {
+		git_print_header_div('forks');
+		git_project_list_body(\@forklist, undef, 0, 15,
+		                      $cgi->a({-href => href(action=>"forks")}, "..."),
+				      'noheader');
+	}
+
 	git_footer_html();
 }
 

^ permalink raw reply related

* Re: VCS comparison table
From: David Clymer @ 2006-10-24  3:24 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Matthew D. Fuller, Andreas Ericsson, Linus Torvalds, Carl Worth,
	bazaar-ng, git
In-Reply-To: <200610231454.06355.jnareb@gmail.com>

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

On Mon, 2006-10-23 at 14:54 +0200, Jakub Narebski wrote:
> On Mon, Oct 23, 2006 David Clymer wrote:
> > On Sun, 2006-10-22 at 22:06 +0200, Jakub Narebski wrote:
> >> David Clymer wrote:
> 
> >>> 2. bzr does not support fully distributed development because revnos
> >>> "don't work" as stated in #1.
> >>
> >> Bazaar is biased towards centralized/star-topology development if we
> >> want to use revnos. In fully distributed configuration there is no
> >> "simple namespace".
> > 
> > So revnos aren't globally meaningful in fully distributed settings. So
> > what? I don't see how this translates into bias. There is a lot of
> > functionality provided by bazaar that doesn't really apply to my use
> > case, but it doesn't mean that it is indicative of some bias in bazaar.
> 
> First, bzr is biased towards using revnos: bzr commands uses revnos
> by default to provide revision (you have to use revid: prefix/operator
> to use revision identifiers), bzr commands outputs revids only when
> requested, examples of usage uses revision numbers.

Agreed. Of course, I want the simplest case to be the simplest. When
working on my own branch, regardless if it is a standalone project or
part of a distributed one, I don't want to have to type SHA hashes or
revids. Numbers serve my purposes best in this case. When I communicate
with other distributed developers, I can and should use revids.

> 
> In order to use revnos as _global_ identifiers in distributed development,
> you need central "branch", mainline, to provide those revnos. You have
> either to have access to this "revno server" and refer to revisions by
> "revno server" URL and revision number, or designate one branch as holding
> revision numbers ("revno server") and preserve revnos on "revno server"
> by using bzr "merge", while copying revnos when fetching by using bzr "pull"
> for leaf branches. In short: for revnos to be global identifiers you need
> star-topology.

Ok. Let's not repeat this again. I think I said this once, and you've
said it in two following emails. It's a given. Assume that we all know
it.

> 
> Even if you use revnos only locally, you need to know which revisions are
> "yours", i.e. beside branch as DAG of history of given revision you need
> "ordered series of revisions" (to quote Bazaar-NG wiki Glossary), or path
> through this diagram from given revision to one of the roots (initial,
> parentless revisions). Because bzr does that by preserving mentioned path
> as first-parent path (treating first parent specially), i.e. storing local
> information in a DAG (which is shared), to preserve revnos you need to
> use "merge" instead of "pull", which means that you get empty-merge in
> clearly fast-forward case. This means "local changes bias", which some
> might take as not being fully distributed.

"local changes bias" I can buy that. I even like it. I don't even care
if that makes bazaar "not fully distributed." I don't think the
distinction between "fully" and "almost, except for some technicality"
distributed is one that has much practical value.

-davidc
-- 
gpg-key: http://www.zettazebra.com/files/key.gpg

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

^ permalink raw reply

* [PATCH] gitweb: Show project's README.html if available
From: Petr Baudis @ 2006-10-24  3:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

If the repository includes a README.html file, show it in the summary page.
The usual "this should be in the config file" argument does not apply here
since this can be larger and having such a big string in the config file
would be impractical.

I don't know if this is suitable upstream, but it's one of the repo.or.cz
custom modifications that I've thought could be interesting for others
as well.

Compared to the previous patch, this adds the '.html' extension to the
filename, so that it's clear it is, well, HTML.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 gitweb/gitweb.perl |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3b26ec3..81adc71 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2538,6 +2538,14 @@ sub git_summary {
 	}
 	print "</table>\n";
 
+	if (-s "$projectroot/$project/README.html") {
+		if (open my $fd, "$projectroot/$project/README.html") {
+			print "<div class=\"title\">readme</div>\n";
+			print $_ while (<$fd>);
+			close $fd;
+		}
+	}
+
 	open my $fd, "-|", git_cmd(), "rev-list", "--max-count=17",
 		git_get_head_hash($project)
 		or die_error(undef, "Open git-rev-list failed");

^ permalink raw reply related

* [PATCH] gitweb: Do not automatically append " git" to custom site name
From: Petr Baudis @ 2006-10-24  3:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <20061011220621.GA4041@coredump.intra.peff.net>

If you customized the site name, you probably do not want the " git"
appended so that the page title is not bastardized; I want repo.or.cz pages
titled "Public Git Hosting", not "Public Git Hosting git" (what's hosting
what?).

This slightly changes the $site_name semantics but only very
insignificantly.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e77fc11..1e80f43 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -39,7 +39,8 @@ our $home_link_str = "++GITWEB_HOME_LINK
 
 # name of your site or organization to appear in page titles
 # replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++" || $ENV{'SERVER_NAME'} || "Untitled";
+our $site_name = "++GITWEB_SITENAME++"
+                 || ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
 
 # filename of html text to include at top of each page
 our $site_header = "++GITWEB_SITE_HEADER++";
@@ -1433,7 +1434,7 @@ sub git_header_html {
 	my $status = shift || "200 OK";
 	my $expires = shift;
 
-	my $title = "$site_name git";
+	my $title = "$site_name";
 	if (defined $project) {
 		$title .= " - $project";
 		if (defined $action) {
@@ -3847,7 +3848,7 @@ sub git_opml {
 <?xml version="1.0" encoding="utf-8"?>
 <opml version="1.0">
 <head>
-  <title>$site_name Git OPML Export</title>
+  <title>$site_name OPML Export</title>
 </head>
 <body>
 <outline text="git RSS feeds">

^ permalink raw reply related

* [PATCH] gitweb: Make search type a popup menu
From: Petr Baudis @ 2006-10-24  3:15 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This makes the multiple search types actually usable by the user;
if you don't read the gitweb source, you don't even have an idea
that you can write things like that there.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 gitweb/gitweb.css  |    2 ++
 gitweb/gitweb.perl |   61 ++++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 3f62b6d..0eda982 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -333,6 +333,8 @@ div.index_include {
 }
 
 div.search {
+	font-size: 12px;
+	font-weight: normal;
 	margin: 4px 8px;
 	position: absolute;
 	top: 56px;
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 695c632..e77fc11 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -342,6 +342,13 @@ if (defined $searchtext) {
 	$searchtext = quotemeta $searchtext;
 }
 
+our $searchtype = $cgi->param('st');
+if (defined $searchtype) {
+	if ($searchtype =~ m/[^a-z]/) {
+		die_error(undef, "Invalid searchtype parameter");
+	}
+}
+
 # now read PATH_INFO and use it as alternative to parameters
 sub evaluate_path_info {
 	return if defined $project;
@@ -406,6 +413,7 @@ my %actions = (
 	"log" => \&git_log,
 	"rss" => \&git_rss,
 	"search" => \&git_search,
+	"search_help" => \&git_search_help,
 	"shortlog" => \&git_shortlog,
 	"summary" => \&git_summary,
 	"tag" => \&git_tag,
@@ -455,6 +463,7 @@ sub href(%) {
 		page => "pg",
 		order => "o",
 		searchtext => "s",
+		searchtype => "st",
 	);
 	my %mapping = @mapping;
 
@@ -1528,6 +1537,10 @@ #provides backwards capability for those
 		      $cgi->hidden(-name => "p") . "\n" .
 		      $cgi->hidden(-name => "a") . "\n" .
 		      $cgi->hidden(-name => "h") . "\n" .
+		      $cgi->popup_menu(-name => 'st', -default => 'commit',
+				       -values => ['commit', 'author', 'committer', 'pickaxe']) .
+		      $cgi->sup($cgi->a({-href => href(action=>"search_help")}, "?")) .
+		      " search:\n",
 		      $cgi->textfield(-name => "s", -value => $searchtext) . "\n" .
 		      "</div>" .
 		      $cgi->end_form() . "\n";
@@ -3573,18 +3586,8 @@ sub git_search {
 		die_error(undef, "Unknown commit object");
 	}
 
-	my $commit_search = 1;
-	my $author_search = 0;
-	my $committer_search = 0;
-	my $pickaxe_search = 0;
-	if ($searchtext =~ s/^author\\://i) {
-		$author_search = 1;
-	} elsif ($searchtext =~ s/^committer\\://i) {
-		$committer_search = 1;
-	} elsif ($searchtext =~ s/^pickaxe\\://i) {
-		$commit_search = 0;
-		$pickaxe_search = 1;
-
+	$searchtype ||= 'commit';
+	if ($searchtype eq 'pickaxe') {
 		# pickaxe may take all resources of your box and run for several minutes
 		# with every query - so decide by yourself how public you make this feature
 		my ($have_pickaxe) = gitweb_check_feature('pickaxe');
@@ -3592,23 +3595,24 @@ sub git_search {
 			die_error('403 Permission denied', "Permission denied");
 		}
 	}
+
 	git_header_html();
 	git_print_page_nav('','', $hash,$co{'tree'},$hash);
 	git_print_header_div('commit', esc_html($co{'title'}), $hash);
 
 	print "<table cellspacing=\"0\">\n";
 	my $alternate = 1;
-	if ($commit_search) {
+	if ($searchtype eq 'commit' or $searchtype eq 'author' or $searchtype eq 'committer') {
 		$/ = "\0";
 		open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", $hash or next;
 		while (my $commit_text = <$fd>) {
 			if (!grep m/$searchtext/i, $commit_text) {
 				next;
 			}
-			if ($author_search && !grep m/\nauthor .*$searchtext/i, $commit_text) {
+			if ($searchtype eq 'author' && !grep m/\nauthor .*$searchtext/i, $commit_text) {
 				next;
 			}
-			if ($committer_search && !grep m/\ncommitter .*$searchtext/i, $commit_text) {
+			if ($searchtype eq 'committer' && !grep m/\ncommitter .*$searchtext/i, $commit_text) {
 				next;
 			}
 			my @commit_lines = split "\n", $commit_text;
@@ -3650,7 +3654,7 @@ sub git_search {
 		close $fd;
 	}
 
-	if ($pickaxe_search) {
+	if ($searchtype eq 'pickaxe') {
 		$/ = "\n";
 		my $git_command = git_cmd_str();
 		open my $fd, "-|", "$git_command rev-list $hash | " .
@@ -3710,6 +3714,31 @@ sub git_search {
 	git_footer_html();
 }
 
+sub git_search_help {
+	git_header_html();
+	git_print_page_nav('','', $hash,$hash,$hash);
+	print <<EOT;
+<dl>
+<dt><b>commit</b></dt>
+<dd>The commit messages and authorship information will be scanned for the given string.</dd>
+<dt><b>author</b></dt>
+<dd>Name and e-mail of the change author and date of birth of the patch will be scanned for the given string.</dd>
+<dt><b>committer</b></dt>
+<dd>Name and e-mail of the committer and date of commit will be scanned for the given string.</dd>
+EOT
+	my ($have_pickaxe) = gitweb_check_feature('pickaxe');
+	if ($have_pickaxe) {
+		print <<EOT;
+<dt><b>pickaxe</b></dt>
+<dd>All commits that caused the string to appear or disappear from any file (changes that
+added, removed or "modified" the string) will be listed. This search can take a while and
+takes a lot of strain on the server, so please use it wisely.</dd>
+EOT
+	}
+	print "</dl>\n";
+	git_footer_html();
+}
+
 sub git_shortlog {
 	my $head = git_get_head_hash($project);
 	if (!defined $hash) {

^ permalink raw reply related

* [PATCH] gitweb: Restore object-named links in item lists
From: Petr Baudis @ 2006-10-24  3:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This restores the redundant links removed earlier. It supersedes my patch
to stick slashes to tree entries.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 gitweb/gitweb.perl |   33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4a2025c..695c632 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1793,16 +1793,18 @@ sub git_print_tree_entry {
 			                       file_name=>"$basedir$t->{'name'}", %base_key),
 			        -class => "list"}, esc_html($t->{'name'})) . "</td>\n";
 		print "<td class=\"link\">";
+		print $cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
+					     file_name=>"$basedir$t->{'name'}", %base_key)},
+			      "blob");
 		if ($have_blame) {
-			print $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
+			print " | " .
+			      $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
 				                           file_name=>"$basedir$t->{'name'}", %base_key)},
 				            "blame");
 		}
 		if (defined $hash_base) {
-			if ($have_blame) {
-				print " | ";
-			}
-			print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+			print " | " .
+			      $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
 			                             hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
 			              "history");
 		}
@@ -1819,11 +1821,20 @@ sub git_print_tree_entry {
 		              esc_html($t->{'name'}));
 		print "</td>\n";
 		print "<td class=\"link\">";
+		print $cgi->a({-href => href(action=>"tree", hash=>$t->{'hash'},
+					     file_name=>"$basedir$t->{'name'}", %base_key)},
+			      "tree");
 		if (defined $hash_base) {
-			print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+			print " | " .
+			      $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
 			                             file_name=>"$basedir$t->{'name'}")},
 			              "history");
 		}
+		if ($have_snapshot) {
+			print " | " .
+			      $cgi->a({-href => href(action=>"snapshot", hash=>$t->{'hash'})},
+			              "snapshot");
+		}
 		print "</td>\n";
 	}
 }
@@ -1903,6 +1914,9 @@ sub git_difftree_body {
 				print $cgi->a({-href => "#patch$patchno"}, "patch");
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
+			                             hash_base=>$parent, file_name=>$diff{'file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
 			                             file_name=>$diff{'file'})},
 			              "blame") . " | ";
@@ -1948,6 +1962,9 @@ sub git_difftree_body {
 				}
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
+						     hash_base=>$hash, file_name=>$diff{'file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
 			                             file_name=>$diff{'file'})},
 			              "blame") . " | ";
@@ -1988,6 +2005,9 @@ sub git_difftree_body {
 				}
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
+						     hash_base=>$parent, file_name=>$diff{'from_file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
 			                             file_name=>$diff{'from_file'})},
 			              "blame") . " | ";
@@ -2155,6 +2175,7 @@ sub git_shortlog_body {
 		                          href(action=>"commit", hash=>$commit), $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
+		      $cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
 		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
 		      $cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree");
 		if (gitweb_have_snapshot()) {

^ permalink raw reply related

* [PATCH] Fix bad usage of mkpath in builtin-branch.sh
From: Lars Hjemli @ 2006-10-24  1:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

When checking if a branch start point referred to a commit-object,
the result of mkpath() was used as argument to get_sha1(), which
didn't work out as planned.

Now it's xstrdup'd first.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 builtin-branch.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index ffc2db0..f86bf68 100755
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -125,6 +125,7 @@ static void create_branch(const char *na
 	struct ref_lock *lock;
 	unsigned char sha1[20];
 	char ref[PATH_MAX], msg[PATH_MAX + 20];
+	const char *commitref;
 
 	snprintf(ref, sizeof ref, "refs/heads/%s", name);
 	if (check_ref_format(ref))
@@ -137,8 +138,10 @@ static void create_branch(const char *na
 			die("Cannot force update the current branch.");
 	}
 
-	if (get_sha1(mkpath("%s^0", start), sha1))
+	commitref = xstrdup(mkpath("%s^0", start));
+	if (get_sha1(commitref, sha1))
 		die("Not a valid branch point: '%s'.", start);
+	free(commitref);
 
 	lock = lock_any_ref_for_update(ref, NULL);
 	if (!lock)
-- 
1.4.3.1.ga4cc-dirty

^ permalink raw reply related

* updating only changed files source directory?
From: Han-Wen Nienhuys @ 2006-10-24  1:33 UTC (permalink / raw)
  To: git


Hello there,

I'm just starting out with GIT.  Initially, I want to use experiment 
with integrating it into our binary builder structure for LilyPond.

The binary builder roughly does this:

  1. get source code updates from a server to a single, local
     repository. This is currently a git repository that is that
     tracks our CVS server.

  2. copy latest commit from a branch to separate source directory.
     This copy should only update files that changed.

  3. Incrementally compile from that source directory

The binary builder does this for several branches and several
platforms of the project. Due to parallel compilation, it might even
be possible that different branches of are being checked out
concurrently from a single repository.

For a VCS, this is slightly nonstandard use, as we don't do any work
in the working dir, we just compile from it, but have many working
directories.


I have some questions and remarks

* Is there a command analogous to git-clone for updating a repository?
Right now, I'm using a combination of

   git-http-fetch -a <branch>  <url>
   wget <url>/refs/head/<branch>    ## dump to <myrepo>/refs/head/<branch>

for all branches I want to know about.  I was looking for a command
that would update the heads of all branches.


* Why is the order of args in git-http-fetch inconsistent with the
order in git-fetch? in fetch, the repository comes first, in
http-fetch, it comes last


* How do I update a source directory?

I can do the following

   git --git-dir <myrepo> read-tree <committish>

   cd <srcdir>
   git --git-dir <myrepo> checkout-index -a -f

Unfortunately, this touches all files, which messes up the timestamps
triggering needless recompilation. How can I make checkout-index only
touch files that have changed?  Or alternatively,  make checkout-index
remember timestamps on files that didn't change?

Of course, I can store the commitish of the last version of the
srcdir, and apply the diff between both to the source directory, but 
that seems somewhat convoluted. Is there a better way?


* As far as I can see, there is no reason to have only one index in a
git repository. Why isn't it possible to specify an alternate
index-file with an option similar to --git-dir ?


-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

^ permalink raw reply

* Re: git.kernel.org disconnects when git-1.3.3 tries to pull changes
From: Junio C Hamano @ 2006-10-24  1:23 UTC (permalink / raw)
  To: Simon Arlott; +Cc: git
In-Reply-To: <453D583E.3010601@simon.arlott.org.uk>

Yes, this is a recent breakage.  Thanks for bringing it up.

We need at least a fix like this in 'maint'.

diff --git a/daemon.c b/daemon.c
index ad84928..e66bb80 100644
--- a/daemon.c
+++ b/daemon.c
@@ -450,6 +450,8 @@ void fill_in_extra_table_entries(struct 
 	 * Replace literal host with lowercase-ized hostname.
 	 */
 	hp = interp_table[INTERP_SLOT_HOST].value;
+	if (!hp)
+		return;
 	for ( ; *hp; hp++)
 		*hp = tolower(*hp);
 
@@ -544,8 +546,10 @@ #endif
 		loginfo("Extended attributes (%d bytes) exist <%.*s>",
 			(int) pktlen - len,
 			(int) pktlen - len, line + len + 1);
-	if (len && line[len-1] == '\n')
+	if (len && line[len-1] == '\n') {
 		line[--len] = 0;
+		pktlen--;
+	}
 
 	/*
 	 * Initialize the path interpolation table for this connection.

^ permalink raw reply related

* Re: VCS comparison table
From: Carl Worth @ 2006-10-24  0:47 UTC (permalink / raw)
  To: Matthew D. Fuller
  Cc: Linus Torvalds, Jakub Narebski, bazaar-ng, git, Erik Bågfors
In-Reply-To: <20061024002657.GD17019@over-yonder.net>

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

On Mon, 23 Oct 2006 19:26:57 -0500, "Matthew D. Fuller" wrote:
>
> On Mon, Oct 23, 2006 at 04:24:30PM -0700 I heard the voice of
> Linus Torvalds, and lo! it spake thus:
> >
> > The problem? How do you show a commit that is _common_ to two
> > branches, but has different revision names in them?
>
> Why would you?

Assume you've got two long-lived branches and one periodically gets
merged into the other one. The combined history might look as follows
(more recent commits first):

 f   g
 |   |
 d   e
 |\ /
 b c
 |/
 a

The point is that it is extremely nice to be able to visualize things
that way. Say I've got a "dev" branch that points at f and a "stable"
branch that points at g. With this, a command like:

	gitk dev stable

would result in a picture just like the above. Can a similar figure be
made with bzr? Or only the following two separate pictures:

 f    g
 |    |
 d    e
 |\   |
 b c  c
 |/   |
 a    a

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: VCS comparison table
From: Martin Langhoff @ 2006-10-24  0:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Erik Bågfors, Jakub Narebski, bazaar-ng, git
In-Reply-To: <Pine.LNX.4.64.0610231623340.3962@g5.osdl.org>

On 10/24/06, Linus Torvalds <torvalds@osdl.org> wrote:
> On Tue, 24 Oct 2006, Erik Bågfors wrote:
> >
> > I don't see any problem doing a "gitk --all" equivalent in bzr.
>
> The problem? How do you show a commit that is _common_ to two branches,
> but has different revision names in them?

Eric,

coming from an Arch background, I understand the whole per-branch
commitids approach. After using GIT for a while, you start realising
that it tries to pin down things in the wrong place.

This is specially visible if you run `gitk --all` before and after a
merge. Or on a project with many merges (if you can, get a checkout of
git itself, and browse its history with gitk).

Before the merge, you see

 --o--o--o--o
    \
     \--o--o

and after

 --o--o--o--o
    \        \
     \--o--o--o

Now, after it's merged somewhere, both commits are part of its
history, regardless of where they come from. And it is very clear if
two branches have been merging and remerging.

Where a commit originated does not matter. And fancy
repo-and-branch-centric names get in the way. A lot. And they re
mostly meaningless as soon as you put what matters in the commit
message. Which means that that bit of metadata that you are hoping
that the revno keeps "indirectly" isn't lost on cherry picking.

I guess that's where I used to find revnos useful as they contained
some basic metadata. With bzr it seems to be author-repo-branch where
branch is hopefully "line of work" but all of that can be (and should
be) in the commit message.

You can see similar info in the first part of the commit message for
most git-hosted projects. It'll say something like

   cvsserver: fix the frobnicator to be sequential

which means that at that point, you could be working in a branch
called fix-this-fscking-thing-attempt524" and no-one would know ;-)

And in a few years (even months) time, that bit of metadata you were
hoping to keep is totally irrelevant. What you have in the commit
message remains relevant and useful.

cheers,


martin

^ permalink raw reply

* [PATCH] gitweb: Fix setting $/ in parse_commit()
From: Petr Baudis @ 2006-10-24  0:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

If the commit couldn't have been read, $/ wasn't restored to \n properly,
causing random havoc like git_get_ref_list() returning the ref names with
trailing \n.

Aside of potential confusion in the body of git_search(), no other $/
surprises are hopefully hidden in the code.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 13f04d6..9868485 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1165,12 +1165,11 @@ sub parse_commit {
 	if (defined $commit_text) {
 		@commit_lines = @$commit_text;
 	} else {
-		$/ = "\0";
+		local $/ = "\0";
 		open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", "--max-count=1", $commit_id
 			or return;
 		@commit_lines = split '\n', <$fd>;
 		close $fd or return;
-		$/ = "\n";
 		pop @commit_lines;
 	}
 	my $header = shift @commit_lines;

^ permalink raw reply related

* Re: VCS comparison table
From: Matthew D. Fuller @ 2006-10-24  0:38 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jakub Narebski, bazaar-ng, git, Erik Bågfors
In-Reply-To: <20061024002657.GD17019@over-yonder.net>

On Mon, Oct 23, 2006 at 07:26:57PM -0500 I heard the voice of
Matthew D. Fuller, and lo! it spake thus:
> On Mon, Oct 23, 2006 at 04:24:30PM -0700 I heard the voice of
> Linus Torvalds, and lo! it spake thus:
> > 
> > The problem? How do you show a commit that is _common_ to two
> > branches, but has different revision names in them?
> 
> Why would you?

I beg your pardon; that was awful ambiguous of me.  I meant "In such a
case, where the whole purpose of what you're doing is to you're look
at multiple branches to see relationships between them, why WOULD you
be using branch-local identifiers for revisions at all?"


-- 
Matthew Fuller     (MF4839)   |  fullermd@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.

^ permalink raw reply

* Re: VCS comparison table
From: Matthew D. Fuller @ 2006-10-24  0:26 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Erik Bågfors, bazaar-ng, git, Jakub Narebski
In-Reply-To: <Pine.LNX.4.64.0610231623340.3962@g5.osdl.org>

On Mon, Oct 23, 2006 at 04:24:30PM -0700 I heard the voice of
Linus Torvalds, and lo! it spake thus:
> 
> The problem? How do you show a commit that is _common_ to two
> branches, but has different revision names in them?

Why would you?


-- 
Matthew Fuller     (MF4839)   |  fullermd@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.

^ permalink raw reply

* Re: VCS comparison table
From: Matthew D. Fuller @ 2006-10-24  0:26 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: bazaar-ng, git
In-Reply-To: <Pine.LNX.4.64.0610231534010.3962@g5.osdl.org>

On Mon, Oct 23, 2006 at 03:44:13PM -0700 I heard the voice of
Linus Torvalds, and lo! it spake thus:
> 
> gitk (and all other logging functions) can take as its argument a
> set of arbitrary revision expressions.
  [...]
> And trust me, these are all very valid things to do, even though
> you're talking about different branches.

I have zero problem believing that.  It seems from all accounts a
wonderful swiss-army chainsaw, and while none of that power is useful
to me personally in anything I'm VCS'ing at the moment, I'd feel awful
shiny knowing it was sitting there waiting for me.  All else being
equal, I'd think more highly of a VCS with those capabilities than one
without.

bzr-the-program doesn't have a lot of that capability, and what it
does have is rather more verbose to access.  Perhaps some attribute of
bzr-the-current-storage-model would make some bit of that
significantly more expensive than it has to be (I don't know of any,
and can't think offhand of anywhere it might hide, but that's way off
my turf).

But I don't understand how bzr-the-abstract-data-model makes such
things impossible, or even significantly different than doing so in
git.  In git, you're just chopping off one DAG where another one
intersects it (or similar operations).  To do it in bzr, you'd do...
exactly the same thing.  The revnos, or the mainline, are completely
useless in such an operation of course, but they don't hurt it; the
tool would just just ignore them like it does the SHA-1 of files in
the revision.


> See? When you visualize multiple branches together, HAVING
> PER-BRANCH REVISION NUMBERS IS INSANE! Yet, clearly, it's a valid
> and interesting operation to do.

I wouldn't be so absolutist about it, but certainly they're of
extremely limited utility if of any at all in such cases.  And yes, it
can be an interesting operation.  But what does that have to do with
using revnos in other cases?  You keep saying "having" where I would
say "using".


> No. If you "undo", you'd undo the whole history too. And if you undo
> to a point that was on a branch, you'd have to re-write _all_ the
> revision ID's.

Well, I guess in this particular case I still don't see why you'd
generally undo big hunks of a branch versus just flipping your working
tree to different versions.  But contrived examples are still
examples, and even if so, truncate()'ing a list of numbers is a
constant time operation.  And even if you had to renumber totally...
my $DEITY, I'd expect my old 200MHz PPro to renumber a hundred
thousand rev long mainline in half a second.


> > I consider it a _technical_ sign of a way of thinking about
> > branches I prefer   8-}
> 
> Quite frankly, I just don't think you understand what it means.

Quite frankly, I just don't think you understand that I WANT to care
about first parents.  No, really.  Seriously.  I really really really
want to.  If my VCS didn't give me numbers along the mainline, I'd
still care out it.  If the revisions were all named SHA-1 hashes, I'd
still care about it.  If I had a metric quidnillion ways to
cross-section and compare branches, I'd still care about it.

This comes with costs.  Chief among them is a restriction of my
actions; I can't fast-forward branches where I care about the
mainline.  That's a cost.  That means I have to take some care about
what operations I perform.  I *GLEEFULLY* pony up that cost.

Because I care about the mainline, revnos can be useful.  I like
revnos.  It has to cost SOMETHING to come up with them (though there
seems to be disagreement about the size of that cost), since doing
'x+y' will always cost more than doing 'x'.  I've never seen a case
where that cost even appeared MEASURABLE, much less significant
(things have to be pretty expensive to compare to the cost of starting
up python and loading a bunch of files into it ;).  So far, I've not
seen the slightest hint of a cost that would make it even worth asking
the question of whether the cost is worth it to me.


I care about that first parent line.  Therefore, I require my tool to
at least _pretend_ to care.  I'm not aware of any way in which the
fundamental bzr structures care, but the UI is chock full of
pretending.  A necessary part of that pretending is not changing my
mainline unless I specifically ask for it, and that means a
merge-vs-pull distinction needs to be there.  That's a _technical_
sign that the tool is ready to work with me the way I want to work.  A
lack of it is a _technical_ sign that it's not suitable.

You, by your own words, don't care about the first parent line.  Your
tool naturally reflects this.  From that perspective, *ANY* cost for
maintaining such a thing is Bad And Wrong, and so you condemn it.
Those condemnations will keep failing to carry any weight with me,
though, as long as I care about that mainline and value the benefits I
find in it.


Maybe I won't always.  2 years ago, I could maybe see some benefits in
DVCS, but I couldn't imagine what possible use they could ever be to
me in anything I do.  Today, I'm using one (if lightly by the
standards of a lot of people in this discussion), and chafing at every
centralized system I have to deal with.  In 5 years, I may be standing
beside you slugging it out at those lunatics and hacks who keep
begging to pay these whopper costs, just to be able to do extra work
to maintain an ordering of parents that doesn't matter for crap.
Could be.  I've changed my mind about far more momentous things in my
life.

Maybe someday I'll still care, but the OTHER advantages of a system
(like git) that doesn't over all the ones that do will outweigh the
advantages I gain from that distinction.  Someday I might need such
ultra-expressive ways of comparing branches, and bzr won't have grown
them yet.  Someday I might reach a point where bzr's performance due
to the choice of storage structures or implementation language or
developer habits or whatever else just doesn't cut the mustard, and
git's does.  Someday, some set of other advantages may make it
worthwhile for me to give up my preciouss mainline no matter how much
I might still crave it.

But I can only work from today.  Today, I do care.  Today, it's well
worth whatever I give up to get it.  And I like that my tool makes
that caring easy for me.


-- 
Matthew Fuller     (MF4839)   |  fullermd@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.

^ permalink raw reply

* git.kernel.org disconnects when git-1.3.3 tries to pull changes
From: Simon Arlott @ 2006-10-24  0:03 UTC (permalink / raw)
  To: git

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

$ git --version
git version 1.3.3

$ git pull
fatal: unexpected EOF
Fetch failure: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/

[pid 14283] write(3, "0046git-upload-pack /pub/scm/linux/kernel/git/torvalds/linux-2.6.git/\n", 70) = 70

$ nc -vv git.kernel.org git
DNS fwd/rev mismatch: zeus-pub.kernel.org != zeus-pub1.kernel.org
DNS fwd/rev mismatch: zeus-pub.kernel.org != zeus-pub2.kernel.org
zeus-pub.kernel.org [204.152.191.5] 9418 (git) open
0046git-upload-pack /pub/scm/linux/kernel/git/torvalds/linux-2.6.git/
 sent 70, rcvd 0
$

<pasky> the difference seems to be just that newer git version sends a host information
<pasky> anyway, this isn't supposed to happen
<pasky> could you mail the mailing list, please?

-- 
Simon Arlott


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 829 bytes --]

^ permalink raw reply

* [PATCH] Git-branch: fix regression and style issues
From: Lars Hjemli @ 2006-10-23 23:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vk62qwtk7.fsf@assigned-by-dhcp.cox.net>

This is on top of my previuos patch to builtin-branch.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 builtin-branch.c |   17 ++++++++---------
 builtin.h        |    2 +-
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index 3105efd..ffc2db0 100755
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -11,7 +11,7 @@ #include "commit.h"
 #include "builtin.h"
 
 static const char builtin_branch_usage[] =
-"git-branch [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r";
+"git-branch (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>] | [-r]";
 
 
 static const char *head;
@@ -74,7 +74,7 @@ static void delete_branches(int argc, co
 			printf("Error deleting branch '%s'\n", argv[i]);
 		else
 			printf("Deleted branch %s.\n", argv[i]);
-			
+
 		free(name);
 	}
 }
@@ -82,11 +82,11 @@ static void delete_branches(int argc, co
 static int ref_index, ref_alloc;
 static char **ref_list;
 
-static int append_ref(const char *refname, const unsigned char *sha1, int flags, 
+static int append_ref(const char *refname, const unsigned char *sha1, int flags,
 		void *cb_data)
 {
 	if (ref_index >= ref_alloc) {
-		ref_alloc = ref_alloc > 0 ? ref_alloc * 2 : 16;
+		ref_alloc = alloc_nr(ref_alloc);
 		ref_list = xrealloc(ref_list, ref_alloc * sizeof(char *));
 	}
 
@@ -137,14 +137,14 @@ static void create_branch(const char *na
 			die("Cannot force update the current branch.");
 	}
 
-	if (get_sha1(start, sha1))
+	if (get_sha1(mkpath("%s^0", start), sha1))
 		die("Not a valid branch point: '%s'.", start);
 
 	lock = lock_any_ref_for_update(ref, NULL);
 	if (!lock)
 		die("Failed to lock ref for update: %s.", strerror(errno));
-		
-	if (reflog){
+
+	if (reflog) {
 		log_all_ref_updates = 1;
 		snprintf(msg, sizeof msg, "branch: Created from %s", start);
 	}
@@ -199,9 +199,8 @@ int cmd_branch(int argc, const char **ar
 		die("Failed to resolve HEAD as a valid ref.");
 	if (strncmp(head, "refs/heads/", 11))
 		die("HEAD not found below refs/heads!");
-		
 	head += 11;
-	
+
 	if (delete)
 		delete_branches(argc - i, argv + i, force_delete);
 	else if (i == argc)
diff --git a/builtin.h b/builtin.h
index 144d299..9b4749f 100644
--- a/builtin.h
+++ b/builtin.h
@@ -15,8 +15,8 @@ extern int write_tree(unsigned char *sha
 extern int cmd_add(int argc, const char **argv, const char *prefix);
 extern int cmd_annotate(int argc, const char **argv, const char *prefix);
 extern int cmd_apply(int argc, const char **argv, const char *prefix);
-extern int cmd_branch(int argc, const char **argv, const char *prefix);
 extern int cmd_archive(int argc, const char **argv, const char *prefix);
+extern int cmd_branch(int argc, const char **argv, const char *prefix);
 extern int cmd_cat_file(int argc, const char **argv, const char *prefix);
 extern int cmd_checkout_index(int argc, const char **argv, const char *prefix);
 extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
-- 
1.4.3.1.g4604-dirty

^ permalink raw reply related

* Re: [PATCH] Make git-branch a builtin
From: Junio C Hamano @ 2006-10-23 23:44 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: git
In-Reply-To: <20061023215506.GB8344@spearce.org>

Shawn Pearce <spearce@spearce.org> writes:

> Lars Hjemli <hjemli@gmail.com> wrote:
> [snip]
>> ---
>>  Makefile         |    3 +-
>>  builtin-branch.c |  217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  builtin.h        |    1 +
>>  git-branch.sh    |  131 --------------------------------
>>  git.c            |    1 +
>>  5 files changed, 221 insertions(+), 132 deletions(-)
> [snip]
>> diff --git a/git-branch.sh b/git-branch.sh
>> deleted file mode 100755
>> index 4379a07..0000000
>> --- a/git-branch.sh
>> +++ /dev/null
>> @@ -1,131 +0,0 @@
> [snip 131 lines]
>
> Aside from compatability with non-Git tools...
>
> Wouldn't it make more sense to just include the full SHA1 of the
> file we are deleting rather than the entire 131 line negative diff?

How would you do "git apply -R" on something like that?

^ permalink raw reply

* Re: VCS comparison table
From: Linus Torvalds @ 2006-10-23 23:24 UTC (permalink / raw)
  To: Erik Bågfors; +Cc: Jakub Narebski, bazaar-ng, git
In-Reply-To: <845b6e870610231614y681e64eu33bb0806f530c742@mail.gmail.com>

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



On Tue, 24 Oct 2006, Erik Bågfors wrote:
> 
> I don't see any problem doing a "gitk --all" equivalent in bzr.

The problem? How do you show a commit that is _common_ to two branches, 
but has different revision names in them?

Do you _finally_ see what is so wrong with this whole per-branch naming?

		Linus

^ permalink raw reply

* Re: [PATCH 2/1] gitweb: Use fixed string for "next" link in commitdiff view
From: Petr Baudis @ 2006-10-23 23:21 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Junio C Hamano, git
In-Reply-To: <200610240008.08325.jnareb@gmail.com>

Dear diary, on Tue, Oct 24, 2006 at 12:08:08AM CEST, I got a letter
where Jakub Narebski <jnareb@gmail.com> said that...
> @@ -3307,19 +3303,19 @@ sub git_commitdiff {
>  		} elsif (scalar @{$co{'parents'}} == 1) {
>  			# single parent commit
>  			$formats_nav .=
> -				' (parent: ' .
> +				' (' .
>  				$cgi->a({-href => href(action=>"commitdiff",
>  				                       hash=>$co{'parent'})},
> -				        esc_html(substr($co{'parent'}, 0, 7))) .
> +				        'parent') .
>  				')';
>  		} else {
>  			# merge commit
>  			$formats_nav .=
> -				' (merge: ' .
> +				' (' .
>  				join(' ', map {
>  					$cgi->a({-href => href(action=>"commitdiff",
>  					                       hash=>$_)},
> -					        esc_html(substr($_, 0, 7)));
> +					        'parent');
>  				} @{$co{'parents'}} ) .
>  				')';
>  		}

For people not used to git, it would be more informative to keep the
'merge' text there.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

^ permalink raw reply

* Re: [PATCH] Make git-branch a builtin
From: Petr Baudis @ 2006-10-23 23:19 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: git
In-Reply-To: <20061023215506.GB8344@spearce.org>

Dear diary, on Mon, Oct 23, 2006 at 11:55:06PM CEST, I got a letter
where Shawn Pearce <spearce@spearce.org> said that...
> Lars Hjemli <hjemli@gmail.com> wrote:
> [snip]
> > ---
> >  Makefile         |    3 +-
> >  builtin-branch.c |  217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  builtin.h        |    1 +
> >  git-branch.sh    |  131 --------------------------------
> >  git.c            |    1 +
> >  5 files changed, 221 insertions(+), 132 deletions(-)
> [snip]
> > diff --git a/git-branch.sh b/git-branch.sh
> > deleted file mode 100755
> > index 4379a07..0000000
> > --- a/git-branch.sh
> > +++ /dev/null
> > @@ -1,131 +0,0 @@
> [snip 131 lines]
> 
> Aside from compatability with non-Git tools...
> 
> Wouldn't it make more sense to just include the full SHA1 of the
> file we are deleting rather than the entire 131 line negative diff?

I think this way it's easier to review since you can check what is going
away with the new stuff you introduce instead.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

^ permalink raw reply

* Re: VCS comparison table
From: Erik Bågfors @ 2006-10-23 23:14 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: bazaar-ng, git
In-Reply-To: <ehjgli$lft$1@sea.gmane.org>

This is starting to turn into a "my VCS it better than yours"
discussion rather then anything else.  That's unfortunate....


>
> Which means that "gitk --all" means show whole DAG in graphical history viewer.
>
> As in bzr there is no command (nor plugin) to clone whole repository,

But it wouldn't be hard to create one...

> I guess that the answer is that you can't do this. But perhaps
> I'm mistaken, and you can do this in bzr-gtk/bzrk...

As of now there is no way to do it due to the fact that nobody has
done it yet. You can ofcourse clone branches into a common repo and do
operations on that. For example, there is a plugin that allows you to
list heads in a repo (and not in branches). So basically, if you loose
a branch, you can still find the head in the repository and recreate
the branch.

I don't see any problem doing a "gitk --all" equivalent in bzr.
Personally, I don't really have a need for it.

> BTW. The following question IIRC remained unanswered: can you easily
> in bzr create branch off arbitrary revision (for example deciding that
> stable branch should start two revisions back in history from development
> branch)?

bzr branch -r-2 development stable
(or "bzr branch -rrevid:foobar" to start at revision id "foobar")

very easy.

/Erik

-- 
google talk/jabber. zindar@gmail.com
SIP-phones: sip:erik_bagfors@gizmoproject.com
sip:17476714687@proxy01.sipphone.com

^ permalink raw reply

* [PATCH] Built-in cherry
From: Rene Scharfe @ 2006-10-23 23:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List, Yann Dirson

This replaces the shell script git-cherry with a version written in C.

The behaviour of the new version differs from the original in two
points: it has no long help any more, and it is handling the (optional)
third parameter a bit differently.  Basically, it does the equivalent
of

   ours=`git-rev-list $ours ^$limit ^$upstream`

instead of

   ours=`git-rev-list $ours ^$limit`

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---

I'm not really sure if the limit behaviour change matches the original
intent of this feature; Yann, please holler if it doesn't.

 Makefile      |    4 +-
 builtin-log.c |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 builtin.h     |    1 +
 git-cherry.sh |   91 -------------------------------------------------
 git.c         |    1 +
 5 files changed, 110 insertions(+), 93 deletions(-)

diff --git a/Makefile b/Makefile
index 66c8b4b..2b53747 100644
--- a/Makefile
+++ b/Makefile
@@ -157,7 +157,7 @@ BASIC_LDFLAGS =
 
 SCRIPT_SH = \
 	git-bisect.sh git-branch.sh git-checkout.sh \
-	git-cherry.sh git-clean.sh git-clone.sh git-commit.sh \
+	git-clean.sh git-clone.sh git-commit.sh \
 	git-fetch.sh \
 	git-ls-remote.sh \
 	git-merge-one-file.sh git-parse-remote.sh \
@@ -210,7 +210,7 @@ # Empty...
 EXTRA_PROGRAMS =
 
 BUILT_INS = \
-	git-format-patch$X git-show$X git-whatchanged$X \
+	git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
 	git-get-tar-commit-id$X \
 	$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
 
diff --git a/builtin-log.c b/builtin-log.c
index 9d1ceae..840c742 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -437,3 +437,109 @@ int cmd_format_patch(int argc, const cha
 	return 0;
 }
 
+static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)
+{
+	unsigned char sha1[20];
+	if (get_sha1(arg, sha1) == 0) {
+		struct commit *commit = lookup_commit_reference(sha1);
+		if (commit) {
+			commit->object.flags |= flags;
+			add_pending_object(revs, &commit->object, arg);
+			return 0;
+		}
+	}
+	return -1;
+}
+
+static const char cherry_usage[] =
+"git-cherry [-v] <upstream> [<head>] [<limit>]";
+int cmd_cherry(int argc, const char **argv, const char *prefix)
+{
+	struct rev_info revs;
+	struct diff_options patch_id_opts;
+	struct commit *commit;
+	struct commit_list *list = NULL;
+	const char *upstream;
+	const char *head = "HEAD";
+	const char *limit = NULL;
+	int verbose = 0;
+
+	if (argc > 1 && !strcmp(argv[1], "-v")) {
+		verbose = 1;
+		argc--;
+		argv++;
+	}
+
+	switch (argc) {
+	case 4:
+		limit = argv[3];
+		/* FALLTHROUGH */
+	case 3:
+		head = argv[2];
+		/* FALLTHROUGH */
+	case 2:
+		upstream = argv[1];
+		break;
+	default:
+		usage(cherry_usage);
+	}
+
+	init_revisions(&revs, prefix);
+	revs.diff = 1;
+	revs.combine_merges = 0;
+	revs.ignore_merges = 1;
+	revs.diffopt.recursive = 1;
+
+	if (add_pending_commit(head, &revs, 0))
+		die("Unknown commit %s", head);
+	if (add_pending_commit(upstream, &revs, UNINTERESTING))
+		die("Unknown commit %s", upstream);
+
+	/* Don't say anything if head and upstream are the same. */
+	if (revs.pending.nr == 2) {
+		struct object_array_entry *o = revs.pending.objects;
+		if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)
+			return 0;
+	}
+
+	get_patch_ids(&revs, &patch_id_opts, prefix);
+
+	if (limit && add_pending_commit(limit, &revs, UNINTERESTING))
+		die("Unknown commit %s", limit);
+
+	/* reverse the list of commits */
+	prepare_revision_walk(&revs);
+	while ((commit = get_revision(&revs)) != NULL) {
+		/* ignore merges */
+		if (commit->parents && commit->parents->next)
+			continue;
+
+		commit_list_insert(commit, &list);
+	}
+
+	while (list) {
+		unsigned char sha1[20];
+		char sign = '+';
+
+		commit = list->item;
+		if (!get_patch_id(commit, &patch_id_opts, sha1) &&
+		    lookup_object(sha1))
+			sign = '-';
+
+		if (verbose) {
+			static char buf[16384];
+			pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
+			                    buf, sizeof(buf), 0, NULL, NULL, 0);
+			printf("%c %s %s\n", sign, 
+			       sha1_to_hex(commit->object.sha1), buf);
+		}
+		else {
+			printf("%c %s\n", sign,
+			       sha1_to_hex(commit->object.sha1));
+		}
+
+		list = list->next;
+	}
+
+	return 0;
+}
diff --git a/builtin.h b/builtin.h
index f71b962..285d98f 100644
--- a/builtin.h
+++ b/builtin.h
@@ -19,6 +19,7 @@ extern int cmd_archive(int argc, const c
 extern int cmd_cat_file(int argc, const char **argv, const char *prefix);
 extern int cmd_checkout_index(int argc, const char **argv, const char *prefix);
 extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
+extern int cmd_cherry(int argc, const char **argv, const char *prefix);
 extern int cmd_commit_tree(int argc, const char **argv, const char *prefix);
 extern int cmd_count_objects(int argc, const char **argv, const char *prefix);
 extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
diff --git a/git-cherry.sh b/git-cherry.sh
deleted file mode 100755
index 8832573..0000000
--- a/git-cherry.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2005 Junio C Hamano.
-#
-
-USAGE='[-v] <upstream> [<head>] [<limit>]'
-LONG_USAGE='             __*__*__*__*__> <upstream>
-            /
-  fork-point
-            \__+__+__+__+__+__+__+__> <head>
-
-Each commit between the fork-point (or <limit> if given) and <head> is
-examined, and compared against the change each commit between the
-fork-point and <upstream> introduces.  If the change seems to be in
-the upstream, it is shown on the standard output with prefix "+".
-Otherwise it is shown with prefix "-".'
-. git-sh-setup
-
-case "$1" in -v) verbose=t; shift ;; esac 
-
-case "$#,$1" in
-1,*..*)
-    upstream=$(expr "z$1" : 'z\(.*\)\.\.') ours=$(expr "z$1" : '.*\.\.\(.*\)$')
-    set x "$upstream" "$ours"
-    shift ;;
-esac
-
-case "$#" in
-1) upstream=`git-rev-parse --verify "$1"` &&
-   ours=`git-rev-parse --verify HEAD` || exit
-   limit="$upstream"
-   ;;
-2) upstream=`git-rev-parse --verify "$1"` &&
-   ours=`git-rev-parse --verify "$2"` || exit
-   limit="$upstream"
-   ;;
-3) upstream=`git-rev-parse --verify "$1"` &&
-   ours=`git-rev-parse --verify "$2"` &&
-   limit=`git-rev-parse --verify "$3"` || exit
-   ;;
-*) usage ;;
-esac
-
-# Note that these list commits in reverse order;
-# not that the order in inup matters...
-inup=`git-rev-list ^$ours $upstream` &&
-ours=`git-rev-list $ours ^$limit` || exit
-
-tmp=.cherry-tmp$$
-patch=$tmp-patch
-mkdir $patch
-trap "rm -rf $tmp-*" 0 1 2 3 15
-
-for c in $inup
-do
-	git-diff-tree -p $c
-done | git-patch-id |
-while read id name
-do
-	echo $name >>$patch/$id
-done
-
-LF='
-'
-
-O=
-for c in $ours
-do
-	set x `git-diff-tree -p $c | git-patch-id`
-	if test "$2" != ""
-	then
-		if test -f "$patch/$2"
-		then
-			sign=-
-		else
-			sign=+
-		fi
-		case "$verbose" in
-		t)
-			c=$(git-rev-list --pretty=oneline --max-count=1 $c)
-		esac
-		case "$O" in
-		'')	O="$sign $c" ;;
-		*)	O="$sign $c$LF$O" ;;
-		esac
-	fi
-done
-case "$O" in
-'') ;;
-*)  echo "$O" ;;
-esac
diff --git a/git.c b/git.c
index e089b53..f8c991f 100644
--- a/git.c
+++ b/git.c
@@ -224,6 +224,7 @@ static void handle_internal_command(int 
 		{ "cat-file", cmd_cat_file, RUN_SETUP },
 		{ "checkout-index", cmd_checkout_index, RUN_SETUP },
 		{ "check-ref-format", cmd_check_ref_format },
+		{ "cherry", cmd_cherry, RUN_SETUP },
 		{ "commit-tree", cmd_commit_tree, RUN_SETUP },
 		{ "count-objects", cmd_count_objects, RUN_SETUP },
 		{ "diff", cmd_diff, RUN_SETUP | USE_PAGER },

^ permalink raw reply related

* Re: VCS comparison table
From: Jakub Narebski @ 2006-10-23 22:45 UTC (permalink / raw)
  To: git; +Cc: bazaar-ng
In-Reply-To: <20061023222131.GB17019@over-yonder.net>

Matthew D. Fuller wrote:

> On Mon, Oct 23, 2006 at 10:29:53AM -0700 I heard the voice of
> Linus Torvalds, and lo! it spake thus:
>> 
>> I already briought this up once, and I suspect that the bzr people
>> simply DID NOT UNDERSTAND the question:
>> 
>>  - how do you do the git equivalent of "gitk --all"
> 
> I for one simply DO NOT UNDERSTAND the question, because I don't know
> what that is or what I'd be trying to accomplish by doing it.  The
> documentation helpfully tells me that it's something undocumented.

gitk(1)
=======

NAME
----
gitk - git repository browser

DESCRIPTION
-----------
Displays changes in a repository or a selected set of commits. This includes
visualizing the commit graph, showing information related to each commit, and
the files in the trees of each revision.

Historically, gitk was the first repository browser. It's written in tcl/tk
and started off in a separate repository but was later merged into the main
git repository.

OPTIONS
-------
To control which revisions to shown, the command takes options applicable to
the git-rev-list(1) command. This manual page describes only the most
frequently used options.

[...]
--all::

        Show all branches.


Which means that "gitk --all" means show whole DAG in graphical history viewer.

As in bzr there is no command (nor plugin) to clone whole repository,
I guess that the answer is that you can't do this. But perhaps 
I'm mistaken, and you can do this in bzr-gtk/bzrk...

>> For example, how long does it take to do an arbitrary "undo" (ie
>> forcing a branch to an earlier state) [...]
> 
> I don't understand the thrust of this, either.  As I understand the
> operation you're talking about, it doesn't have anything to do with a
> branch; you'd just be whipping the working tree around to different
> versions.  That should be O(diff) on any modern VCS.

For example if you decide to discard some changes completely, reverting
(this action in git is called 'rewind') branch to some previous revision.

And in git this operation is O(1), not O(diff).

BTW. The following question IIRC remained unanswered: can you easily
in bzr create branch off arbitrary revision (for example deciding that
stable branch should start two revisions back in history from development
branch)?

>> and yes, performance does matter.
> 
> I agree, and I currently find a number of places bzr doesn't hit the
> level of performance I think it should.  I'm not convinced, however,
> that any notable proportion of that has to do with the abstract model
> behind it.  And insofar as it has to do with the physical storage
> model, that can easily be (and I'm confident will be, considering it's
> a focus) ameliorated with later repository formats.

Some of physical storage models needs specific abstract model. I think
that git storage model is in this class.

>> The whole confusing between "bzr pull" and "bzr merge" is another
>> _technical_ sign of why branch-local revision numbers are a mistake. 
> 
> I consider it a _technical_ sign of a way of thinking about branches I
> prefer   8-}

Or _perhaps_ just the way of thinking about branches in the way you are
used to.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ 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