Git development
 help / color / mirror / Atom feed
* [PATCH] gitweb: Add snapshot to shortlog
From: Luben Tuikov @ 2006-09-28 23:50 UTC (permalink / raw)
  To: git

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

Add snapshot to each commit-row of shortlog.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

[-- Attachment #2: 4046732943-p4.txt --]
[-- Type: text/plain, Size: 672 bytes --]

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a2f07cc..953a0ef 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2021,7 +2021,8 @@ sub git_shortlog_body {
 		print "</td>\n" .
 		      "<td class=\"link\">" .
 		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
-		      $cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree");
+		      $cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree") . " | " .
+		      $cgi->a({-href => href(action=>"snapshot", hash=>$commit)}, "snapshot");
 		print "</td>\n" .
 		      "</tr>\n";
 	}
-- 
1.4.2.1.g05f0f


^ permalink raw reply related

* [PATCH] gitweb: Factor out gitweb_have_snapshot()
From: Luben Tuikov @ 2006-09-28 23:49 UTC (permalink / raw)
  To: git

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

Create gitweb_have_snapshot() which returns true
of snapshot is available and enabled, else false.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.perl |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

[-- Attachment #2: 3222950043-p3.txt --]
[-- Type: text/plain, Size: 1466 bytes --]

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f3f22c2..a2f07cc 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -155,6 +155,13 @@ sub feature_snapshot {
 	return ($ctype, $suffix, $command);
 }
 
+sub gitweb_have_snapshot {
+	my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
+	my $have_snapshot = (defined $ctype && defined $suffix);
+
+	return $have_snapshot;
+}
+
 # To enable system wide have in $GITWEB_CONFIG
 # $feature{'pickaxe'}{'default'} = [1];
 # To have project specific config enable override in $GITWEB_CONFIG
@@ -2736,8 +2743,7 @@ sub git_blob {
 }
 
 sub git_tree {
-	my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
-	my $have_snapshot = (defined $ctype && defined $suffix);
+	my $have_snapshot = gitweb_have_snapshot();
 
 	if (!defined $hash_base) {
 		$hash_base = "HEAD";
@@ -2813,7 +2819,6 @@ sub git_tree {
 }
 
 sub git_snapshot {
-
 	my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
 	my $have_snapshot = (defined $ctype && defined $suffix);
 	if (!$have_snapshot) {
@@ -2923,8 +2928,7 @@ sub git_commit {
 	my $refs = git_get_references();
 	my $ref = format_ref_marker($refs, $co{'id'});
 
-	my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
-	my $have_snapshot = (defined $ctype && defined $suffix);
+	my $have_snapshot = gitweb_have_snapshot();
 
 	my @views_nav = ();
 	if (defined $file_name && defined $co{'parent'}) {
-- 
1.4.2.1.g05f0f


^ permalink raw reply related

* [PATCH] gitweb: Remove redundant "commit" link from shortlog
From: Luben Tuikov @ 2006-09-28 23:48 UTC (permalink / raw)
  To: git

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

Remove the redundant "commit" link from shortlog.
It can be had by simply clicking on the entry title
of the row.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.perl |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

[-- Attachment #2: 1908141687-p2.txt --]
[-- Type: text/plain, Size: 625 bytes --]

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 79c8052..f3f22c2 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2013,7 +2013,6 @@ 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");
 		print "</td>\n" .
-- 
1.4.2.1.g05f0f


^ permalink raw reply related

* [PATCH] gitweb: "alternate" starts with shade (i.e. 1)
From: Luben Tuikov @ 2006-09-28 23:47 UTC (permalink / raw)
  To: git

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

When displaying a list of rows (difftree, shortlog, etc),
the first entry is now printed shaded, i.e. alternate is
initialized to 1, as opposed to non-shaded (alternate
initialized to 0).

This solves the problem when there is only one row to
display -- it is displayed shaded to visually indicate that
it is "active", part of a "list", etc.

(Compare this to the trivial case of more than one entry,
where the rows have alternating shade, thus suggesting
being part of a "list" of "active" entries, etc.)

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.perl |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

[-- Attachment #2: 1207600725-p1.txt --]
[-- Type: text/plain, Size: 2492 bytes --]

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index afffbbe..79c8052 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1699,7 +1699,7 @@ sub git_difftree_body {
 	print "</div>\n";
 
 	print "<table class=\"diff_tree\">\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	my $patchno = 0;
 	foreach my $line (@{$difftree}) {
 		my %diff = parse_difftree_raw_line($line);
@@ -1993,7 +1993,7 @@ sub git_shortlog_body {
 	$to = $#{$revlist} if (!defined $to || $#{$revlist} < $to);
 
 	print "<table class=\"shortlog\" cellspacing=\"0\">\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	for (my $i = $from; $i <= $to; $i++) {
 		my $commit = $revlist->[$i];
 		#my $ref = defined $refs ? format_ref_marker($refs, $commit) : '';
@@ -2035,7 +2035,7 @@ sub git_history_body {
 	$to = $#{$revlist} unless (defined $to && $to <= $#{$revlist});
 
 	print "<table class=\"history\" cellspacing=\"0\">\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	for (my $i = $from; $i <= $to; $i++) {
 		if ($revlist->[$i] !~ m/^([0-9a-fA-F]{40})/) {
 			next;
@@ -2099,7 +2099,7 @@ sub git_tags_body {
 	$to = $#{$taglist} if (!defined $to || $#{$taglist} < $to);
 
 	print "<table class=\"tags\" cellspacing=\"0\">\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	for (my $i = $from; $i <= $to; $i++) {
 		my $entry = $taglist->[$i];
 		my %tag = %$entry;
@@ -2159,7 +2159,7 @@ sub git_heads_body {
 	$to = $#{$headlist} if (!defined $to || $#{$headlist} < $to);
 
 	print "<table class=\"heads\" cellspacing=\"0\">\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	for (my $i = $from; $i <= $to; $i++) {
 		my $entry = $headlist->[$i];
 		my %tag = %$entry;
@@ -2275,7 +2275,7 @@ sub git_project_list {
 	}
 	print "<th></th>\n" .
 	      "</tr>\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	foreach my $pr (@projects) {
 		if ($alternate) {
 			print "<tr class=\"dark\">\n";
@@ -2793,7 +2793,7 @@ sub git_tree {
 	git_print_page_path($file_name, 'tree', $hash_base);
 	print "<div class=\"page_body\">\n";
 	print "<table cellspacing=\"0\">\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	foreach my $line (@entries) {
 		my %t = parse_ls_tree_line($line, -z => 1);
 
@@ -3389,7 +3389,7 @@ sub git_search {
 	git_print_header_div('commit', esc_html($co{'title'}), $hash);
 
 	print "<table cellspacing=\"0\">\n";
-	my $alternate = 0;
+	my $alternate = 1;
 	if ($commit_search) {
 		$/ = "\0";
 		open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", $hash or next;
-- 
1.4.2.1.g05f0f


^ permalink raw reply related

* Re: [PATCH] Make cvsexportcommit work with filenames containing spaces.
From: Robin Rosenberg @ 2006-09-28 23:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvenfw727.fsf@assigned-by-dhcp.cox.net>

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


Jounio. Thanks for the feedback. It is your fedora patch 2.5.4 that doesn't work. 
It doesn't seem to handle spaces in filenames in any way. Not much I can do about that.

Btw, 2.5.4 is nine years old, but strangely that's the one that's around everywhere on
source mirrors, but most (=the few ones I checked) Linux distros have 2.5.9 (except RH).

-- robin

[-- Attachment #2: cvsexportcommit --]
[-- Type: text/x-diff, Size: 3929 bytes --]

Make cvsexportcommit work with filenames containing spaces.

From: Robin Rosenberg <robin.rosenberg@dewire.com>

Binary files are except to this so far.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---

 git-cvsexportcommit.perl       |   27 +++++++++++++++++---
 t/t9200-git-cvsexportcommit.sh |   55 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 99b3dc3..ecded35 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -5,6 +5,7 @@ # - cannot add or remove binary files
 # - does not propagate permissions
 # - tells "ready for commit" even when things could not be completed
 #   (eg addition of a binary file)
+# - Fedora/RHEL uses patch 2.5.4 which doesn't handles spaces in file names
 
 use strict;
 use Getopt::Std;
@@ -121,7 +122,14 @@ #print @files;
 $? && die "Error in git-diff-tree";
 foreach my $f (@files) {
     chomp $f;
-    my @fields = split(m!\s+!, $f);
+    $f =~ m/^(\S+) (\S+) (\S+) (\S+) (\S+)	(.*)/;
+    my @fields = ();
+    $fields[++$#fields] = $1;
+    $fields[++$#fields] = $2;
+    $fields[++$#fields] = $3;
+    $fields[++$#fields] = $4;
+    $fields[++$#fields] = $5;
+    $fields[++$#fields] = $6;
     if ($fields[4] eq 'A') {
         my $path = $fields[5];
 	push @afiles, $path;
@@ -217,7 +225,7 @@ foreach my $f (@bfiles) {
     }
 
     # replace with the new file
-     `git-cat-file blob $blob > $f`;
+     `git-cat-file blob $blob > "$f"`;
 
     # TODO: something smart with file modes
 
@@ -231,7 +239,20 @@ ## apply non-binary changes
 my $fuzz = $opt_p ? 0 : 2;
 
 print "Patching non-binary files\n";
-print `(git-diff-tree -p $parent -p $commit | patch -p1 -F $fuzz ) 2>&1`;
+
+my $saveslash = $/;
+undef $/;
+
+open DIFF, "git-diff-tree -p $parent -p $commit|" || die "Cannot diff";
+open PATCH, "|patch -p1 -F $fuzz" || die "Cannot patch";
+my $delta = <DIFF>;
+close DIFF || die "Could not diff";
+unless (defined $ENV{'GIT_CVSEXPORTCOMMIT_NO_SPACES'}) {
+  $delta =~ s/\n(index [^\n]*)\n(--- [^\n]*)\n(\+\+\+ [^\n]*)\n(@@[^\n]*@@)\n/$1\n$2\t\n$3\t\n$4\n/sg
+}
+print PATCH $delta;
+close PATCH || die "Could not patch";
+$/ = $saveslash;
 
 my $dirtypatch = 0;
 if (($? >> 8) == 2) {
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
new file mode 100755
index 0000000..548e329
--- /dev/null
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+test_description='CVS export comit. 
+
+These tests are ad-hoc ones made to test
+some changes, not a complete test.'
+
+. ./test-lib.sh
+
+export CVSROOT=$(pwd)/cvsroot
+export CVSWORK=$(pwd)/cvswork
+rm -rf "$CVSROOT" "$CVSWORK"
+mkdir "$CVSROOT" &&
+cvs init &&
+cvs -Q co -d "$CVSWORK" . &&
+export GIT_DIR=$(pwd)/.git &&
+echo >empty &&
+git add empty &&
+git commit -a -m "Initial" 2>/dev/null ||
+exit 1
+
+test_expect_success \
+    'New file' \
+    'echo hello >newfile.txt &&
+     git add newfile.txt &&
+     git commit -a -m "Hello" &&
+     id=$(git rev-list --max-count=1 HEAD) &&
+     (cd "$CVSWORK" &&
+     git cvsexportcommit -c $id &&
+     test $(cat CVS/Entries|wc -l) = 2
+     )'
+
+test_expect_success \
+     'New file with spaces in file name' \
+     'echo ok then >"with spaces.txt" &&
+      git add "with spaces.txt" && \
+      git commit -a -m "With spaces" &&
+      id=$(git rev-list --max-count=1 HEAD) &&
+      (cd "$CVSWORK" &&
+      git-cvsexportcommit -c $id &&
+      test $(cat CVS/Entries|wc -l) = 3
+      )'
+
+test_expect_success \
+     'Update file with spaces in file name' \
+     'echo Ok then >>"with spaces.txt" &&
+      git add "with spaces.txt" &&
+      git commit -a -m "Update with spaces" &&
+      id=$(git rev-list --max-count=1 HEAD) &&
+      (cd "$CVSWORK" &&
+      git-cvsexportcommit -c $id &&
+      test $(cat CVS/Entries|wc -l) = 3
+      )'
+     
+test_done

[-- Attachment #3: cvsexportcommitrm --]
[-- Type: text/x-diff, Size: 1352 bytes --]

Make cvsexportcommit remove files.

From: Robin Rosenberg <robin.rosenberg@dewire.com>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---

 git-cvsexportcommit.perl       |    2 +-
 t/t9200-git-cvsexportcommit.sh |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index ecded35..4fb55a6 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -143,7 +143,7 @@ foreach my $f (@files) {
     if ($fields[4] eq 'M') {
 	push @mfiles, $fields[5];
     }
-    if ($fields[4] eq 'R') {
+    if ($fields[4] eq 'D') {
 	push @dfiles, $fields[5];
     }
 }
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 548e329..6f28da6 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -52,4 +52,16 @@ test_expect_success \
       test $(cat CVS/Entries|wc -l) = 3
       )'
      
+test_expect_success \
+     'Remove file with spaces in file name' \
+     'echo Ok then >"with spaces.txt" &&
+      rm -v "with spaces.txt" && \
+      git rm "with spaces.txt" && \
+      git commit -a -m "Remove file" &&
+      id=$(git rev-list --max-count=1 HEAD) &&
+      (cd "$CVSWORK" &&
+      git-cvsexportcommit -v -c $id &&
+      test $(cat CVS/Entries|wc -l) = 2
+      )'
+     
 test_done

^ permalink raw reply related

* Re: gitweb: using quotemeta
From: Luben Tuikov @ 2006-09-28 23:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vodszshq3.fsf@assigned-by-dhcp.cox.net>

--- Junio C Hamano <junkio@cox.net> wrote:
> 
> Ouch, that was a sloppy planning and coding, and sloppier
> reviewing.  Sorry.
> 
> What is the right quoting there?  Just quoting double-quotes?

I'm not sure.  What undesired character could we have in $filename
of a snapshot?  The commit ab41dfbfd4f message gives this
justification: "Just in case filename contains end of line character."

It looks like $filename is constructed by well defined strings:
basename($project), $hash and $suffix all of which should be ok.

I'd say we don't need quotemeta for $filename of snapshot.

    Luben

^ permalink raw reply

* Re: gitweb: using quotemeta
From: Junio C Hamano @ 2006-09-28 23:18 UTC (permalink / raw)
  To: ltuikov; +Cc: git
In-Reply-To: <20060928211600.97412.qmail@web31808.mail.mud.yahoo.com>

Luben Tuikov <ltuikov@yahoo.com> writes:

> Commit ab41dfbfd4f3f9fedac71550027e9813b11abe3d introduces
> the use of quotemeta to quote the $filename of the snapshot.
> The commit message explains:
>
>     Just in case filename contains end of line character.
>
> But quotemeta quotes any characters not matching /A-Za-z_0-9/.
> Which means that we get strings like this:
>     
>     linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz
>
> Is this the desired behavior?  FWIW, the backslash character
> is not part of of the name, but ended up when the snapshot was written
> to the filesystem.

Ouch, that was a sloppy planning and coding, and sloppier
reviewing.  Sorry.

What is the right quoting there?  Just quoting double-quotes?

^ permalink raw reply

* Re: git and time
From: Matthew L Foster @ 2006-09-28 22:55 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Shawn Pearce, Linus Torvalds, Rogan Dawes, git
In-Reply-To: <Pine.LNX.4.63.0609290032440.14200@wbgn013.biozentrum.uni-wuerzburg.de>

--- Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

> what exactly are you trying to achieve here? 

Timestamps not being all over the place in gitweb.cgi. 

> If you really want to understand why git does not rely on timestamps, and 
> why it should not, and why you can still be happy nevertheless, there are 
> enough answers in this thread.

I agree and understand that distributed git should not and does not rely on timestamps, I am just
suggesting that it might be worthwhile to _locally_ track local commit time more efficiently for
local use in things like gitweb.cgi. 

-Matt

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply

* Re: git and time
From: Matthew L Foster @ 2006-09-28 22:45 UTC (permalink / raw)
  To: git; +Cc: git, Rogan Dawes
In-Reply-To: <451C4BE6.20407@gmail.com>

--- A Large Angry SCM <gitzilla@gmail.com> wrote:

> When I wrote "Sounds like you're suggesting that Git should not record 
> any timestamps at all", I meant _you_ don't think Git should record 
> _any_ timestamps since they can't be guaranteed to match the DAG.

Well, I mean since there is no time order matching commit order guarantee for distributed git the
only timestamp to use for anything locally is local time (if timestamps are used at all). The
current remote creation or merge time could stay as is (I don't care either way), but at least
gitweb.cgi should become local commit time/ref-log aware. Though if it's infeasible or requires
some rearchitecting it might not happen.

-Matt 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply

* Re: git and time
From: Johannes Schindelin @ 2006-09-28 22:35 UTC (permalink / raw)
  To: Matthew L Foster; +Cc: Shawn Pearce, Linus Torvalds, Rogan Dawes, git
In-Reply-To: <20060928222935.66578.qmail@web51012.mail.yahoo.com>

Matt,

what exactly are you trying to achieve here? Is this a sort of contest who 
can have the longest thread on git@vger.kernel.org?

If you really want to understand why git does not rely on timestamps, and 
why it should not, and why you can still be happy nevertheless, there are 
enough answers in this thread.

Hth,
Dscho

^ permalink raw reply

* Re: git and time
From: Matthew L Foster @ 2006-09-28 22:31 UTC (permalink / raw)
  To: git; +Cc: git, Rogan Dawes
In-Reply-To: <451C4BE6.20407@gmail.com>

--- A Large Angry SCM <gitzilla@gmail.com> wrote:

> There is no local commit time for things you get from a remote repository.

Are you saying it's impossible to internally record/track local commit/merge time for things you
get from a remote repository, ref-log?

-Matt

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply

* Re: git and time
From: Matthew L Foster @ 2006-09-28 22:29 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: Johannes Schindelin, Linus Torvalds, Rogan Dawes, git
In-Reply-To: <20060928195056.GA3751@spearce.org>

--- Shawn Pearce <spearce@spearce.org> wrote:

> > - So exported data is never/rarely in an inconsistent state with respect to commit order and
> > local time order (data integrity).
> 
> Pick one.  You can't have "never" and "rarely".

I mean "rarely" in the sense that there is no guarantee that local time is exact but any
inexactness would be confined locally.
 
> Track it by version, not timestamp.  Know what commit or tag SHA1
> was used to produce that binary.  Ask GIT if the fix is in that
> SHA1 ancestory or not.  I've already said that on this thread.

So you are saying time, even local commit time, is completely unnecessary? I disagree. Git doesn't
need to keep track of any times in a distributed way, it just might be worthwhile to keep track of
local commit timestamps internally per repo.

> I think they care more about what release of the kernel will have
> that driver.  That can easily be determined by the DAG and by
> understanding what branch(es) will wind up in the next release and
> doing simple math: "Lets see, current release is version 2.6.9000,
> so it will be in 2.6.9001."

Even if people care more about "what release" that doesn't mean they don't care about (local
commit) time.

-Matt


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply

* Re: [PATCH 1/3] diff --stat: allow custom diffstat output width.
From: Johannes Schindelin @ 2006-09-28 22:26 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Linus Torvalds, Junio C Hamano, git
In-Reply-To: <20060928222402.GC3469@stusta.de>

Hi,

On Fri, 29 Sep 2006, Adrian Bunk wrote:

> IOW, change --stat-width=72 to -w72, or at least allow it alternatively?

With diff options, -w is identical to --ignore-all-space. (Yes, I know, it 
is not in Documentation/diff-options.txt, but it is in "man diff".)

Ciao,
Dscho

^ permalink raw reply

* Re: git and time
From: A Large Angry SCM @ 2006-09-28 22:25 UTC (permalink / raw)
  To: Matthew L Foster; +Cc: git, Rogan Dawes
In-Reply-To: <20060928221237.85837.qmail@web51015.mail.yahoo.com>

Matthew L Foster wrote:
> --- A Large Angry SCM <gitzilla@gmail.com> wrote:
> 
>> Sounds like you're suggesting that Git should not record any timestamps 
>> at all. After all, Git doesn't need them.
> 
> Yeah kind of, since distributed git doesn't need timestamps and can't guarantee them the only time
> that might make any sense to use locally is local commit time. 

There is no local commit time for things you get from a remote repository.

When I wrote "Sounds like you're suggesting that Git should not record 
any timestamps at all", I meant _you_ don't think Git should record 
_any_ timestamps since they can't be guaranteed to match the DAG.

^ permalink raw reply

* Re: [PATCH 1/3] diff --stat: allow custom diffstat output width.
From: Adrian Bunk @ 2006-09-28 22:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0609281349110.3952@g5.osdl.org>

On Thu, Sep 28, 2006 at 01:54:27PM -0700, Linus Torvalds wrote:
> 
> 
> On Tue, 26 Sep 2006, Junio C Hamano wrote:
> >
> > This adds two parameters to "diff --stat".
> > 
> >  . --stat-width=72 tells that the page should fit on 72-column output.
> > 
> >  . --stat-name-width=30 tells that the filename part is limited
> >    to 30 columns.
> 
> Thinking some more about this, I have to say, I do hate the syntax.
> 
> It may be clear thanks to being verbose, but it's _hell_ to write.
> 
> It has the same problem the "--stat-with-patch" argument had: sure, it 
> worked, but it was really really inconvenient, and just doing a 
> combination of "--stat -p" is much nicer.
> 
> So how about just extending the existing "--stat" thing, and just making 
> it do something like
> 
> 	git diff --stat=72,30
> 
> instead (perhaps along with a config option to set the defaults to 
> something else if we want to).
> 
> What do you think?
>...

What about staying compatible with diffstat?

IOW, change --stat-width=72 to -w72, or at least allow it alternatively?

> 		Linus

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

^ permalink raw reply

* [PATCH] fetch: Add output for the not fast forward case
From: Santi Béjar @ 2006-09-28 22:15 UTC (permalink / raw)
  To: git


Signed-off-by: Santi Béjar <sbejar@gmail.com>
---

This patch follows the notation of the other mail, but for the
not-fast-forward case I think it makes more sense to use the '...'
notation. If you don't like it, just use:

+		echo >&2 "  from $local to $2"

 git-fetch.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-fetch.sh b/git-fetch.sh
index 1bc6108..15d6800 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -190,6 +190,7 @@ fast_forward_local () {
 		;;
 	    esac || {
 		echo >&2 "* $1: does not fast forward to $3;"
+		echo >&2 "  $local...$2"
 		case ",$force,$single_force," in
 		*,t,*)
 			echo >&2 "  forcing update."
-- 
1.4.2.1.g5a0f

^ permalink raw reply related

* Re: git and time
From: Matthew L Foster @ 2006-09-28 22:12 UTC (permalink / raw)
  To: git; +Cc: Rogan Dawes, git
In-Reply-To: <451C3494.8030701@gmail.com>

--- A Large Angry SCM <gitzilla@gmail.com> wrote:

> Sounds like you're suggesting that Git should not record any timestamps 
> at all. After all, Git doesn't need them.

Yeah kind of, since distributed git doesn't need timestamps and can't guarantee them the only time
that might make any sense to use locally is local commit time. 

-Matt

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply

* [PATCH] Use "hash1..hash2" instead of "from hash1 to hash2"
From: Santi Béjar @ 2006-09-28 22:11 UTC (permalink / raw)
  To: git


Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 git-fetch.sh   |    2 +-
 git-merge.sh   |    2 +-
 git-resolve.sh |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-fetch.sh b/git-fetch.sh
index 50ad101..1bc6108 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -182,7 +182,7 @@ fast_forward_local () {
 		;;
 	    *,$local)
 		echo >&2 "* $1: fast forward to $3"
-		echo >&2 "  from $local to $2"
+		echo >&2 "  $local..$2"
 		git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local"
 		;;
 	    *)
diff --git a/git-merge.sh b/git-merge.sh
index 5b34b4d..fd587c5 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -197,7 +197,7 @@ f,*)
 	;;
 ?,1,"$head",*)
 	# Again the most common case of merging one remote.
-	echo "Updating from $head to $1"
+	echo "Updating $head..$1"
 	git-update-index --refresh 2>/dev/null
 	new_head=$(git-rev-parse --verify "$1^0") &&
 	git-read-tree -u -v -m $head "$new_head" &&
diff --git a/git-resolve.sh b/git-resolve.sh
index 729ec65..6e4fb02 100755
--- a/git-resolve.sh
+++ b/git-resolve.sh
@@ -46,7 +46,7 @@ case "$common" in
 	exit 0
 	;;
 "$head")
-	echo "Updating from $head to $merge"
+	echo "Updating $head..$merge"
 	git-read-tree -u -m $head $merge || exit 1
 	git-update-ref -m "resolve $merge_name: Fast forward" \
 		HEAD "$merge" "$head"
-- 
1.4.2.1.g5a0f

^ permalink raw reply related

* Re: [PATCH 1/3] diff --stat: allow custom diffstat output width.
From: Linus Torvalds @ 2006-09-28 22:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Adrian Bunk
In-Reply-To: <7vac4ju1f1.fsf@assigned-by-dhcp.cox.net>



On Thu, 28 Sep 2006, Junio C Hamano wrote:

> Linus Torvalds <torvalds@osdl.org> writes:
> 
> > So how about just extending the existing "--stat" thing, and just making 
> > it do something like
> >
> > 	git diff --stat=72,30
> >
> > instead (perhaps along with a config option to set the defaults to 
> > something else if we want to).
> >
> > What do you think?
> 
> I am all for it.

Here. Something like this.

You should probably check the "width" and "name_width" values for sanity. 
The old code didn't, so I didn't do it, but this actually does check that 
the number was a real number (and didn't have crap after it). And it's 
easy to check the values, since all cases go through the same point.

I could have made it a more obvious "stupid" parser, I just think it's 
better to do it this way.

		Linus

----
diff --git a/diff.c b/diff.c
index 98c29bf..8546dde 100644
--- a/diff.c
+++ b/diff.c
@@ -1825,15 +1825,33 @@ int diff_opt_parse(struct diff_options *
 	else if (!strcmp(arg, "--patch-with-raw")) {
 		options->output_format |= DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW;
 	}
-	else if (!strcmp(arg, "--stat"))
-		options->output_format |= DIFF_FORMAT_DIFFSTAT;
-	else if (!strncmp(arg, "--stat-width=", 13)) {
-		options->stat_width = strtoul(arg + 13, NULL, 10);
-		options->output_format |= DIFF_FORMAT_DIFFSTAT;
-	}
-	else if (!strncmp(arg, "--stat-name-width=", 18)) {
-		options->stat_name_width = strtoul(arg + 18, NULL, 10);
+	else if (!strncmp(arg, "--stat", 6)) {
+		char *end;
+		int width = options->stat_width;
+		int name_width = options->stat_name_width;
+		arg += 6;
+		end = arg;
+
+		switch (*arg) {
+		case '-':
+			if (!strncmp(arg, "-width=", 7))
+				width = strtoul(arg + 7, &end, 10);
+			else if (!strncmp(arg, "-name-width=", 12))
+				name_width = strtoul(arg + 12, &end, 10);
+			break;
+
+		case '=':
+			width = strtoul(arg+1, &end, 10);
+			if (*end == ',')
+				name_width = strtoul(end+1, &end, 10);
+		}
+
+		/* Important! This checks all the error cases! */
+		if (*end)
+			return 0;
 		options->output_format |= DIFF_FORMAT_DIFFSTAT;
+		options->stat_name_width = name_width;
+		options->stat_width = width;
 	}
 	else if (!strcmp(arg, "--check"))
 		options->output_format |= DIFF_FORMAT_CHECKDIFF;

^ permalink raw reply related

* Re: [PATCH 1/3] diff --stat: allow custom diffstat output width.
From: Junio C Hamano @ 2006-09-28 21:27 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git, Adrian Bunk
In-Reply-To: <Pine.LNX.4.64.0609281349110.3952@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> So how about just extending the existing "--stat" thing, and just making 
> it do something like
>
> 	git diff --stat=72,30
>
> instead (perhaps along with a config option to set the defaults to 
> something else if we want to).
>
> What do you think?

I am all for it.

^ permalink raw reply

* Re: [PATCH] http/ftp: optionally ask curl to not use EPSV command
From: Junio C Hamano @ 2006-09-28 21:25 UTC (permalink / raw)
  To: Sasha Khapyorsky; +Cc: git
In-Reply-To: <20060928192605.GD10617@sashak.voltaire.com>

Sasha Khapyorsky <sashak@voltaire.com> writes:

> If GIT_CURL_FTP_NO_EPSV environment variable is defined, disable using
> of EPSV ftp command (PASV will be used instead). This is helpful with
> some "poor" ftp servers which doesn't support EPSV mode.
>
> Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
> ---
>  http.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/http.c b/http.c
> index 6c1937b..a966e6d 100644
> --- a/http.c
> +++ b/http.c
> @@ -196,6 +196,9 @@ #endif
>  
>  	curl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);
>  
> +	if (getenv("GIT_CURL_FTP_NO_EPSV"))
> +		curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
> +
>  	return result;
>  }
>  
> -- 
> 1.4.2.1

Care to match this with existing ones?

$ git grep -e GIT_CURL -e GIT_SSL -e GIT_HTTP

tells you how they are handled and documented.  If you spot
inconsistencies if any (e.g. some having config entry and some
only environment -- I haven't checked), correcting them while
you are at it might be a good thing as well.

^ permalink raw reply

* gitweb: using quotemeta
From: Luben Tuikov @ 2006-09-28 21:15 UTC (permalink / raw)
  To: git

Commit ab41dfbfd4f3f9fedac71550027e9813b11abe3d introduces
the use of quotemeta to quote the $filename of the snapshot.
The commit message explains:

    Just in case filename contains end of line character.

But quotemeta quotes any characters not matching /A-Za-z_0-9/.
Which means that we get strings like this:
    
    linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz

Is this the desired behavior?  FWIW, the backslash character
is not part of of the name, but ended up when the snapshot was written
to the filesystem.

Thanks,
   Luben

^ permalink raw reply

* Re: [PATCH 1/3] diff --stat: allow custom diffstat output width.
From: Linus Torvalds @ 2006-09-28 20:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Adrian Bunk
In-Reply-To: <7vr6xyjal0.fsf@assigned-by-dhcp.cox.net>



On Tue, 26 Sep 2006, Junio C Hamano wrote:
>
> This adds two parameters to "diff --stat".
> 
>  . --stat-width=72 tells that the page should fit on 72-column output.
> 
>  . --stat-name-width=30 tells that the filename part is limited
>    to 30 columns.

Thinking some more about this, I have to say, I do hate the syntax.

It may be clear thanks to being verbose, but it's _hell_ to write.

It has the same problem the "--stat-with-patch" argument had: sure, it 
worked, but it was really really inconvenient, and just doing a 
combination of "--stat -p" is much nicer.

So how about just extending the existing "--stat" thing, and just making 
it do something like

	git diff --stat=72,30

instead (perhaps along with a config option to set the defaults to 
something else if we want to).

What do you think?

I'm just pretty sure I will never _ever_ bother to type 
--stat-name-width=30 in my life except right now to complain about it. I 
just can't see myself ever caring _that_ much. But "--stat=100" to see a 
wider stat, that I could see myself doing. Or "--stat=100,100" if I want 
to see long filenames too.

		Linus

^ permalink raw reply

* Re: git and time
From: A Large Angry SCM @ 2006-09-28 20:46 UTC (permalink / raw)
  To: Matthew L Foster; +Cc: Rogan Dawes, git
In-Reply-To: <20060928165509.77413.qmail@web51001.mail.yahoo.com>

Matthew L Foster wrote:
> --- Rogan Dawes <discard@dawes.za.net> wrote:
> 
>> I just don't think that any of the kernel developers feel the need to 
>> police any one else's clocks . . . they're more interested in the 
>> contents of the patch.
> 
> I am not saying git should "police any one else's clocks", I am saying git should be designed or
> configured in such a way, using local time, that it obviates the current reliance on everyone
> else's clock being set correctly. 

Sounds like you're suggesting that Git should not record any timestamps 
at all. After all, Git doesn't need them.

^ permalink raw reply

* Re: git and time
From: Robin Rosenberg @ 2006-09-28 20:36 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Matthew L Foster, Rogan Dawes, git
In-Reply-To: <Pine.LNX.4.64.0609281003070.3952@g5.osdl.org>

torsdag 28 september 2006 19:11 skrev Linus Torvalds:
> The time that git records is purely a random number. It's a random number
> that _humans_ can choose to care about or not, and it's a random number
> that git itself uses only in the sense of "ok, I've got two equal choices,
> let's toss a coin to select which one I'll look at next", BUT IT IS A
> RANDOM NUMBER.

I'd think of it as comment, about as (un)reliable as the author field or the 
descriptive free-form comment people enter when they commit. It's not even 
necessarily the local system time if GIT_AUTHOR_DATE has been set.

-- robin

^ 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