Skip to content

Commit

Permalink
t5100: mailinfo and mailsplit tests.
Browse files Browse the repository at this point in the history
Currently the test passes with 1.3.3 but not with the tip of
"master".  This is to verify the fixes from Eric W Biedermann.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jun 17, 2006
1 parent f0338bb commit 4839c0b
Show file tree
Hide file tree
Showing 17 changed files with 626 additions and 0 deletions.
28 changes: 28 additions & 0 deletions t/t5100-mailinfo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#

test_description='git-mailinfo and git-mailsplit test'

. ./test-lib.sh

test_expect_success 'split sample box' \
'git-mailsplit -o. ../t5100/sample.mbox >last &&
last=`cat last` &&
echo total is $last &&
test `cat last` = 5'

for mail in `echo 00*`
do
test_expect_success "mailinfo $mail" \
"git-mailinfo -u msg$mail patch$mail <$mail >info$mail &&
echo msg &&
diff ../t5100/msg$mail msg$mail &&
echo patch &&
diff ../t5100/patch$mail patch$mail &&
echo info &&
diff ../t5100/info$mail info$mail"
done

test_done
5 changes: 5 additions & 0 deletions t/t5100/info0001
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Author: A U Thor
Email: a.u.thor@example.com
Subject: a commit.
Date: Fri, 9 Jun 2006 00:44:16 -0700

5 changes: 5 additions & 0 deletions t/t5100/info0002
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Author: A U Thor
Email: a.u.thor@example.com
Subject: another patch
Date: Fri, 9 Jun 2006 00:44:16 -0700

5 changes: 5 additions & 0 deletions t/t5100/info0003
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Author: A U Thor
Email: a.u.thor@example.com
Subject: third patch
Date: Fri, 9 Jun 2006 00:44:16 -0700

5 changes: 5 additions & 0 deletions t/t5100/info0004
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Author: YOSHIFUJI Hideaki / 吉藤英明
Email: yoshfuji@linux-ipv6.org
Subject: GIT: Try all addresses for given remote name
Date: Thu, 21 Jul 2005 09:10:36 -0400 (EDT)

5 changes: 5 additions & 0 deletions t/t5100/info0005
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Author: David Kågedal
Email: davidk@lysator.liu.se
Subject: Fixed two bugs in git-cvsimport-script.
Date: Mon, 15 Aug 2005 20:18:25 +0200

2 changes: 2 additions & 0 deletions t/t5100/msg0001
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Here is a patch from A U Thor.

21 changes: 21 additions & 0 deletions t/t5100/msg0002
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Here is a patch from A U Thor. This addresses the issue raised in the
message:

From: Nit Picker <nit.picker@example.net>
Subject: foo is too old
Message-Id: <nitpicker.12121212@example.net>

Hopefully this would fix the problem stated there.


I have included an extra blank line above, but it does not have to be
stripped away here, along with the
whitespaces at the end of the above line. They are expected to be squashed
when the message is made into a commit log by stripspace,
Also, there are three blank lines after this paragraph,
two truly blank and another full of spaces in between.



Hope this helps.

9 changes: 9 additions & 0 deletions t/t5100/msg0003
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Here is a patch from A U Thor. This addresses the issue raised in the
message:

From: Nit Picker <nit.picker@example.net>
Subject: foo is too old
Message-Id: <nitpicker.12121212@example.net>

Hopefully this would fix the problem stated there.

7 changes: 7 additions & 0 deletions t/t5100/msg0004
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Hello.

Try all addresses for given remote name until it succeeds.
Also supports IPv6.

Signed-of-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>

13 changes: 13 additions & 0 deletions t/t5100/msg0005
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
The git-cvsimport-script had a copule of small bugs that prevented me
from importing a big CVS repository.

The first was that it didn't handle removed files with a multi-digit
primary revision number.

The second was that it was asking the CVS server for "F" messages,
although they were not handled.

I also updated the documentation for that script to correspond to
actual flags.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
14 changes: 14 additions & 0 deletions t/t5100/patch0001
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
foo | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/foo b/foo
index 9123cdc..918dcf8 100644
--- a/foo
+++ b/foo
@@ -1 +1 @@
-Fri Jun 9 00:44:04 PDT 2006
+Fri Jun 9 00:44:13 PDT 2006
--
1.4.0.g6f2b

14 changes: 14 additions & 0 deletions t/t5100/patch0002
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
foo | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/foo b/foo
index 9123cdc..918dcf8 100644
--- a/foo
+++ b/foo
@@ -1 +1 @@
-Fri Jun 9 00:44:04 PDT 2006
+Fri Jun 9 00:44:13 PDT 2006
--
1.4.0.g6f2b

14 changes: 14 additions & 0 deletions t/t5100/patch0003
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
foo | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/foo b/foo
index 9123cdc..918dcf8 100644
--- a/foo
+++ b/foo
@@ -1 +1 @@
-Fri Jun 9 00:44:04 PDT 2006
+Fri Jun 9 00:44:13 PDT 2006
--
1.4.0.g6f2b

93 changes: 93 additions & 0 deletions t/t5100/patch0004
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
diff --git a/connect.c b/connect.c
--- a/connect.c
+++ b/connect.c
@@ -96,42 +96,57 @@ static enum protocol get_protocol(const
die("I don't handle protocol '%s'", name);
}

-static void lookup_host(const char *host, struct sockaddr *in)
-{
- struct addrinfo *res;
- int ret;
-
- ret = getaddrinfo(host, NULL, NULL, &res);
- if (ret)
- die("Unable to look up %s (%s)", host, gai_strerror(ret));
- *in = *res->ai_addr;
- freeaddrinfo(res);
-}
+#define STR_(s) # s
+#define STR(s) STR_(s)

static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
{
- struct sockaddr addr;
- int port = DEFAULT_GIT_PORT, sockfd;
- char *colon;
-
- colon = strchr(host, ':');
- if (colon) {
- char *end;
- unsigned long n = strtoul(colon+1, &end, 0);
- if (colon[1] && !*end) {
- *colon = 0;
- port = n;
+ int sockfd = -1;
+ char *colon, *end;
+ char *port = STR(DEFAULT_GIT_PORT);
+ struct addrinfo hints, *ai0, *ai;
+ int gai;
+
+ if (host[0] == '[') {
+ end = strchr(host + 1, ']');
+ if (end) {
+ *end = 0;
+ end++;
+ host++;
+ } else
+ end = host;
+ } else
+ end = host;
+ colon = strchr(end, ':');
+
+ if (colon)
+ port = colon + 1;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+
+ gai = getaddrinfo(host, port, &hints, &ai);
+ if (gai)
+ die("Unable to look up %s (%s)", host, gai_strerror(gai));
+
+ for (ai0 = ai; ai; ai = ai->ai_next) {
+ sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (sockfd < 0)
+ continue;
+ if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
+ close(sockfd);
+ sockfd = -1;
+ continue;
}
+ break;
}

- lookup_host(host, &addr);
- ((struct sockaddr_in *)&addr)->sin_port = htons(port);
+ freeaddrinfo(ai0);

- sockfd = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
if (sockfd < 0)
die("unable to create socket (%s)", strerror(errno));
- if (connect(sockfd, (void *)&addr, sizeof(addr)) < 0)
- die("unable to connect (%s)", strerror(errno));
+
fd[0] = sockfd;
fd[1] = sockfd;
packet_write(sockfd, "%s %s\n", prog, path);

--
YOSHIFUJI Hideaki @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA

69 changes: 69 additions & 0 deletions t/t5100/patch0005
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---

Documentation/git-cvsimport-script.txt | 9 ++++++++-
git-cvsimport-script | 4 ++--
2 files changed, 10 insertions(+), 3 deletions(-)

50452f9c0c2df1f04d83a26266ba704b13861632
diff --git a/Documentation/git-cvsimport-script.txt b/Documentation/git-cvsimport-script.txt
--- a/Documentation/git-cvsimport-script.txt
+++ b/Documentation/git-cvsimport-script.txt
@@ -29,6 +29,10 @@ OPTIONS
currently, only the :local:, :ext: and :pserver: access methods
are supported.

+-C <target-dir>::
+ The GIT repository to import to. If the directory doesn't
+ exist, it will be created. Default is the current directory.
+
-i::
Import-only: don't perform a checkout after importing. This option
ensures the working directory and cache remain untouched and will
@@ -44,7 +48,7 @@ OPTIONS

-p <options-for-cvsps>::
Additional options for cvsps.
- The options '-x' and '-A' are implicit and should not be used here.
+ The options '-u' and '-A' are implicit and should not be used here.

If you need to pass multiple options, separate them with a comma.

@@ -57,6 +61,9 @@ OPTIONS
-h::
Print a short usage message and exit.

+-z <fuzz>::
+ Pass the timestamp fuzz factor to cvsps.
+
OUTPUT
------
If '-v' is specified, the script reports what it is doing.
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -190,7 +190,7 @@ sub conn {
$self->{'socketo'}->write("Root $repo\n");

# Trial and error says that this probably is the minimum set
- $self->{'socketo'}->write("Valid-responses ok error Valid-requests Mode M Mbinary E F Checked-in Created Updated Merged Removed\n");
+ $self->{'socketo'}->write("Valid-responses ok error Valid-requests Mode M Mbinary E Checked-in Created Updated Merged Removed\n");

$self->{'socketo'}->write("valid-requests\n");
$self->{'socketo'}->flush();
@@ -691,7 +691,7 @@ while(<CVS>) {
unlink($tmpname);
my $mode = pmode($cvs->{'mode'});
push(@new,[$mode, $sha, $fn]); # may be resurrected!
- } elsif($state == 9 and /^\s+(\S+):\d(?:\.\d+)+->(\d(?:\.\d+)+)\(DEAD\)\s*$/) {
+ } elsif($state == 9 and /^\s+(\S+):\d+(?:\.\d+)+->(\d+(?:\.\d+)+)\(DEAD\)\s*$/) {
my $fn = $1;
$fn =~ s#^/+##;
push(@old,$fn);

--
David K�gedal
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Loading

0 comments on commit 4839c0b

Please sign in to comment.