* Re: Problems with using git
From: Andreas Ericsson @ 2006-03-02 1:24 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Joseph Wakeling, git
In-Reply-To: <Pine.LNX.4.64.0603011651240.22647@g5.osdl.org>
Linus Torvalds wrote:
>
> On Thu, 2 Mar 2006, Joseph Wakeling wrote:
>
>>I'm using openSUSE 10.0 and the package installed is git-core version
>>0.99.3git20050905-2.
>
>
> I think your problems are just related to the fact that the tutorial is
> newer than your git version.
>
> Just fetch a newer version of git first (0.99.3 should be new enough to
> happily fetch a newer version using git itself, but it might be easier to
> just get a tar-ball), and you'll have an easier time at it.
>
... and the way to fetch and install that repo with your current git is:
$ git clone git://git.kernel.org/pub/scm/git/git.git git
$ cd git && make all strip install
There are 2215 commits since 0.99.3, so I think you'll find much has
changed since then.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply
* Re: git-annotate dies when a patch is missing trailing newline
From: Ryan Anderson @ 2006-03-02 1:53 UTC (permalink / raw)
To: Martin Langhoff; +Cc: Git Mailing List
In-Reply-To: <46a038f90603011653l7956d5dat99d88a7da98d21b6@mail.gmail.com>
On Thu, Mar 02, 2006 at 01:53:21PM +1300, Martin Langhoff wrote:
> Ryan, (& list)
>
> git-annotate is dying when a patch is missing trailing newline. There
> _are_ valid situations where code files are not expected to have
> trailing newlines. Just thing of that glorious programming language,
> PHP.
>
> (Ducks).
>
> Actually, 99% of my usage of git is tracking CVS projects so this is a
> bit of a problem.
>
> I had fixed it in Johannes version, but I'm lost as to where to fix it
> in the current git-annotate. Help?
Can you point me at a tree that has this problem? I'll see what I can
do about fixing it tonight.
--
Ryan Anderson
sometimes Pug Majere
^ permalink raw reply
* Re: git-annotate dies when a patch is missing trailing newline
From: Junio C Hamano @ 2006-03-02 2:07 UTC (permalink / raw)
To: Ryan Anderson; +Cc: git
In-Reply-To: <20060302015303.GA27871@mythryan2.michonline.com>
Ryan Anderson <ryan@michonline.com> writes:
>> git-annotate is dying when a patch is missing trailing newline. There
>> _are_ valid situations where code files are not expected to have
>> trailing newlines. Just thing of that glorious programming language,
>> PHP.
>
> Can you point me at a tree that has this problem? I'll see what I can
> do about fixing it tonight.
$ cat script
#!/bin/sh
mkdir test-dir || exit
cd test-dir
git init-db
echo 'A quick brown fox jumps over the' >file
echo 'lazy dog' | tr -d '\012' >>file
git add file
git commit -a -m 'Initial.'
echo 'A quick brown fox
jumps over the' >file
echo 'lazy dog' | tr -d '\012' >>file
git commit -a -m 'Second.'
git annotate file
$ rm -fr test-dir
$ sh script
defaulting to local storage area
Committing initial tree 2850f9a320885b57bb410baffe972b19b17e9270
Use of uninitialized value in string ne at /home/junio/bin/Linux/git-annotate line 308, <$kid> line 10.
Use of uninitialized value in sprintf at /home/junio/bin/Linux/git-annotate line 309, <$kid> line 10.
Line 3 (3) does not match:
| No newline at end of file
|
1e698bcc5b142b542bf99a1a6f17864bc709dbf5 => 780bca516444e94219d4158b7fea97e763dcee6e
$ echo $?
9
$ exit
^ permalink raw reply
* Re: git-annotate dies when a patch is missing trailing newline
From: Junio C Hamano @ 2006-03-02 2:23 UTC (permalink / raw)
To: Martin Langhoff; +Cc: git
In-Reply-To: <46a038f90603011653l7956d5dat99d88a7da98d21b6@mail.gmail.com>
"Martin Langhoff" <martin.langhoff@gmail.com> writes:
> git-annotate is dying when a patch is missing trailing newline. There
> _are_ valid situations where code files are not expected to have
> trailing newlines. Just thing of that glorious programming language,
> PHP.
Does this help?
---
diff --git a/git-annotate.perl b/git-annotate.perl
index f9c2c6c..d30eba7 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -304,6 +304,10 @@ sub _git_diff_parse {
}
$ri++;
+ } elsif (m/^\\/) {
+
+ ; # ignore for now...
+
} else {
if (substr($_,1) ne get_line($slines,$ri) ) {
die sprintf("Line %d (%d) does not match:\n|%s\n|%s\n%s => %s\n",
^ permalink raw reply related
* Re: git-annotate dies when a patch is missing trailing newline
From: Martin Langhoff @ 2006-03-02 3:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vslq1d1pr.fsf@assigned-by-dhcp.cox.net>
On 3/2/06, Junio C Hamano <junkio@cox.net> wrote:
> "Martin Langhoff" <martin.langhoff@gmail.com> writes:
>
> > git-annotate is dying when a patch is missing trailing newline. There
> > _are_ valid situations where code files are not expected to have
> > trailing newlines. Just thing of that glorious programming language,
> > PHP.
>
> Does this help?
Yes, excellent! BTW, I just realized that git-cvsserver is in master,
but the "git-annotate -S" patch isn't there, so cvs annotate dies. Is
anything holding the patch back in next?
cheers,
martin
^ permalink raw reply
* Re: git-annotate dies when a patch is missing trailing newline
From: Junio C Hamano @ 2006-03-02 3:37 UTC (permalink / raw)
To: Martin Langhoff; +Cc: git
In-Reply-To: <46a038f90603011907h6d0d4450w426afb9ada33ddb0@mail.gmail.com>
"Martin Langhoff" <martin.langhoff@gmail.com> writes:
> Yes, excellent! BTW, I just realized that git-cvsserver is in master,
> but the "git-annotate -S" patch isn't there, so cvs annotate dies. Is
> anything holding the patch back in next?
Is -S in next?
^ permalink raw reply
* [PATCH] annotate: fix -S parameter to take a string
From: Martin Langhoff @ 2006-03-02 4:24 UTC (permalink / raw)
To: git, junkio; +Cc: Martin Langhoff
In the conversion to Getopt::Long, the -S / --rev-list parameter stopped
working. We need to tell Getopt::Long that it is a string.
As a bonus, the open() now does some useful error handling.
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
---
Or pull from my cvsserver branch.
---
git-annotate.perl | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
5a44938cf5b79dd5d056075509f12b8e9a13e941
diff --git a/git-annotate.perl b/git-annotate.perl
index f9c2c6c..31318d3 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -31,7 +31,7 @@ our ($help, $longrev, $rename, $starting
my $rc = GetOptions( "long|l" => \$longrev,
"help|h" => \$help,
"rename|r" => \$rename,
- "rev-file|S" => \$rev_file);
+ "rev-file|S=s" => \$rev_file);
if (!$rc or $help) {
usage();
}
@@ -174,7 +174,8 @@ sub git_rev_list {
my $revlist;
if ($rev_file) {
- open($revlist, '<' . $rev_file);
+ open($revlist, '<' . $rev_file)
+ or die "Failed to open $rev_file : $!";
} else {
$revlist = open_pipe("git-rev-list","--parents","--remove-empty",$rev,"--",$file)
or die "Failed to exec git-rev-list: $!";
--
1.2.4.g09a27-dirty
^ permalink raw reply related
* Re: git-annotate dies when a patch is missing trailing newline
From: Martin Langhoff @ 2006-03-02 4:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7voe0pcy9c.fsf@assigned-by-dhcp.cox.net>
On 3/2/06, Junio C Hamano <junkio@cox.net> wrote:
> "Martin Langhoff" <martin.langhoff@gmail.com> writes:
>
> > Yes, excellent! BTW, I just realized that git-cvsserver is in master,
> > but the "git-annotate -S" patch isn't there, so cvs annotate dies. Is
> > anything holding the patch back in next?
>
> Is -S in next?
Yes, but broken since it switched to Getopt::Long (grumble...). Patch
should be hitting the list now, you can also pull it from my repo.
cheers,
martin
^ permalink raw reply
* gitview: Use horizontal scroll bar in the tree view
From: Aneesh Kumar K.V @ 2006-03-02 4:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Subject: gitview: Use horizontal scroll bar in the tree view
Earlier we set up the window to never scroll
horizontally, which made it harder to use on a narrow screen.
This patch allows scrollbar to be used as needed by Gtk
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
contrib/gitview/gitview | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
d08429a55c3c4fb565cc3481e1263d04ecafebdd
diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
index ea05cd4..de9f3f3 100755
--- a/contrib/gitview/gitview
+++ b/contrib/gitview/gitview
@@ -513,7 +513,7 @@ class GitView:
scrollwin = gtk.ScrolledWindow()
- scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ scrollwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scrollwin.set_shadow_type(gtk.SHADOW_IN)
vbox.pack_start(scrollwin, expand=True, fill=True)
scrollwin.show()
@@ -526,9 +526,6 @@ class GitView:
self.treeview.show()
cell = CellRendererGraph()
- # Set the default width to 265
- # This make sure that we have nice display with large tag names
- cell.set_property("width", 265)
column = gtk.TreeViewColumn()
column.set_resizable(True)
column.pack_start(cell, expand=True)
--
1.2.3.gc55f-dirty
^ permalink raw reply related
* [PATCH 0/3] Annotate updates
From: Ryan Anderson @ 2006-03-02 5:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
The following changes since commit 2b74cffa9179eed274be2a38c59b7e323c813737 are
found in the git repository at:
http://h4x0r5.com/~ryan/git/ryan.git annotate-upstream
and will follow this email as replies in patch format.
Ryan Anderson:
Handle \No newline at end of file.
annotate: Add a basic set of test cases.
annotate: --rev-file (-S) is not a boolean parameter
git-annotate.perl | 8 ++++-
t/t8001-annotate.sh | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 1 deletions(-)
create mode 100755 t/t8001-annotate.sh
^ permalink raw reply
* [PATCH] Add git-annotate, a tool for assigning blame.
From: Ryan Anderson @ 2006-03-02 5:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Ryan Anderson
In-Reply-To: <114127659642-git-send-email-ryan@michonline.com>
Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
(Pull from http://h4x0r5.com/~ryan/git/ryan.git/ annotate-upstream )
I'm pretty sure this version (finally) gets the edge cases correct.
I would appreciate some other testing on this, as I can't find a case
where it falls down, but the files with a lot of history tend to have a
lot of lines, making them hard to spotcheck without having been an
intimate part of that history.
Oh, this is the "functional" version, but it might not qualify as "nice
looking" yet, pleaes, feel free to complain.
Makefile | 1
git-annotate.perl | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 322 insertions(+), 0 deletions(-)
create mode 100755 git-annotate.perl
107045e8abb674a66ee7c682dd85a3d303f26e3c
diff --git a/Makefile b/Makefile
index 317be3c..86ffcf4 100644
--- a/Makefile
+++ b/Makefile
@@ -119,6 +119,7 @@ SCRIPT_SH = \
SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \
git-shortlog.perl git-fmt-merge-msg.perl git-rerere.perl \
+ git-annotate.perl \
git-svnimport.perl git-mv.perl git-cvsexportcommit.perl
SCRIPT_PYTHON = \
diff --git a/git-annotate.perl b/git-annotate.perl
new file mode 100755
index 0000000..8f98431
--- /dev/null
+++ b/git-annotate.perl
@@ -0,0 +1,321 @@
+#!/usr/bin/perl
+# Copyright 2006, Ryan Anderson <ryan@michonline.com>
+#
+# GPL v2 (See COPYING)
+#
+# This file is licensed under the GPL v2, or a later version
+# at the discretion of Linus Torvalds.
+
+use warnings;
+use strict;
+
+my $filename = shift @ARGV;
+
+
+my @stack = (
+ {
+ 'rev' => "HEAD",
+ 'filename' => $filename,
+ },
+);
+
+our (@lineoffsets, @pendinglineoffsets);
+our @filelines = ();
+open(F,"<",$filename)
+ or die "Failed to open filename: $!";
+
+while(<F>) {
+ chomp;
+ push @filelines, $_;
+}
+close(F);
+our $leftover_lines = @filelines;
+our %revs;
+our @revqueue;
+our $head;
+
+my $revsprocessed = 0;
+while (my $bound = pop @stack) {
+ my @revisions = git_rev_list($bound->{'rev'}, $bound->{'filename'});
+ foreach my $revinst (@revisions) {
+ my ($rev, @parents) = @$revinst;
+ $head ||= $rev;
+
+ $revs{$rev}{'filename'} = $bound->{'filename'};
+ if (scalar @parents > 0) {
+ $revs{$rev}{'parents'} = \@parents;
+ next;
+ }
+
+ my $newbound = find_parent_renames($rev, $bound->{'filename'});
+ if ( exists $newbound->{'filename'} && $newbound->{'filename'} ne $bound->{'filename'}) {
+ push @stack, $newbound;
+ $revs{$rev}{'parents'} = [$newbound->{'rev'}];
+ }
+ }
+}
+push @revqueue, $head;
+init_claim($head);
+$revs{$head}{'lineoffsets'} = {};
+handle_rev();
+
+
+my $i = 0;
+foreach my $l (@filelines) {
+ my ($output, $rev, $committer, $date);
+ if (ref $l eq 'ARRAY') {
+ ($output, $rev, $committer, $date) = @$l;
+ if (length($rev) > 8) {
+ $rev = substr($rev,0,8);
+ }
+ } else {
+ $output = $l;
+ ($rev, $committer, $date) = ('unknown', 'unknown', 'unknown');
+ }
+
+ printf("(%8s %10s %10s %d)%s\n", $rev, $committer, $date, $i++, $output);
+}
+
+sub init_claim {
+ my ($rev) = @_;
+ my %revinfo = git_commit_info($rev);
+ for (my $i = 0; $i < @filelines; $i++) {
+ $filelines[$i] = [ $filelines[$i], '', '', '', 1];
+ # line,
+ # rev,
+ # author,
+ # date,
+ # 1 <-- belongs to the original file.
+ }
+ $revs{$rev}{'lines'} = \@filelines;
+}
+
+
+sub handle_rev {
+ my $i = 0;
+ while (my $rev = shift @revqueue) {
+
+ my %revinfo = git_commit_info($rev);
+
+ foreach my $p (@{$revs{$rev}{'parents'}}) {
+
+ git_diff_parse($p, $rev, %revinfo);
+ push @revqueue, $p;
+ }
+
+
+ if (scalar @{$revs{$rev}{parents}} == 0) {
+ # We must be at the initial rev here, so claim everything that is left.
+ for (my $i = 0; $i < @{$revs{$rev}{lines}}; $i++) {
+ if (ref ${$revs{$rev}{lines}}[$i] eq '' || ${$revs{$rev}{lines}}[$i][1] eq '') {
+ claim_line($i, $rev, $revs{$rev}{lines}, %revinfo);
+ }
+ }
+ }
+ }
+}
+
+
+sub git_rev_list {
+ my ($rev, $file) = @_;
+
+ open(P,"-|","git-rev-list","--parents","--remove-empty",$rev,"--",$file)
+ or die "Failed to exec git-rev-list: $!";
+
+ my @revs;
+ while(my $line = <P>) {
+ chomp $line;
+ my ($rev, @parents) = split /\s+/, $line;
+ push @revs, [ $rev, @parents ];
+ }
+ close(P);
+
+ printf("0 revs found for rev %s (%s)\n", $rev, $file) if (@revs == 0);
+ return @revs;
+}
+
+sub find_parent_renames {
+ my ($rev, $file) = @_;
+
+ open(P,"-|","git-diff-tree", "-M50", "-r","--name-status", "-z","$rev")
+ or die "Failed to exec git-diff: $!";
+
+ local $/ = "\0";
+ my %bound;
+ my $junk = <P>;
+ while (my $change = <P>) {
+ chomp $change;
+ my $filename = <P>;
+ chomp $filename;
+
+ if ($change =~ m/^[AMD]$/ ) {
+ next;
+ } elsif ($change =~ m/^R/ ) {
+ my $oldfilename = $filename;
+ $filename = <P>;
+ chomp $filename;
+ if ( $file eq $filename ) {
+ my $parent = git_find_parent($rev, $oldfilename);
+ @bound{'rev','filename'} = ($parent, $oldfilename);
+ last;
+ }
+ }
+ }
+ close(P);
+
+ return \%bound;
+}
+
+
+sub git_find_parent {
+ my ($rev, $filename) = @_;
+
+ open(REVPARENT,"-|","git-rev-list","--remove-empty", "--parents","--max-count=1","$rev","--",$filename)
+ or die "Failed to open git-rev-list to find a single parent: $!";
+
+ my $parentline = <REVPARENT>;
+ chomp $parentline;
+ my ($revfound,$parent) = split m/\s+/, $parentline;
+
+ close(REVPARENT);
+
+ return $parent;
+}
+
+
+# Get a diff between the current revision and a parent.
+# Record the commit information that results.
+sub git_diff_parse {
+ my ($parent, $rev, %revinfo) = @_;
+
+ my ($ri, $pi) = (0,0);
+ open(DIFF,"-|","git-diff-tree","-M","-p",$rev,$parent,"--",
+ $revs{$rev}{'filename'}, $revs{$parent}{'filename'})
+ or die "Failed to call git-diff for annotation: $!";
+
+ my $slines = $revs{$rev}{'lines'};
+ my @plines;
+
+ my $gotheader = 0;
+ my ($remstart, $remlength, $addstart, $addlength);
+ my ($hunk_start, $hunk_index, $hunk_adds);
+ while(<DIFF>) {
+ chomp;
+ if (m/^@@ -(\d+),(\d+) \+(\d+),(\d+)/) {
+ ($remstart, $remlength, $addstart, $addlength) = ($1, $2, $3, $4);
+ # Adjust for 0-based arrays
+ $remstart--;
+ $addstart--;
+ # Reinit hunk tracking.
+ $hunk_start = $remstart;
+ $hunk_index = 0;
+ $gotheader = 1;
+
+ for (my $i = $ri; $i < $remstart; $i++) {
+ $plines[$pi++] = $slines->[$i];
+ $ri++;
+ }
+ next;
+ } elsif (!$gotheader) {
+ next;
+ }
+
+ if (m/^\+(.*)$/) {
+ my $line = $1;
+ $plines[$pi++] = [ $line, '', '', '', 0 ];
+ next;
+
+ } elsif (m/^-(.*)$/) {
+ my $line = $1;
+ if (get_line($slines, $ri) eq $line) {
+ # Found a match, claim
+ claim_line($ri, $rev, $slines, %revinfo);
+ } else {
+ die sprintf("Sync error: %d/%d\n|%s\n|%s\n%s => %s\n",
+ $ri, $hunk_start + $hunk_index,
+ $line,
+ get_line($slines, $ri),
+ $rev, $parent);
+ }
+ $ri++;
+
+ } else {
+ if (substr($_,1) ne get_line($slines,$ri) ) {
+ die sprintf("Line %d (%d) does not match:\n|%s\n|%s\n%s => %s\n",
+ $hunk_start + $hunk_index, $ri,
+ substr($_,1),
+ get_line($slines,$ri),
+ $rev, $parent);
+ }
+ $plines[$pi++] = $slines->[$ri++];
+ }
+ $hunk_index++;
+ }
+ close(DIFF);
+ for (my $i = $ri; $i < @{$slines} ; $i++) {
+ push @plines, $slines->[$ri++];
+ }
+
+ $revs{$parent}{lines} = \@plines;
+ return;
+}
+
+sub get_line {
+ my ($lines, $index) = @_;
+
+ return ref $lines->[$index] ne '' ? $lines->[$index][0] : $lines->[$index];
+}
+
+sub git_cat_file {
+ my ($parent, $filename) = @_;
+ return () unless defined $parent && defined $filename;
+ my $blobline = `git-ls-tree $parent $filename`;
+ my ($mode, $type, $blob, $tfilename) = split(/\s+/, $blobline, 4);
+
+ open(C,"-|","git-cat-file", "blob", $blob)
+ or die "Failed to git-cat-file blob $blob (rev $parent, file $filename): " . $!;
+
+ my @lines;
+ while(<C>) {
+ chomp;
+ push @lines, $_;
+ }
+ close(C);
+
+ return @lines;
+}
+
+
+sub claim_line {
+ my ($floffset, $rev, $lines, %revinfo) = @_;
+ my $oline = get_line($lines, $floffset);
+ @{$lines->[$floffset]} = ( $oline, $rev,
+ $revinfo{'author'}, $revinfo{'author_date'} );
+ #printf("Claiming line %d with rev %s: '%s'\n",
+ # $floffset, $rev, $oline) if 1;
+}
+
+sub git_commit_info {
+ my ($rev) = @_;
+ open(COMMIT, "-|","git-cat-file", "commit", $rev)
+ or die "Failed to call git-cat-file: $!";
+
+ my %info;
+ while(<COMMIT>) {
+ chomp;
+ last if (length $_ == 0);
+
+ if (m/^author (.*) <(.*)> (.*)$/) {
+ $info{'author'} = $1;
+ $info{'author_email'} = $2;
+ $info{'author_date'} = $3;
+ } elsif (m/^committer (.*) <(.*)> (.*)$/) {
+ $info{'committer'} = $1;
+ $info{'committer_email'} = $2;
+ $info{'committer_date'} = $3;
+ }
+ }
+ close(COMMIT);
+
+ return %info;
+}
--
1.2.2.gb342
^ permalink raw reply related
* Re: [PATCH] Add git-annotate, a tool for assigning blame.
From: Ryan Anderson @ 2006-03-02 5:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <11412765964127-git-send-email-ryan@michonline.com>
Sorry about this - I was in the wrong directory (apparently) when
running git-send-email. Actual patches in a second.
--
Ryan Anderson
sometimes Pug Majere
^ permalink raw reply
* [PATCH 2/3] annotate: Add a basic set of test cases.
From: Ryan Anderson @ 2006-03-02 5:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Ryan Anderson
In-Reply-To: <11412770173208-git-send-email-ryan@michonline.com>
Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
t/t8001-annotate.sh | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
create mode 100755 t/t8001-annotate.sh
7df39590a44352626c8d83a2b94d1ba11b24a118
diff --git a/t/t8001-annotate.sh b/t/t8001-annotate.sh
new file mode 100755
index 0000000..cae1794
--- /dev/null
+++ b/t/t8001-annotate.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+test_description='git-annotate'
+. ./test-lib.sh
+
+test_expect_success \
+ 'prepare reference tree' \
+ 'echo "1A quick brown fox jumps over the" >file &&
+ echo "lazy dog" >>file &&
+ git add file
+ GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
+
+test_expect_success \
+ 'check all lines blamed on A' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "A") == 2 ]'
+
+test_expect_success \
+ 'Setup new lines blamed on B' \
+ 'echo "2A quick brown fox jumps over the" >>file &&
+ echo "lazy dog" >> file &&
+ GIT_AUTHOR_NAME="B" git commit -a -m "Second."'
+
+test_expect_success \
+ 'Two lines blamed on A' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "A") == 2 ]'
+
+test_expect_success \
+ 'Two lines blamed on B' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "B") == 2 ]'
+
+test_expect_success \
+ 'merge-setup part 1' \
+ 'git checkout -b branch1 master &&
+ echo "3A slow green fox jumps into the" >> file &&
+ echo "well." >> file &&
+ GIT_AUTHOR_NAME="B1" git commit -a -m "Branch1-1"'
+
+test_expect_success \
+ 'Two lines blamed on A' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^A$") == 2 ]'
+
+test_expect_success \
+ 'Two lines blamed on B' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^B$") == 2 ]'
+
+test_expect_success \
+ 'Two lines blamed on B1' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^B1$") == 2 ]'
+
+test_expect_success \
+ 'merge-setup part 2' \
+ 'git checkout -b branch2 master &&
+ sed -i -e "s/2A quick brown/4A quick brown lazy dog/" file &&
+ GIT_AUTHOR_NAME="B2" git commit -a -m "Branch2-1"'
+
+test_expect_success \
+ 'Two lines blamed on A' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^A$") == 2 ]'
+
+test_expect_success \
+ 'One line blamed on B' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^B$") == 1 ]'
+
+test_expect_success \
+ 'One line blamed on B2' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^B2$") == 1 ]'
+
+
+test_expect_success \
+ 'merge-setup part 3' \
+ 'git pull . branch1'
+
+test_expect_success \
+ 'Two lines blamed on A' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^A$") == 2 ]'
+
+test_expect_success \
+ 'One line blamed on B' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^B$") == 1 ]'
+
+test_expect_success \
+ 'Two lines blamed on B1' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^B1$") == 2 ]'
+
+test_expect_success \
+ 'One line blamed on B2' \
+ '[ $(git annotate file | awk "{print \$3}" | grep -c "^B2$") == 1 ]'
+
+test_done
--
1.2.2.g1070
^ permalink raw reply related
* [PATCH 3/3] annotate: --rev-file (-S) is not a boolean parameter
From: Ryan Anderson @ 2006-03-02 5:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Ryan Anderson
In-Reply-To: <11412770172128-git-send-email-ryan@michonline.com>
Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
git-annotate.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
75846f79f31c9833303ff7d44b87b53c39f4bf9a
diff --git a/git-annotate.perl b/git-annotate.perl
index d6028c9..30f9a71 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -31,7 +31,7 @@ our ($help, $longrev, $rename, $starting
my $rc = GetOptions( "long|l" => \$longrev,
"help|h" => \$help,
"rename|r" => \$rename,
- "rev-file|S" => \$rev_file);
+ "rev-file|S=s" => \$rev_file);
if (!$rc or $help) {
usage();
}
--
1.2.2.g1070
^ permalink raw reply related
* [PATCH 1/3] Handle \No newline at end of file.
From: Ryan Anderson @ 2006-03-02 5:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Ryan Anderson
In-Reply-To: <114127659642-git-send-email-ryan@michonline.com>
Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
git-annotate.perl | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
e30d9ddd62cf016124dd9f32e14809d0a38c69e2
diff --git a/git-annotate.perl b/git-annotate.perl
index f9c2c6c..d6028c9 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -304,6 +304,12 @@ sub _git_diff_parse {
}
$ri++;
+ } elsif (m/^\\/) {
+ ;
+ # Skip \No newline at end of file.
+ # But this can be internationalized, so only look
+ # for an initial \
+
} else {
if (substr($_,1) ne get_line($slines,$ri) ) {
die sprintf("Line %d (%d) does not match:\n|%s\n|%s\n%s => %s\n",
--
1.2.2.g1070
^ permalink raw reply related
* [PATCH] cvsserver: Eclipse compat -- now "compare with latest from HEAD" works
From: Martin Langhoff @ 2006-03-02 5:42 UTC (permalink / raw)
To: git, junkio; +Cc: Martin Langhoff
The Eclipse client uses cvs update when that menu option is triggered.
And doesn't like the standard cvs update response. Give it *exactly* what
it wants.
And hope the other clients don't lose the plot too badly.
---
Or pull from my cvsserver branch
---
git-cvsserver.perl | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
3d9afa6824c09083b26c4d371fee54acd1216bba
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index d641c03..7b3ba1b 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -714,8 +714,27 @@ sub req_update
#$log->debug("Target revision is $meta->{revision}, current working revision is $wrev");
- # Files are up to date if the working copy and repo copy have the same revision, and the working copy is unmodified _and_ the user hasn't specified -C
- next if ( defined ( $wrev ) and defined($meta->{revision}) and $wrev == $meta->{revision} and $state->{entries}{$filename}{unchanged} and not exists ( $state->{opt}{C} ) );
+ # Files are up to date if the working copy and repo copy have the same revision,
+ # and the working copy is unmodified _and_ the user hasn't specified -C
+ next if ( defined ( $wrev )
+ and defined($meta->{revision})
+ and $wrev == $meta->{revision}
+ and $state->{entries}{$filename}{unchanged}
+ and not exists ( $state->{opt}{C} ) );
+
+ # If the working copy and repo copy have the same revision,
+ # but the working copy is modified, tell the client it's modified
+ if ( defined ( $wrev )
+ and defined($meta->{revision})
+ and $wrev == $meta->{revision}
+ and not exists ( $state->{opt}{C} ) )
+ {
+ $log->info("Tell the client the file is modified");
+ print "MT text U\n";
+ print "MT fname $filename\n";
+ print "MT newline\n";
+ next;
+ }
if ( $meta->{filehash} eq "deleted" )
{
@@ -727,7 +746,8 @@ sub req_update
print "Removed $dirpart\n";
print "$filepart\n";
}
- elsif ( not defined ( $state->{entries}{$filename}{modified_hash} ) or $state->{entries}{$filename}{modified_hash} eq $oldmeta->{filehash} )
+ elsif ( not defined ( $state->{entries}{$filename}{modified_hash} )
+ or $state->{entries}{$filename}{modified_hash} eq $oldmeta->{filehash} )
{
$log->info("Updating '$filename'");
# normal update, just send the new revision (either U=Update, or A=Add, or R=Remove)
@@ -763,6 +783,7 @@ sub req_update
# transmit file
transmitfile($meta->{filehash});
} else {
+ $log->info("Updating '$filename'");
my ( $filepart, $dirpart ) = filenamesplit($meta->{name});
my $dir = tempdir( DIR => $TEMP_DIR, CLEANUP => 1 ) . "/";
--
1.2.4.g09a27-dirty
^ permalink raw reply related
* [PATCH] contrib/git-svn: use refs/remotes/git-svn instead of git-svn-HEAD
From: Eric Wong @ 2006-03-02 5:58 UTC (permalink / raw)
To: git list, Junio C Hamano
After reading a lengthy discussion on the list, I've come to the
conclusion that creating a 'remotes' directory in refs isn't
such a bad idea.
You can still branch from it by specifying remotes/git-svn (not
needing the leading 'refs/'), and the documentation has been
updated to reflect that.
The 'git-svn' part of the ref can of course be set to whatever
you want by using the GIT_SVN_ID environment variable, as
before.
I'm using refs/remotes/git-svn, and not going with something
like refs/remotes/git-svn/HEAD as it's redundant for Subversion
where there's zero distinction between branches and directories.
Run git-svn rebuild --upgrade to upgrade your repository to use
the new head. git-svn-HEAD must be manually deleted for safety
reasons.
Side note: if you ever (and I hope you never) want to run
git-update-refs on a 'remotes/' ref, make sure you have the
'refs/' prefix as you don't want to be clobbering your
'remotes/' in $GIT_DIR (where remote URLs are stored).
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
contrib/git-svn/git-svn.perl | 63 +++++++++++++++++++++++-----
contrib/git-svn/git-svn.txt | 18 ++++----
contrib/git-svn/t/t0000-contrib-git-svn.sh | 36 ++++++++--------
3 files changed, 78 insertions(+), 39 deletions(-)
98158fd226f764a4d20a4a66b651f3a154a92bf2
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 0b74165..0e092c5 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -34,13 +34,14 @@ use POSIX qw/strftime/;
my $sha1 = qr/[a-f\d]{40}/;
my $sha1_short = qr/[a-f\d]{6,40}/;
my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
- $_find_copies_harder, $_l, $_version);
+ $_find_copies_harder, $_l, $_version, $_upgrade);
GetOptions( 'revision|r=s' => \$_revision,
'no-ignore-externals' => \$_no_ignore_ext,
'stdin|' => \$_stdin,
'edit|e' => \$_edit,
'rmdir' => \$_rmdir,
+ 'upgrade' => \$_upgrade,
'help|H|h' => \$_help,
'find-copies-harder' => \$_find_copies_harder,
'l=i' => \$_l,
@@ -106,13 +107,18 @@ sub rebuild {
$SVN_URL = shift or undef;
my $repo_uuid;
my $newest_rev = 0;
+ if ($_upgrade) {
+ sys('git-update-ref',"refs/remotes/$GIT_SVN","$GIT_SVN-HEAD");
+ } else {
+ check_upgrade_needed();
+ }
my $pid = open(my $rev_list,'-|');
defined $pid or croak $!;
if ($pid == 0) {
- exec("git-rev-list","$GIT_SVN-HEAD") or croak $!;
+ exec("git-rev-list","refs/remotes/$GIT_SVN") or croak $!;
}
- my $first;
+ my $latest;
while (<$rev_list>) {
chomp;
my $c = $_;
@@ -132,18 +138,20 @@ sub rebuild {
"$c, $id\n";
}
}
+
+ # if we merged or otherwise started elsewhere, this is
+ # how we break out of it
+ next if (defined $repo_uuid && ($uuid ne $repo_uuid));
+ next if (defined $SVN_URL && ($url ne $SVN_URL));
+
print "r$rev = $c\n";
- unless (defined $first) {
+ unless (defined $latest) {
if (!$SVN_URL && !$url) {
croak "SVN repository location required: $url\n";
}
$SVN_URL ||= $url;
- $repo_uuid = setup_git_svn();
- $first = $rev;
- }
- if ($uuid ne $repo_uuid) {
- croak "Repository UUIDs do not match!\ngot: $uuid\n",
- "expected: $repo_uuid\n";
+ $repo_uuid ||= setup_git_svn();
+ $latest = $rev;
}
assert_revision_eq_or_unknown($rev, $c);
sys('git-update-ref',"$GIT_SVN/revs/$rev",$c);
@@ -151,7 +159,7 @@ sub rebuild {
}
close $rev_list or croak $?;
if (!chdir $SVN_WC) {
- my @svn_co = ('svn','co',"-r$first");
+ my @svn_co = ('svn','co',"-r$latest");
push @svn_co, '--ignore-externals' unless $_no_ignore_ext;
sys(@svn_co, $SVN_URL, $SVN_WC);
chdir $SVN_WC or croak $!;
@@ -168,6 +176,13 @@ sub rebuild {
exec('git-write-tree');
}
waitpid $pid, 0;
+
+ if ($_upgrade) {
+ print STDERR <<"";
+Keeping deprecated refs/head/$GIT_SVN-HEAD for now. Please remove it
+when you have upgraded your tools and habits to use refs/remotes/$GIT_SVN
+
+ }
}
sub init {
@@ -180,6 +195,7 @@ sub init {
sub fetch {
my (@parents) = @_;
+ check_upgrade_needed();
$SVN_URL ||= file_to_s("$GIT_DIR/$GIT_SVN/info/url");
my @log_args = -d $SVN_WC ? ($SVN_WC) : ($SVN_URL);
unless ($_revision) {
@@ -222,6 +238,7 @@ sub fetch {
sub commit {
my (@commits) = @_;
+ check_upgrade_needed();
if ($_stdin || !@commits) {
print "Reading from stdin...\n";
@commits = ();
@@ -863,7 +880,7 @@ sub git_commit {
if ($commit !~ /^$sha1$/o) {
croak "Failed to commit, invalid sha1: $commit\n";
}
- my @update_ref = ('git-update-ref',"refs/heads/$GIT_SVN-HEAD",$commit);
+ my @update_ref = ('git-update-ref',"refs/remotes/$GIT_SVN",$commit);
if (my $primary_parent = shift @exec_parents) {
push @update_ref, $primary_parent;
}
@@ -936,6 +953,28 @@ sub svn_check_ignore_externals {
$_no_ignore_ext = 1;
}
}
+
+sub check_upgrade_needed {
+ my $old = eval {
+ my $pid = open my $child, '-|';
+ defined $pid or croak $!;
+ if ($pid == 0) {
+ close STDERR;
+ exec('git-rev-parse',"$GIT_SVN-HEAD") or croak $?;
+ }
+ my @ret = (<$child>);
+ close $child or croak $?;
+ die $? if $?; # just in case close didn't error out
+ return wantarray ? @ret : join('',@ret);
+ };
+ return unless $old;
+ my $head = eval { safe_qx('git-rev-parse',"refs/remotes/$GIT_SVN") };
+ if ($@ || !$head) {
+ print STDERR "Please run: $0 rebuild --upgrade\n";
+ exit 1;
+ }
+}
+
__END__
Data structures:
diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt
index b290739..4102deb 100644
--- a/contrib/git-svn/git-svn.txt
+++ b/contrib/git-svn/git-svn.txt
@@ -41,12 +41,12 @@ init::
fetch::
Fetch unfetched revisions from the SVN_URL we are tracking.
- refs/heads/git-svn-HEAD will be updated to the latest revision.
+ refs/heads/remotes/git-svn will be updated to the latest revision.
- Note: You should never attempt to modify the git-svn-HEAD branch
- outside of git-svn. Instead, create a branch from git-svn-HEAD
+ Note: You should never attempt to modify the remotes/git-svn branch
+ outside of git-svn. Instead, create a branch from remotes/git-svn
and work on that branch. Use the 'commit' command (see below)
- to write git commits back to git-svn-HEAD.
+ to write git commits back to remotes/git-svn.
commit::
Commit specified commit or tree objects to SVN. This relies on
@@ -155,13 +155,13 @@ Tracking and contributing to an Subversi
# Fetch remote revisions::
git-svn fetch
# Create your own branch to hack on::
- git checkout -b my-branch git-svn-HEAD
+ git checkout -b my-branch remotes/git-svn
# Commit only the git commits you want to SVN::
git-svn commit <tree-ish> [<tree-ish_2> ...]
# Commit all the git commits from my-branch that don't exist in SVN::
- git-svn commit git-svn-HEAD..my-branch
+ git-svn commit remotes/git-svn..my-branch
# Something is committed to SVN, pull the latest into your branch::
- git-svn fetch && git pull . git-svn-HEAD
+ git-svn fetch && git pull . remotes/git-svn
# Append svn:ignore settings to the default git exclude file:
git-svn show-ignore >> .git/info/exclude
@@ -184,8 +184,8 @@ SVN repositories via one git repository.
environment variable to a name other other than "git-svn" (the default)
and git-svn will ignore the contents of the $GIT_DIR/git-svn directory
and instead do all of its work in $GIT_DIR/$GIT_SVN_ID for that
-invocation. The interface branch will be $GIT_SVN_ID-HEAD, instead of
-git-svn-HEAD. Any $GIT_SVN_ID-HEAD branch should never be modified
+invocation. The interface branch will be remotes/$GIT_SVN_ID, instead of
+remotes/git-svn. Any remotes/$GIT_SVN_ID branch should never be modified
by the user outside of git-svn commands.
ADDITIONAL FETCH ARGUMENTS
diff --git a/contrib/git-svn/t/t0000-contrib-git-svn.sh b/contrib/git-svn/t/t0000-contrib-git-svn.sh
index 181dfe0..80ad357 100644
--- a/contrib/git-svn/t/t0000-contrib-git-svn.sh
+++ b/contrib/git-svn/t/t0000-contrib-git-svn.sh
@@ -71,14 +71,14 @@ test_expect_success \
name='try a deep --rmdir with a commit'
-git checkout -b mybranch git-svn-HEAD
+git checkout -b mybranch remotes/git-svn
mv dir/a/b/c/d/e/file dir/file
cp dir/file file
git update-index --add --remove dir/a/b/c/d/e/file dir/file file
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch &&
+ "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch &&
test -d $SVN_TREE/dir && test ! -d $SVN_TREE/dir/a"
@@ -91,13 +91,13 @@ git update-index --add dir/file/file
git commit -m "$name"
test_expect_code 1 "$name" \
- 'git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch' \
+ 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch' \
|| true
name='detect node change from directory to file #1'
rm -rf dir $GIT_DIR/index
-git checkout -b mybranch2 git-svn-HEAD
+git checkout -b mybranch2 remotes/git-svn
mv bar/zzz zzz
rm -rf bar
mv zzz bar
@@ -106,13 +106,13 @@ git update-index --add -- bar
git commit -m "$name"
test_expect_code 1 "$name" \
- 'git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch2' \
+ 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch2' \
|| true
name='detect node change from file to directory #2'
rm -f $GIT_DIR/index
-git checkout -b mybranch3 git-svn-HEAD
+git checkout -b mybranch3 remotes/git-svn
rm bar/zzz
git-update-index --remove bar/zzz
mkdir bar/zzz
@@ -121,13 +121,13 @@ git-update-index --add bar/zzz/yyy
git commit -m "$name"
test_expect_code 1 "$name" \
- 'git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch3' \
+ 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch3' \
|| true
name='detect node change from directory to file #2'
rm -f $GIT_DIR/index
-git checkout -b mybranch4 git-svn-HEAD
+git checkout -b mybranch4 remotes/git-svn
rm -rf dir
git update-index --remove -- dir/file
touch dir
@@ -136,19 +136,19 @@ git update-index --add -- dir
git commit -m "$name"
test_expect_code 1 "$name" \
- 'git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch4' \
+ 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch4' \
|| true
name='remove executable bit from a file'
rm -f $GIT_DIR/index
-git checkout -b mybranch5 git-svn-HEAD
+git checkout -b mybranch5 remotes/git-svn
chmod -x exec.sh
git update-index exec.sh
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch5 &&
+ "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
test ! -x $SVN_TREE/exec.sh"
@@ -158,7 +158,7 @@ git update-index exec.sh
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch5 &&
+ "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
test -x $SVN_TREE/exec.sh"
@@ -170,7 +170,7 @@ git update-index exec.sh
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch5 &&
+ "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
test -L $SVN_TREE/exec.sh"
@@ -182,7 +182,7 @@ git update-index --add bar/zzz exec-2.sh
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch5 &&
+ "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
test -x $SVN_TREE/bar/zzz &&
test -L $SVN_TREE/exec-2.sh"
@@ -196,7 +196,7 @@ git update-index exec-2.sh
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir git-svn-HEAD..mybranch5 &&
+ "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
test -f $SVN_TREE/exec-2.sh &&
test ! -L $SVN_TREE/exec-2.sh &&
diff -u help $SVN_TREE/exec-2.sh"
@@ -207,9 +207,9 @@ name='test fetch functionality (svn => g
GIT_SVN_ID=alt
export GIT_SVN_ID
test_expect_success "$name" \
- "git-svn init $svnrepo && git-svn fetch -v &&
- git-rev-list --pretty=raw git-svn-HEAD | grep ^tree | uniq > a &&
- git-rev-list --pretty=raw alt-HEAD | grep ^tree | uniq > b &&
+ "git-svn init $svnrepo && git-svn fetch &&
+ git-rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
+ git-rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
diff -u a b"
test_done
--
1.2.3.g4676
^ permalink raw reply related
* [ANNOUNCE] GIT 1.2.4
From: Junio C Hamano @ 2006-03-02 6:24 UTC (permalink / raw)
To: git; +Cc: linux-kernel
The latest maintenance release GIT 1.2.4 is available at the
usual places:
http://www.kernel.org/pub/software/scm/git/
git-1.2.4.tar.{gz,bz2} (tarball)
RPMS/$arch/git-*-1.2.4-1.$arch.rpm (RPM)
Among some fixes, there is one feature item: war on whitespace.
This was done in response to Andrew Morten's request, and
backported from the primary development track.
When you apply an e-mailed patch with git-am (or git-applymbox),
if the patch introduces new trailing whitespaces, you will get
warning messages by default. This behaviour can be tweaked by
setting the configuration item "apply.whitespace" to various
values.
For kernel subsystem maintainers, the earlier Andrew's requests
translate to setting it to either "error" or "strip".
E.g.
$ git repo-config apply.whitespace error
What are the available choices, and which one is for you?
* If you are a busy top echelon person who cares about tree
cleanliness, apply.whitespace=error is a good choice. This
stops after giving a handful error messages, and refuses to
apply a patch that introduces trailing whitespaces. After
the failed patch, you should return the patch to the
submitter; your tree remains clean.
* apply.whitespace=error-all is a better choice for you, if you
are willing to clean up other peoples' mess. You will get
all errors, and the patch is not applied. You can go through
with your editor (e.g. Emacs users can use C-x `; I hope vim
users have similar macros) and fix things in .dotest/patch.
After fixing them up, "git am" without flags (or "-i" for
"interactive" if you want) to apply it. Do not forget to
tell the person who wasted your time doing this to be more
careful next time.
* If you do not care much about new trailing whitespaces, there
is apply.whitespace=warn, which is the default. This shows
warning messages and applies the patch. Make a mental note
to scold the patch submitter to be careful the next time.
* If you care about cleanliness, want to be nice to the
submitters by not forcing them to resubmit solely on
whitespace basis, but not nice enough to educate them,
apply.whitespace=strip is for you. This applies the patch
after stripping the trailing whitespaces it introduces.
* If you do not care about whitespace errors at all,
apply.whitespace=nowarn is for you. No warnings, no errors.
----------------------------------------------------------------
Changes since v1.2.3 are as follows:
Alex Riesen:
fix t5600-clone-fail-cleanup.sh on windows
Josef Weidendorfer:
git-mv: Allow -h without repo & fix error message
git-mv: fixes for path handling
Junio C Hamano:
checkout - eye candy.
Give no terminating LF to error() function.
diffcore-rename: plug memory leak.
git-am: do not allow empty commits by mistake.
sample hooks template.
apply --whitespace fixes and enhancements.
apply: squelch excessive errors and --whitespace=error-all
apply --whitespace: configuration option.
git-apply --whitespace=nowarn
git-apply: war on whitespace -- finishing touches.
git-am: --whitespace=x option.
diffcore-break: micro-optimize by avoiding delta between identical files.
Allow git-mv to accept ./ in paths.
Linus Torvalds:
The war on trailing whitespace
Mark Wooding:
combine-diff: Honour --full-index.
combine-diff: Honour -z option correctly.
^ permalink raw reply
* Re: [PATCH] Teach git-checkout-index to use file suffixes.
From: Shawn Pearce @ 2006-03-02 6:51 UTC (permalink / raw)
To: git
In-Reply-To: <slrne0bh1p.fr9.mdw@metalzone.distorted.org.uk>
Mark Wooding <mdw@distorted.org.uk> wrote:
> Shawn Pearce <spearce@spearce.org> wrote:
>
> > I thought about using instead:
> >
> > --stage=all --suffix1=\#1 --suffix2\=#2 --suffix3=\#3
>
> How about something like
>
> --suffixes=:#1:#2:#3
>
> uses first character as a delimiter to separate the suffixes. A single
> --suffix option could plausibly provide the suffix if only one stage is
> being checked out, and doesn't have the grim delimiter wart.
Why let the user choose? '/' shouldn't be permitted as that
(possibly) would try to create a directory also named the same as
the file (a bad thing). Then its just two formats, depending on
if you want all stages or just 1 stage:
--stage=all --suffix=#1/#2/#3
or
--stage=1 --suffix=#1
?
--
Shawn.
^ permalink raw reply
* Re: [PATCH] Teach git-checkout-index to use file suffixes.
From: Junio C Hamano @ 2006-03-02 7:59 UTC (permalink / raw)
To: Shawn Pearce; +Cc: git
In-Reply-To: <20060302065136.GA6377@spearce.org>
Shawn Pearce <spearce@spearce.org> writes:
> Why let the user choose? '/' shouldn't be permitted as that
> (possibly) would try to create a directory also named the same as
> the file (a bad thing). Then its just two formats, depending on
> if you want all stages or just 1 stage:
>
> --stage=all --suffix=#1/#2/#3
>
> or
>
> --stage=1 --suffix=#1
I'll later agree with "why let the user choose" in this message,
but for an entirely different reason.
I am not a great fan of extracting files from stages in the
working tree to begin with. The git-unpack-file command tries
carefully to avoid conflicts, and its use of temporary files is
inherently, eh, temporary, and Porcelains know what names they
get and know how to clean things up afterwards.
I am sympathetic to what you are trying to achieve here. Maybe
your Porcelain would invoke a graphical 3-way merge program in a
windowing environment, and the merge program displays the
filename(s) your Porcelain fed it to the end user, without
giving you a way to override it. In that context, it is not
useful to the end user to show meaningless temporary filename,
and having checkout-index to derive the temporary filename from
real filename may look sensible.
However, --stage=all with --suffix would introduce name clashes
between repeated conflicted merge runs, which requires Porcelain
to be extra careful. Your last merge run might have involved
three conflicting stages (leaving a.c~1, a.c~2, and a.c~3 in
your working tree) and this time it may be "we removed it while
they modified it" situation (needing to extract a.c~1, a.c~3 but
not a.c~2). The Porcelain needs to make sure not to get
confused by leftover a.c~2 file in the working tree from the
previous run.
If what you are trying is to reduce the number of checkout-index
calls by your Porcelain to extract conflicted stages, it _might_
make more sense to do something like this instead (I am thinking
aloud, so take this with a big grain of salt -- it may not make
sense at all):
checkout-index --stage=all checks out higher-order stages in
made-up temporary filenames, just like git-merge-one-file
does using git-unpack-file one-by-one, with a single
invocation.
It reports the following to its standard output, one record
per pathname in the index:
tmp1 <SP> tmp2 <SP> tmp3 <TAB> pathname <RS>
Here, tmp? is the temporary file names for each stage, or a
dot for for a nonexistent stage. pathname is c-quoted as
usual for non -z output and RS is '\n' (under -z flag,
pathname is a literal string and RS is NUL). SP = space
(ASCII 0x20), TAB = tab (ASCII 0x09).
Example:
".tmp1323 . .tmp1232\tfoo/a.c\n"
Notice the dot between the two temporary files -- stage2 is
empty in this example.
Then your Porcelain could run --stage=all and read the output,
and then moving the temporary files around whatever way pleases
it. Since it needs to be careful about not overwriting the
existing working tree files *and* not getting confused by
existing garbage in the working tree anyway, I do not think it
would make your life much easier to have checkout-index derive
the temporary file names after the real working tree files.
BTW, using TAB to split metainformation and pathname and using
SP to separate metainformation pieces are in line with the
design other git tools use. With this, you can separate the LHS
metainformation part and pathname using "cut", and you can have
shell IFS to split the metainformation part apart after that.
But that is a minor detail.
^ permalink raw reply
* Re: [PATCH 1/2] Let git-svnimport's author file use same syntax as git-cvsimport's
From: Karl Hasselström @ 2006-03-02 9:20 UTC (permalink / raw)
To: Jon Loeliger; +Cc: Git Mailing List
In-Reply-To: <1141247993.12729.42.camel@cashmere.sps.mot.com>
On 2006-03-01 15:19:53 -0600, Jon Loeliger wrote:
> On Mon, 2006-02-27 at 17:08, Karl Hasselström wrote:
>
> > Read a file with lines on the form
> >
> > - username User's Full Name <email@addres.org>
> > + username = User's Full Name <email@addr.es>
> >
> > - and use "User's Full Name <email@addres.org>" as the GIT
> > + and use "User's Full Name <email@addr.es>" as the GIT
> > author and committer for Subversion commits made by
> > "username". If encountering a commit made by a user not in the
> > list, abort.
>
> Actually, I believe that "example.com" was reserved specifically for
> instances such as this.
Yes, I know. But email.address@example.com is much longer then
email@addr.es, and not half as funny. :-)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* git push issue
From: Aubrey @ 2006-03-02 9:47 UTC (permalink / raw)
To: git
Hi all,
I followed the instruction of here:
http://www.kernel.org/pub/software/scm/git/docs/core-tutorial.html
to publish my work.
But I run into a problem when I run the command "git push", see below:
======================================================
aubrey@linux:~/public_html/u-boot.git> git push
10.99.22.20:/home/aubrey/public_html/my-git.git master
Password:
error: src refspec master does not match any.
error: dst refspec master does not match any existing ref on the
remote and does not start with refs/.
fatal: unexpected EOF
======================================================
The remote machine is in the same subnet as mine.
Many thanks to your help.
Regards,
-Aubrey
^ permalink raw reply
* Re: git push issue
From: Junio C Hamano @ 2006-03-02 9:58 UTC (permalink / raw)
To: Aubrey; +Cc: git
In-Reply-To: <6d6a94c50603020147l450d1cdfp1bc1747dc79189ce@mail.gmail.com>
Aubrey <aubreylee@gmail.com> writes:
> aubrey@linux:~/public_html/u-boot.git> git push
> 10.99.22.20:/home/aubrey/public_html/my-git.git master
> error: src refspec master does not match any.
> error: dst refspec master does not match any existing ref on the
> remote and does not start with refs/.
The error message tells you that
(1) directory you are in (u-boot.git) does not have a ref that
matches "master". Do you have the "master" branch?
(2) remote repository at 10.99.22.20:/home/.../my-git.git does
not have a ref that matches "master".
The problem on your end must be fixed first. Then once you have
the master branch in u-boot.git directory (I presume
~/public_html/u-boot.git/.git/refs/heads/master would be the
file you would need to see), then the problem on the other end
needs to be dealt with.
If you are creating a branch over there afresh, you need to
spell it out, like this:
$ git push 10.99..:.../my-git.git master:refs/heads/master
After you have done that once (hence creating
/home/aubrey/public_html/my-git.git/.git/refs/heads/master file
over there), you can do the command line I quoted at the
beginning of this message.
^ permalink raw reply
* Re: git push issue
From: Aubrey @ 2006-03-02 10:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v4q2h6ucs.fsf@assigned-by-dhcp.cox.net>
Thanks a lot.
Now git push is OK.
Is it time to try to clone the git repository from the remote machine to my end?
I have started up the git-daemon, but still get the following error:
============================================================
git clone git://10.99.22.20:/home/aubrey/public_html/my-git.git git-test
fatal: unable to connect a socket (Connection refused)
clone-pack from 'git://10.99.22.20:/home/aubrey/public_html/my-git.git' failed.
If I want to clone it by http:// or git://, Could you please give me
some instructions or docs?
Thanks a million.
Regards,
-Aubrey
^ permalink raw reply
* [PATCH] Fix test case for some sed
From: Johannes Schindelin @ 2006-03-02 11:43 UTC (permalink / raw)
To: git, junkio
Some versions of sed lack the "-i" option.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
t/t8001-annotate.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
7f024821ec45dc6eaf36c24f94931d58deb75201
diff --git a/t/t8001-annotate.sh b/t/t8001-annotate.sh
index cae1794..172908a 100755
--- a/t/t8001-annotate.sh
+++ b/t/t8001-annotate.sh
@@ -50,7 +50,8 @@ test_expect_success \
test_expect_success \
'merge-setup part 2' \
'git checkout -b branch2 master &&
- sed -i -e "s/2A quick brown/4A quick brown lazy dog/" file &&
+ sed -e "s/2A quick brown/4A quick brown lazy dog/" < file > file.new &&
+ mv file.new file &&
GIT_AUTHOR_NAME="B2" git commit -a -m "Branch2-1"'
test_expect_success \
--
1.2.4.g9520
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox