Git development
 help / color / mirror / Atom feed
* [PATCH] Deb packages should include the binaries (Try 2 - this time it actually applies)
From: Ryan Anderson @ 2005-07-22  5:55 UTC (permalink / raw)
  To: git, Linus Torvalds
In-Reply-To: <20050721061545.GM20369@mythryan2.michonline.com>


The Deb packages were mising a dependency on "build install" from the
binary target - this fixes that, and cleans up some inconsistencies
elsewhere in the rulesets.

Traditionally, Debian packaging uses a file called "build-stamp" (or
"install-stamp", etc) in the main source tree.  The initial deb package
support for Git tried to move this "build-stamp" file into the debian/
directory, but some instances were missed.  That problem, however, was
incidental - the real fix is the missing dependency mentioned above.

(version 2 of this patch.  I missed an early commit in v1 that made the old
patch impossible to apply.)

Signed-off-by: Ryan Anderson <ryan@michonline.com>


diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,11 @@
+git-core (0.99-1) unstable; urgency=low
+
+  * Update deb package support to build correctly. 
+
+ -- Ryan Anderson <ryan@michonline.com>  Thu, 21 Jul 2005 02:03:32 -0400
+
 git-core (0.99-0) unstable; urgency=low
-	
+
   * Initial deb package support
 
  -- Eric Biederman <ebiederm@xmission.com>  Tue, 12 Jul 2005 10:57:51 -0600
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Standards-Version: 3.6.1
 
 Package: git-core
 Architecture: any
-Depends: ${shlibs:Depends}, shellutils, diff, rsync, rcs
+Depends: ${misc:Depends}, shellutils, diff, rsync, rcs
 Description: The git content addressable filesystem
  GIT comes in two layers. The bottom layer is merely an extremely fast
  and flexible filesystem-based database designed to store directory trees
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -21,8 +21,8 @@ DESTDIR  := $(CURDIR)/debian/tmp
 DOC_DESTDIR := $(DESTDIR)/usr/share/doc/git-core/
 MAN_DESTDIR := $(DESTDIR)/$(MANDIR)
 
-build: build-stamp
-build-stamp:
+build: debian/build-stamp
+debian/build-stamp:
 	dh_testdir
 	$(MAKE) all doc
 	touch debian/build-stamp
@@ -36,7 +36,7 @@ debian-clean:
 clean: debian-clean
 	$(MAKE) clean
 
-install: debian/build-stamp
+install: build
 	dh_testdir
 	dh_testroot
 	dh_clean -k 
@@ -47,9 +47,9 @@ install: debian/build-stamp
 	mkdir -p $(DOC_DESTDIR)
 	find $(DOC) '(' -name '*.txt' -o -name '*.html' ')' -exec install {} $(DOC_DESTDIR) ';'
 
-	dh_install --sourcedir=$(DESTDIR)
+	dh_install --list-missing --sourcedir=$(DESTDIR)
 
-binary:
+binary: build install
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs
-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* Re: [PATCH 1/1] Tell vim the textwidth is 75.
From: Junio C Hamano @ 2005-07-22  2:50 UTC (permalink / raw)
  To: Bryan larsen; +Cc: git
In-Reply-To: <20050721202309.8216.19338.stgit@h164.c77.b0.tor.eicat.ca>

I do not do Porcelain, but wouldn't it be nicer if we had a
Porcelain neutral "commit log template file" under $GIT_DIR
somewhere?  'vim: textwidth=75' is completely useless for
somebody like me (I almost always work inside Emacs).

Cogito seems to use $GIT_DIR/commit-template for that purpose.
Can't users put that "vim:" hint there, and if StGIT does not
use a commit template, patch it to use the same file as Cogito
does?

^ permalink raw reply

* Re: [PATCH 1/1] Support configurable SMTP port for stg mail.
From: Catalin Marinas @ 2005-07-21 20:55 UTC (permalink / raw)
  To: Bryan larsen; +Cc: git, Bryan Larsen
In-Reply-To: <20050721202058.8047.77221.stgit@h164.c77.b0.tor.eicat.ca>

On Thu, 2005-07-21 at 16:20 -0400, Bryan larsen wrote:
> The example configuration file makes it appear that the SMTP port is configurable.  Make it so.

The documentation for smtplib.SMTP says that the smtpserver parameter is
passed to connect(). This latter function parses the smtpserver for
'server:port' like strings and does the right thing. I tried it with
Python 2.3 and it seems to work fine without this patch.

Thanks anyway.

-- 
Catalin

^ permalink raw reply

* [PATCH 1/1] Tell vim the textwidth is 75.
From: Bryan larsen @ 2005-07-21 20:23 UTC (permalink / raw)
  To: git; +Cc: catalin.marinas, Bryan Larsen

When invoking EDITOR, add some metadata to tell vim the textwidth is 75.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 stgit/stack.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/stgit/stack.py b/stgit/stack.py
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -66,6 +66,8 @@ def edit_file(string, comment):
           % __comment_prefix
     print >> f, __comment_prefix, \
           'Trailing empty lines will be automatically removed.'
+    print >> f, __comment_prefix, \
+          'vim: textwidth=75'
     f.close()
 
     # the editor

^ permalink raw reply

* [PATCH 1/1] Add authentication capability to the mail command.
From: Bryan larsen @ 2005-07-21 20:22 UTC (permalink / raw)
  To: git; +Cc: catalin.marinas, Bryan Larsen

Add authentication capability to the mail command.  Added 'smtppassword'
and 'smtpuser' to config file and --smtp-user, --smtp-password to command
line.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 stgit/commands/mail.py |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -41,7 +41,11 @@ options = [make_option('-a', '--all',
            make_option('-s', '--sleep', type = 'int', metavar = 'SECONDS',
                        help = 'sleep for SECONDS between e-mails sending'),
            make_option('--refid',
-                       help = 'Use REFID as the reference id')]
+                       help = 'Use REFID as the reference id'),
+           make_option('-u', '--smtp-user', metavar = 'USER',
+                       help = 'username for SMTP authentication'),
+           make_option('-p', '--smtp-password', metavar = 'PASSWORD',
+                       help = 'username for SMTP authentication')]
 
 
 def __parse_addresses(string):
@@ -65,7 +69,7 @@ def __parse_addresses(string):
 
     return (from_addr_list[0], to_addr_list)
 
-def __send_message(smtpserver, from_addr, to_addr_list, msg, sleep):
+def __send_message(smtpserver, from_addr, to_addr_list, msg, sleep, smtpuser, smtppassword):
     """Send the message using the given SMTP server
     """
     if smtpserver.find(':')==-1:
@@ -80,6 +84,10 @@ def __send_message(smtpserver, from_addr
         raise CmdException, str(err)
 
     s.set_debuglevel(0)
+    if smtpuser and smtppassword:
+        s.ehlo()
+        s.login(smtpuser, smtppassword)
+
     try:
         s.sendmail(from_addr, to_addr_list, msg)
         # give recipients a chance of receiving patches in the correct order
@@ -174,6 +182,13 @@ def func(parser, options, args):
         raise CmdException, 'smtpserver not defined'
     smtpserver = config.get('stgit', 'smtpserver')
 
+    smtpuser = None
+    smtppassword = None
+    if config.has_option('stgit', 'smtpuser'):
+        smtpuser = config.get('stgit', 'smtpuser')
+    if config.has_option('stgit', 'smtppassword'):
+        smtppassword = config.get('stgit', 'smtppassword')
+
     applied = crt_series.get_applied()
 
     if len(args) == 1:
@@ -216,6 +231,17 @@ def func(parser, options, args):
     else:
         raise CmdException, 'Incorrect options. Unknown patches to send'
 
+    if options.smtp_password:
+        smtppassword = options.smtp_password
+
+    if options.smtp_user:
+        smtpuser = options.smtp_user
+
+    if (smtppassword and not smtpuser):
+        raise CmdException, 'SMTP password supplied, username needed'
+    if (smtpuser and not smtppassword):
+        raise CmdException, 'SMTP username supplied, password needed'
+
     total_nr = len(patches)
     if total_nr == 0:
         raise CmdException, 'No patches to send'
@@ -241,7 +267,7 @@ def func(parser, options, args):
         print 'Sending file "%s"...' % options.first,
         sys.stdout.flush()
 
-        __send_message(smtpserver, from_addr, to_addr_list, msg, sleep)
+        __send_message(smtpserver, from_addr, to_addr_list, msg, sleep, smtpuser, smtppassword)
 
         print 'done'
 
@@ -264,6 +290,6 @@ def func(parser, options, args):
         print 'Sending patch "%s"...' % p,
         sys.stdout.flush()
 
-        __send_message(smtpserver, from_addr, to_addr_list, msg, sleep)
+        __send_message(smtpserver, from_addr, to_addr_list, msg, sleep, smtpuser, smtppassword)
 
         print 'done'

^ permalink raw reply

* [PATCH 1/1] Support configurable SMTP port for stg mail.
From: Bryan larsen @ 2005-07-21 20:20 UTC (permalink / raw)
  To: git; +Cc: catalin.marinas, Bryan Larsen

The example configuration file makes it appear that the SMTP port is configurable.  Make it so.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 stgit/commands/mail.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -68,8 +68,14 @@ def __parse_addresses(string):
 def __send_message(smtpserver, from_addr, to_addr_list, msg, sleep):
     """Send the message using the given SMTP server
     """
+    if smtpserver.find(':')==-1:
+        smtpport=25
+    else:
+        smtpport=int(smtpserver[smtpserver.find(':')+1:])
+        smtpserver=smtpserver[:smtpserver.find(':')]
+
     try:
-        s = smtplib.SMTP(smtpserver)
+        s = smtplib.SMTP(smtpserver, smtpport)
     except Exception, err:
         raise CmdException, str(err)
 

^ permalink raw reply

* [PATCH 1/1] Support configurable SMTP port for stg mail.
From: Bryan larsen @ 2005-07-21 20:18 UTC (permalink / raw)
  To: git; +Cc: catalin.marinas, Bryan Larsen

The example configuration file makes it appear that the SMTP port is configurable.  Make it so.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 stgit/commands/mail.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -68,6 +68,12 @@ def __parse_addresses(string):
 def __send_message(smtpserver, from_addr, to_addr_list, msg, sleep):
     """Send the message using the given SMTP server
     """
+    if smtpserver.find(':')==-1:
+        smtpport=25
+    else:
+        smtpport=int(smtpserver[smtpserver.find(':')+1:])
+        smtpserver=smtpserver[:smtpserver.find(':')]
+
     try:
         s = smtplib.SMTP(smtpserver)
     except Exception, err:

^ permalink raw reply

* Re: [PATCH/RFC] Add git-changelog-script to show the changes between two commits
From: Linus Torvalds @ 2005-07-21 20:00 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: git
In-Reply-To: <20050721194138.GP20369@mythryan2.michonline.com>



On Thu, 21 Jul 2005, Ryan Anderson wrote:
>
> Nevermind, I apparently wanted:
> 	git-whatchanged HEAD ^$LAST_RELEASED_COMMIT

Yes. And since git-whatchanged uses git-rev-parse, and can thus use the 
extended git commit format, including ranges, you can literally write the 
above as

	git-whatchanged $LAST_RELEASED_COMMIT..

(or, if you only care about the log, not the actual diff lines, use the 
faster and simpler

	git log $LAST_RELEASED_COMMIT..

which will also show you merges - something git-whatchanged doesn't do).

You can also use the "--pretty" format specializers, so

	git log --pretty=short $LAST_RELEASED_COMMIT..

will do exactly what you'd expect it to do.

		Linus

^ permalink raw reply

* Re: [PATCH/RFC] Add git-changelog-script to show the changes between two commits
From: Ryan Anderson @ 2005-07-21 19:41 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: git, Linus Torvalds
In-Reply-To: <20050721063143.GO20369@mythryan2.michonline.com>

Nevermind, I apparently wanted:
	git-whatchanged HEAD ^$LAST_RELEASED_COMMIT

I'll see about writing up a description of the extended commit reference
scheme.  Currently I can't find a description of it anywhere in the
source tree.

On Thu, Jul 21, 2005 at 02:31:43AM -0400, Ryan Anderson wrote:
> I'll start by saying that, well, I'm pretty sure this patch is wrong.
> 
> I was trying to look at the changes between two commits, sanely, but
> failed to find a tool or example in the tree that hinted at how to do
> this.
> 
> After poking around at git-whatchanged trying to figure out what it is
> trying to do - I gave up and wrote something that *seems* to work
> correctly for the simple test cases I pulled together.  I just don't
> trust it.
> 
> My thinking here is that, when doing a release of a package such as git
> or Linux, the releaser could do something like:
> 
> 	git changelog $LAST_RELEASED_COMMIT HEAD | git-shortlog |\
> 		mail -s "Linux 2.7.0 finally open" linux-kernel
> 
> Where LAST_RELEASED is recorded somewhere or pulled from an internal
> changelog with something like:
> 	grep "Released commit-id:" changelog | awk -F: '{print $2}'" |\
> 		head -1
> 
> Signed-off-by: Ryan Anderson <ryan@michonline.com>
> 
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -36,7 +36,8 @@ SCRIPTS=git git-apply-patch-script git-m
>  	git-reset-script git-add-script git-checkout-script git-clone-script \
>  	gitk git-cherry git-rebase-script git-relink-script git-repack-script \
>  	git-format-patch-script git-sh-setup-script git-push-script \
> -	git-branch-script git-parse-remote
> +	git-branch-script git-parse-remote \
> +	git-changelog-script git-revdiff-script
>  
>  PROG=   git-update-cache git-diff-files git-init-db git-write-tree \
>  	git-read-tree git-commit-tree git-cat-file git-fsck-cache \
> diff --git a/git-changelog-script b/git-changelog-script
> new file mode 100755
> --- /dev/null
> +++ b/git-changelog-script
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +
> +git-revdiff-script $@ | git-diff-tree --stdin --pretty -r | LESS="$LESS -S" ${PAGER:-less}
> diff --git a/git-revdiff-script b/git-revdiff-script
> new file mode 100755
> --- /dev/null
> +++ b/git-revdiff-script
> @@ -0,0 +1,18 @@
> +#!/usr/bin/perl
> +
> +use warnings;
> +use strict;
> +
> +my ($start,$end) = @ARGV;
> +
> +open(R,"-|","git-rev-list",$start)
> +	or die "Failed to pipe from git-rev-list: " . $!;
> +
> +my $rev;
> +while ($rev = <R>) {
> +	chomp $rev;
> +	print $rev,"\n";
> +	last if $end eq $rev;
> +}
> +
> +close(R);
> 
> 
> -- 
> 
> Ryan Anderson
>   sometimes Pug Majere
> -
> 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
> 

-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* [PATCH 2/2] GIT: Listen on IPv6 as well, if available.
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-07-21 13:10 UTC (permalink / raw)
  To: git; +Cc: yoshfuji

Hello.

Listen on IPv6 as well, if available.

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

diff --git a/daemon.c b/daemon.c
--- a/daemon.c
+++ b/daemon.c
@@ -3,8 +3,8 @@
 #include <signal.h>
 #include <sys/wait.h>
 #include <sys/socket.h>
+#include <netdb.h>
 #include <netinet/in.h>
-#include <arpa/inet.h>
 
 static const char daemon_usage[] = "git-daemon [--inetd | --port=n]";
 
@@ -79,15 +79,15 @@ static unsigned int children_deleted = 0
 
 struct child {
 	pid_t pid;
-	int addrlen;
-	struct sockaddr_in address;
+	socklen_t addrlen;
+	struct sockaddr_storage address;
 } live_child[MAX_CHILDREN];
 
-static void add_child(int idx, pid_t pid, struct sockaddr_in *addr, int addrlen)
+static void add_child(int idx, pid_t pid, struct sockaddr *addr, socklen_t addrlen)
 {
 	live_child[idx].pid = pid;
 	live_child[idx].addrlen = addrlen;
-	live_child[idx].address = *addr;
+	memcpy(&live_child[idx].address, addr, addrlen);
 }
 
 /*
@@ -177,7 +177,7 @@ static void check_max_connections(void)
 	}
 }
 
-static void handle(int incoming, struct sockaddr_in *addr, int addrlen)
+static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
 {
 	pid_t pid = fork();
 
@@ -219,37 +219,102 @@ static void child_handler(int signo)
 
 static int serve(int port)
 {
-	int sockfd;
-	struct sockaddr_in addr;
+	struct addrinfo hints, *ai0, *ai;
+	int gai;
+	int socknum = 0, *socklist = NULL;
+	int maxfd = -1;
+	fd_set fds_init, fds;
+	char pbuf[NI_MAXSERV];
 
 	signal(SIGCHLD, child_handler);
-	sockfd = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
-	if (sockfd < 0)
-		die("unable to open socket (%s)", strerror(errno));
-	memset(&addr, 0, sizeof(addr));
-	addr.sin_port = htons(port);
-	addr.sin_family = AF_INET;
-	if (bind(sockfd, (void *)&addr, sizeof(addr)) < 0)
-		die("unable to bind to port %d (%s)", port, strerror(errno));
-	if (listen(sockfd, 5) < 0)
-		die("unable to listen to port %d (%s)", port, strerror(errno));
+
+	sprintf(pbuf, "%d", port);
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_protocol = IPPROTO_TCP;
+	hints.ai_flags = AI_PASSIVE;
+
+	gai = getaddrinfo(NULL, pbuf, &hints, &ai0);
+	if (gai)
+		die("getaddrinfo() failed: %s\n", gai_strerror(gai));
+
+	FD_ZERO(&fds_init);
+
+	for (ai = ai0; ai; ai = ai->ai_next) {
+		int sockfd;
+		int *newlist;
+#ifdef IPV6_V6ONLY
+		int on = 1;
+#endif
+		sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+		if (sockfd < 0)
+			continue;
+
+#ifdef IPV6_V6ONLY
+		if (ai->ai_family == AF_INET6) {
+			setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY,
+				   &on, sizeof(on));
+			/* Note: error is not fatal */
+		}
+#endif
+
+		if (bind(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
+			close(sockfd);
+			continue;	/* not fatal */
+		}
+		if (listen(sockfd, 5) < 0) {
+			close(sockfd);
+			continue;	/* not fatal */
+		}
+
+		newlist = realloc(socklist, sizeof(int) * (socknum + 1));
+		if (!newlist)
+			die("memory allocation failed: %s", strerror(errno));
+
+		socklist = newlist;
+		socklist[socknum++] = sockfd;
+
+		FD_SET(sockfd, &fds_init);
+		if (maxfd < sockfd)
+			maxfd = sockfd;
+	}
+
+	freeaddrinfo(ai0);
+
+	if (socknum == 0)
+		die("unable to allocate any listen sockets on port %u", port);
 
 	for (;;) {
-		struct sockaddr_in in;
-		socklen_t addrlen = sizeof(in);
-		int incoming = accept(sockfd, (void *)&in, &addrlen);
-
-		if (incoming < 0) {
-			switch (errno) {
-			case EAGAIN:
-			case EINTR:
-			case ECONNABORTED:
-				continue;
-			default:
-				die("accept returned %s", strerror(errno));
+		struct sockaddr_storage ss;
+		socklen_t sslen = sizeof(ss);
+
+		int i;
+		fds = fds_init;
+		
+		if (select(maxfd + 1, &fds, NULL, NULL, NULL) == -1) {
+			/* warning? */
+			continue;
+		}
+
+		for (i = 0; i < socknum; i++) {
+			int sockfd = socklist[i];
+
+			if (FD_ISSET(sockfd, &fds)) {
+				int incoming = accept(sockfd, (struct sockaddr *)&ss, &sslen);
+				if (incoming < 0) {
+					switch (errno) {
+					case EAGAIN:
+					case EINTR:
+					case ECONNABORTED:
+						continue;
+					default:
+						die("accept returned %s", strerror(errno));
+					}
+				}
+				handle(incoming, (struct sockaddr *)&ss, sslen);
 			}
 		}
-		handle(incoming, &in, addrlen);
 	}
 }
 

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

^ permalink raw reply

* [PATCH 1/2] GIT: Try all addresses for given remote name
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-07-21 13:10 UTC (permalink / raw)
  To: git; +Cc: yoshfuji

Hello.

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

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

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

^ permalink raw reply

* [PATCH] debian packaging fixes
From: Sebastian Kuzminsky @ 2005-07-21  7:56 UTC (permalink / raw)
  To: git

This patch includes two fixes to the git-core Debian package:

    * Conflict with the GNU Interactive Tools package, which _also_
      wants to install /usr/bin/git.

    * Compile against the unencumbered Mozilla SHA1 code, instead of
      the iffy OpenSSL code.  This makes it easier to get the package
      included for distribution with Debian.

Note: Assumes that Ryan Anderson's patch "Deb packages should include
the binaries" has been applied.

Signed-off-by: Sebastian Kuzminsky <seb@highlab.com>
---

 changelog |   11 +++++++++++
 control   |    3 ++-
 rules     |   14 ++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+git-core (0.99.1-1) unstable; urgency=low
+
+  * Conflict with the GNU Interactive Tools package, which also installs
+    /usr/bin/git.
+  * Dont compile against the OpenSSL SHA1 code, it's problematically
+    licensed.  Instead use the PPC assembly on PPC, and the code ripped
+    from Mozilla everywhere else.
+  * Minor tweaks to the Build-Depends.
+
+ -- Sebastian Kuzminsky <seb@highlab.com>  Thu, 21 Jul 2005 01:28:35 -0600
+
 git-core (0.99-1) unstable; urgency=low
 
   * Update deb package support to build correctly. 
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,8 @@
 
 Package: git-core
 Architecture: any
-Depends: ${shlibs:Depends}, shellutils, diff, rysnc, rcs
+Depends: ${shlibs:Depends}, patch, diff, rsync, rcs, wget, rsh-client
+Conflicts: git
 Description: The git content addressable filesystem
  GIT comes in two layers. The bottom layer is merely an extremely fast
  and flexible filesystem-based database designed to store directory trees
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -12,6 +12,20 @@
 endif
 export CFLAGS
 
+#
+# On PowerPC we compile against the hand-crafted assembly, on all
+# other architectures we compile against GPL'ed sha1 code lifted
+# from Mozilla.  OpenSSL is strangely licensed and best avoided
+# in Debian.
+#
+HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
+ifeq (${HOST_ARCH},powerpc)
+	export PPC_SHA1=YesPlease
+else
+	export MOZILLA_SHA1=YesPlease
+endif
+
+
 PREFIX := /usr
 MANDIR := /usr/share/man/
 

-- 
Sebastian Kuzminsky

^ permalink raw reply

* Re: [PATCH 0/9] applymbox updates and assorted trivial patches.
From: Junio C Hamano @ 2005-07-21  6:58 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: Linus Torvalds, git
In-Reply-To: <20050721061906.GN20369@mythryan2.michonline.com>

Ryan Anderson <ryan@michonline.com> writes:

> Is it just me, or does format-patch lose the commit comments during
> export?  I haven't experimented with your new patches yet - and since
> I'm at OLS and playing with Git during my free time, my brain is pretty
> much shut down now - so if you have happen to have fixed that, thanks!

Oh, I envy you guys!  Have fun at OLS.

As far as I know, the commit comments are not lost since the
original version of format-patch.  What I added as extras with
today's patch are the original author name, email and author
timestamp.  There wasn't a provision to record these in the
output from format-patch.

The applymbox/applypatch pair Linus did allowed you to have an
extra "From:" line as the first line of the e-mail patch
submission when you are forwarding a patch somebody else has
written.  When such e-mail is applied to his repository using
applymbox (back then it was called "dotest"), however, the
original author timestamp is lost, and instead the commit gets
timestamp from the message forwarding the patch.  That is what I
meant by the loss of information.

Once I acked a patch to Linus with "Author-Date:" line as the
second line of the e-mail message (the first being the "From:"),
and he told me to refrain from doing it "for now", but that "for
now" has never been lifted, so I decided to lift it myself ;-).

The changed format-patch can be told to produce "Date:" (instead
of "Author-Date:"), and "From:".  There is a corresponding
change to the receiving end (the mailinfo program that is used
by applymbox/applypatch pair) to read this extra "Date:" line
and use that instead of the timestamp obtained from the e-mail
submission.

^ permalink raw reply

* [PATCH/RFC] Add git-changelog-script to show the changes between two commits
From: Ryan Anderson @ 2005-07-21  6:31 UTC (permalink / raw)
  To: git, Linus Torvalds

I'll start by saying that, well, I'm pretty sure this patch is wrong.

I was trying to look at the changes between two commits, sanely, but
failed to find a tool or example in the tree that hinted at how to do
this.

After poking around at git-whatchanged trying to figure out what it is
trying to do - I gave up and wrote something that *seems* to work
correctly for the simple test cases I pulled together.  I just don't
trust it.

My thinking here is that, when doing a release of a package such as git
or Linux, the releaser could do something like:

	git changelog $LAST_RELEASED_COMMIT HEAD | git-shortlog |\
		mail -s "Linux 2.7.0 finally open" linux-kernel

Where LAST_RELEASED is recorded somewhere or pulled from an internal
changelog with something like:
	grep "Released commit-id:" changelog | awk -F: '{print $2}'" |\
		head -1

Signed-off-by: Ryan Anderson <ryan@michonline.com>

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,8 @@ SCRIPTS=git git-apply-patch-script git-m
 	git-reset-script git-add-script git-checkout-script git-clone-script \
 	gitk git-cherry git-rebase-script git-relink-script git-repack-script \
 	git-format-patch-script git-sh-setup-script git-push-script \
-	git-branch-script git-parse-remote
+	git-branch-script git-parse-remote \
+	git-changelog-script git-revdiff-script
 
 PROG=   git-update-cache git-diff-files git-init-db git-write-tree \
 	git-read-tree git-commit-tree git-cat-file git-fsck-cache \
diff --git a/git-changelog-script b/git-changelog-script
new file mode 100755
--- /dev/null
+++ b/git-changelog-script
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+git-revdiff-script $@ | git-diff-tree --stdin --pretty -r | LESS="$LESS -S" ${PAGER:-less}
diff --git a/git-revdiff-script b/git-revdiff-script
new file mode 100755
--- /dev/null
+++ b/git-revdiff-script
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+my ($start,$end) = @ARGV;
+
+open(R,"-|","git-rev-list",$start)
+	or die "Failed to pipe from git-rev-list: " . $!;
+
+my $rev;
+while ($rev = <R>) {
+	chomp $rev;
+	print $rev,"\n";
+	last if $end eq $rev;
+}
+
+close(R);


-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* Re: [PATCH 0/9] applymbox updates and assorted trivial patches.
From: Ryan Anderson @ 2005-07-21  6:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Linus Torvalds, git
In-Reply-To: <7vy881dpii.fsf@assigned-by-dhcp.cox.net>

On Wed, Jul 20, 2005 at 04:30:29PM -0700, Junio C Hamano wrote:
> Since I rebase my repostitory to fix up the history often, I
> needed a reliable way to preserve authorship information when I
> export the patches via format-patch and slurp them via applymbox.

Is it just me, or does format-patch lose the commit comments during
export?  I haven't experimented with your new patches yet - and since
I'm at OLS and playing with Git during my free time, my brain is pretty
much shut down now - so if you have happen to have fixed that, thanks!

[...]

> After they are accepted, I will forward these trivially correct
> patches I saw on the list, using the enhanced format-patch; they
> are expected to be processed with the new applymbox as a
> practice; by doing this I am also ACKing these patches:
> 
>   [PATCH] debian/ fixes

I have more debian/ fixes - I cc:ed you on them since I see you are
collecting things this week.

-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* [PATCH] Deb packages should include the binaries
From: Ryan Anderson @ 2005-07-21  6:15 UTC (permalink / raw)
  To: git, Linus Torvalds


The Deb packages were mising a dependency on "build install" from the
binary target - this fixes that, and cleans up some inconsistencies
elsewhere in the rulesets.

Traditionally, Debian packaging uses a file called "build-stamp" (or
"install-stamp", etc) in the main source tree.  The initial deb package
support for Git tried to move this "build-stamp" file into the debian/
directory, but some instances were missed.  That problem, however, was
incidental - the real fix is the missing dependency mentioned above.


diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,11 @@
+git-core (0.99-1) unstable; urgency=low
+
+  * Update deb package support to build correctly. 
+
+ -- Ryan Anderson <ryan@michonline.com>  Thu, 21 Jul 2005 02:03:32 -0400
+
 git-core (0.99-0) unstable; urgency=low
-	
+
   * Initial deb package support
 
  -- Eric Biederman <ebiederm@xmission.com>  Tue, 12 Jul 2005 10:57:51 -0600
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -21,8 +21,8 @@ DESTDIR  := $(CURDIR)/debian/tmp
 DOC_DESTDIR := $(DESTDIR)/usr/share/doc/git-core/
 MAN_DESTDIR := $(DESTDIR)/$(MANDIR)
 
-build: build-stamp
-build-stamp:
+build: debian/build-stamp
+debian/build-stamp:
 	dh_testdir
 	$(MAKE) all doc
 	touch debian/build-stamp
@@ -36,7 +36,7 @@ debian-clean:
 clean: debian-clean
 	$(MAKE) clean
 
-install: debian/build-stamp
+install: build
 	dh_testdir
 	dh_testroot
 	dh_clean -k 
@@ -49,7 +49,7 @@ install: debian/build-stamp
 
 	dh_install --list-missing --sourcedir=$(DESTDIR)
 
-binary:
+binary: build install
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs
-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* Re: Should cg-mkpatch output be usable with cg-patch?
From: Junio C Hamano @ 2005-07-21  3:57 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: git
In-Reply-To: <20050720234904.B3ED735267C@atlas.denx.de>

Wolfgang Denk <wd@denx.de> writes:

> I wander what I should do with "cg-mkpatch" generated output;  I  had
> the  impression that this should be usable with "cg-patch", but these
> are incompatible with each other. Forexample. if  a  commit  contains
> permission changes, my generated patch may look like this:

Yes, cg-patch does grok git extended diff headers, but does it
by hand and missing corner cases like this is understandable.

I only briefly looked at cg-patch, but I suspect that it can
lose 90% lines of its code by just using "git-apply --index".

I see cg-patch wants to be able to do reverse patch, which is
not supported by git-apply currently.

Do people find "cg-patch -R" useful?

^ permalink raw reply

* Should cg-mkpatch output be usable with cg-patch?
From: Wolfgang Denk @ 2005-07-20 23:49 UTC (permalink / raw)
  To: git

I wander what I should do with "cg-mkpatch" generated output;  I  had
the  impression that this should be usable with "cg-patch", but these
are incompatible with each other. Forexample. if  a  commit  contains
permission changes, my generated patch may look like this:

	...
	diff --git a/MAKEALL b/MAKEALL
	old mode 100644
	new mode 100755
	diff --git a/mkconfig b/mkconfig
	old mode 100644
	new mode 100755
	diff --git a/tools/img2brec.sh b/tools/img2brec.sh
	old mode 100644
	new mode 100755
	...

If I feed this into "cg-patch", I get:

	patch: **** Only garbage was found in the patch input.

-> rpm -q cogito
cogito-0.12.1-1


Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
I really hate this damned machine     It never does quite what I want
I wish that they would sell it.              But only what I tell it.

^ permalink raw reply

* [PATCH] git-format-patch-script and mailinfo updates.
From: Junio C Hamano @ 2005-07-20 23:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

 - avoid duplicating [PATCH] in the commit message body if the
   original commit has it already (happens for commits done from
   mails via applymbox).

 - check if the commit author is different from the one who is
   running the script, and emit an appropriate "From:" and
   "Date: " lines to the output.

 - with '--date', emit "Date: " line to preserve the original
   author date even for the user's own commit.

 - teach mailinfo to grok not just "From: " but "Date: ".

The patch e-mail output by format-patch starts with the first
line from the original commit message, prefixed with [PATCH],
and optionally a From: line if you are reformatting a patch
obtained from somebody else, a Date: line from the original
commit if (1) --date is specified or (2) for somebody else's
patch, and the rest of the commit message body.

Expected use of this is to move the title line from the commit
to Subject: when sending it via an e-mail, and leave the From:
and the Date: lines as the first lines of your message.

The mailinfo command has been changed to read Date: (in addition
to From: it already understands) and do sensible things when
running applymbox.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 git-format-patch-script |   38 +++++++++++++++++++++++++++++++-------
 tools/mailinfo.c        |   10 +++++++++-
 2 files changed, 40 insertions(+), 8 deletions(-)

70e9ebdaa9951183d2e4f9b569dafbc50012d8ec
diff --git a/git-format-patch-script b/git-format-patch-script
--- a/git-format-patch-script
+++ b/git-format-patch-script
@@ -30,6 +30,8 @@ outdir=./
 while case "$#" in 0) break;; esac
 do
     case "$1" in
+    -d|--d|--da|--dat|--date)
+    date=t ;;
     -n|--n|--nu|--num|--numb|--numbe|--number|--numbere|--numbered)
     numbered=t ;;
     -o=*|--o=*|--ou=*|--out=*|--outp=*|--outpu=*|--output=*|--output-=*|\
@@ -56,6 +58,8 @@ esac
 junio=`git-rev-parse --verify "$junio"`
 linus=`git-rev-parse --verify "$linus"`
 
+me=`git-var GIT_AUTHOR_IDENT | sed -e 's/>.*/>/'`
+
 case "$outdir" in
 */) ;;
 *) outdir="$outdir/" ;;
@@ -66,6 +70,7 @@ tmp=.tmp-series$$
 trap 'rm -f $tmp-*' 0 1 2 3 15
 
 series=$tmp-series
+commsg=$tmp-commsg
 
 titleScript='
 	/./d
@@ -82,6 +87,12 @@ titleScript='
 	q
 '
 
+whosepatchScript='
+/^author /{
+	s/author \(.*>\) \(.*\)$/au='\''\1'\'' ad='\''\2'\''/p
+	q
+}'
+
 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
 stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d'
@@ -91,9 +102,8 @@ total=`wc -l <$series`
 i=$total
 while read commit
 do
-    title=`git-cat-file commit "$commit" |
-    git-stripspace |
-    sed -ne "$titleScript"`
+    git-cat-file commit "$commit" | git-stripspace >$commsg
+    title=`sed -ne "$titleScript" <$commsg`
     case "$numbered" in
     '') num= ;;
     *)
@@ -102,6 +112,7 @@ do
 	*) num=' '`printf "%d/%d" $i $total` ;;
 	esac
     esac
+
     file=`printf '%04d-%stxt' $i "$title"`
     i=`expr "$i" - 1`
     echo "$file"
@@ -109,15 +120,28 @@ do
 	mailScript='
 	/./d
 	/^$/n
-	s|^|[PATCH'"$num"'] |
+	s|^\[PATCH[^]]*\] *||
+	s|^|[PATCH'"$num"'] |'
+
+	eval "$(sed -ne "$whosepatchScript" $commsg)"
+	test "$au" = "$me" || {
+		mailScript="$mailScript"'
+	a\
+From: '"$au"
+	}
+	test "$date,$au" = ",$me" || {
+		mailScript="$mailScript"'
+	a\
+Date: '"$ad"
+	}
+
+	mailScript="$mailScript"'
 	: body
 	p
 	n
 	b body'
 
-	git-cat-file commit "$commit" |
-	git-stripspace |
-	sed -ne "$mailScript"
+	sed -ne "$mailScript" <$commsg
 	echo '---'
 	echo
 	git-diff-tree -p $diff_opts "$commit" | git-apply --stat --summary
diff --git a/tools/mailinfo.c b/tools/mailinfo.c
--- a/tools/mailinfo.c
+++ b/tools/mailinfo.c
@@ -220,8 +220,9 @@ static int eatspace(char *line)
 static void handle_body(void)
 {
 	int has_from = 0;
+	int has_date = 0;
 
-	/* First line of body can be a From: */
+	/* First lines of body can have From: and Date: */
 	while (fgets(line, sizeof(line), stdin) != NULL) {
 		int len = eatspace(line);
 		if (!len)
@@ -232,6 +233,13 @@ static void handle_body(void)
 				continue;
 			}
 		}
+		if (!memcmp("Date:", line, 5) && isspace(line[5])) {
+			if (!has_date) {
+				handle_date(line+6);
+				has_date = 1;
+				continue;
+			}
+		}
 		line[len] = '\n';
 		handle_rest();
 		break;

^ permalink raw reply

* [PATCH] tools/applymbox: allow manual fixing and continuing after a failure.
From: Junio C Hamano @ 2005-07-20 23:31 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

With "-c .dotest/0002" flag, the applymbox command can be told
to use existing .dotest/patch file after hand-fixing the patch
conflicts for the second patch in the mailbox, and continue on
from that message, skipping the already applied first patch in
.dotest/0001.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 tools/applymbox |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

688c63d625903ea3972deb3ec5c6dc3ef00f950e
diff --git a/tools/applymbox b/tools/applymbox
--- a/tools/applymbox
+++ b/tools/applymbox
@@ -9,20 +9,48 @@
 ## You give it a mbox-format collection of emails, and it will try to
 ## apply them to the kernel using "applypatch"
 ##
-## dotest [ -q ] mail_archive [Signoff_file]
+## applymbox [ -c .dotest/msg-number ] [ -q ] mail_archive [Signoff_file]"
 ##
-rm -rf .dotest
-mkdir .dotest
-case $1 in
+## The patch application may fail in the middle.  In which case:
+## (1) look at .dotest/patch and fix it up to apply
+## (2) re-run applymbox with -c .dotest/msg-number for the current one.
+## Pay a special attention to the commit log message if you do this and
+## use a Signoff_file, because applypatch wants to append the sign-off
+## message to msg-clean every time it is run.
 
-	-q)	touch .dotest/.query_apply
-		shift;;
+query_apply= continue= resume=t
+while case "$#" in 0) break ;; esac
+do
+	case "$1" in
+	-q)	query_apply=t ;;
+	-c)	continue="$2"; resume=f; shift ;;
+	-*)	usage ;;
+	*)	break ;;
+	esac
+	shift
+done
+
+case "$continue" in
+'')
+	rm -rf .dotest
+	mkdir .dotest
+	mailsplit "$1" .dotest || exit 1
 esac
-mailsplit $1 .dotest || exit 1
-for i in .dotest/*
+
+case "$query_apply" in
+t)	touch .dotest/.query_apply
+esac
+
+for i in .dotest/0*
 do
-	mailinfo .dotest/msg .dotest/patch < $i > .dotest/info || exit 1
-	git-stripspace < .dotest/msg > .dotest/msg-clean
+	case "$resume,$continue" in
+	f,$i)	resume=t;;
+	f,*)	continue;;
+	*)
+		mailinfo .dotest/msg .dotest/patch <$i >.dotest/info || exit 1
+		git-stripspace < .dotest/msg > .dotest/msg-clean
+		;;
+	esac
 	applypatch .dotest/msg-clean .dotest/patch .dotest/info "$2"
 	ret=$?
 	if [ $ret -ne 0 ]; then

^ permalink raw reply

* [PATCH 0/9] applymbox updates and assorted trivial patches.
From: Junio C Hamano @ 2005-07-20 23:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

I was experimenting with applypatch and applymbox to see how it
feels like being Linus ;-) and also I saw some trivially correct
patches on the list floating unmerged during KS/OLS.

Since I rebase my repostitory to fix up the history often, I
needed a reliable way to preserve authorship information when I
export the patches via format-patch and slurp them via applymbox.

I am sending the following changes to applymbox and format-patch
first:

  [PATCH] tools/applymbox: allow manual fixing and continuing after a failure.
  [PATCH] git-format-patch-script and mailinfo updates.
  [PATCH] format-patch: --mbox and --check.

I wrote the first one to recover from a situation where an
earlier patch failed to apply but I still had many other e-mails
in the mailbox.

The second one allows format-patch to give ability to optionally
add From: and Date: lines as the first two lines after the patch
title line.  The mailinfo program has been enhanced to grok
Date: in the top part of the message body just like From: in the
message body can override the sender of the e-mail.

The third one is an extra.  It lets me export patches in a
format resembling UNIX mbox, so I can concatenate the output
together and reprocess them through applymbox.

After they are accepted, I will forward these trivially correct
patches I saw on the list, using the enhanced format-patch; they
are expected to be processed with the new applymbox as a
practice; by doing this I am also ACKing these patches:

  [PATCH] debian/ fixes
  [PATCH] Fix a typo in git-unpack-objects documentation.
  [PATCH] Cleanup: git-verify-tag-script
  [PATCH] Install git-verify-tag-script
  [PATCH] Support more http features: https no cert, .netrc -> auth
  [PATCH] Document "curl" requirements.

^ permalink raw reply

* [PATCH] format-patch: --mbox and --check.
From: Junio C Hamano @ 2005-07-20 22:37 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <7vpstdf6rr.fsf@assigned-by-dhcp.cox.net>

Add --mbox option to export patches in a format resembling UNIX
mbox, so that later they can be concatenated and fed to
applymbox.

Add --check to look for lines that introduce bogus whitespaces.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 git-format-patch-script |   49 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 43 insertions(+), 6 deletions(-)

b9d503a8a5e3d83059836c939a09d5f6abdf5406
diff --git a/git-format-patch-script b/git-format-patch-script
--- a/git-format-patch-script
+++ b/git-format-patch-script
@@ -4,7 +4,7 @@
 #
 
 usage () {
-    echo >&2 "usage: $0"' [-n] [-o dir] [-<diff options>...] upstream [ our-head ]
+    echo >&2 "usage: $0"' [-n] [-o dir] [--mbox] [--check] [-<diff options>...] upstream [ our-head ]
 
 Prepare each commit with its patch since our-head forked from upstream,
 one file per patch, for e-mail submission.  Each output file is
@@ -16,6 +16,10 @@ the current working directory.
 
 When -n is specified, instead of "[PATCH] Subject", the first line is formatted
 as "[PATCH N/M] Subject", unless you have only one patch.
+
+When --mbox is specified, the output is formatted to resemble
+UNIX mailbox format, and can be concatenated together for processing
+with applymbox.
 '
     exit 1
 }
@@ -25,13 +29,19 @@ IFS='
 '
 LF='
 '
-outdir=./
 
+outdir=./
 while case "$#" in 0) break;; esac
 do
     case "$1" in
+    -a|--a|--au|--aut|--auth|--autho|--author)
+    author=t ;;
+    -c|--c|--ch|--che|--chec|--check)
+    check=t ;;
     -d|--d|--da|--dat|--date)
     date=t ;;
+    -m|--m|--mb|--mbo|--mbox)
+    date=t author=t mbox=t ;;
     -n|--n|--nu|--num|--numb|--numbe|--number|--numbere|--numbered)
     numbered=t ;;
     -o=*|--o=*|--ou=*|--out=*|--outp=*|--outpu=*|--output=*|--output-=*|\
@@ -71,6 +81,7 @@ trap 'rm -f $tmp-*' 0 1 2 3 15
 
 series=$tmp-series
 commsg=$tmp-commsg
+filelist=$tmp-files
 
 titleScript='
 	/./d
@@ -115,16 +126,27 @@ do
 
     file=`printf '%04d-%stxt' $i "$title"`
     i=`expr "$i" - 1`
-    echo "$file"
+    echo >&2 "* $file"
     {
 	mailScript='
 	/./d
 	/^$/n
-	s|^\[PATCH[^]]*\] *||
-	s|^|[PATCH'"$num"'] |'
+	s|^\[PATCH[^]]*\] *||'
+
+	case "$mbox" in
+	t)
+	    echo 'From nobody Mon Sep 17 00:00:00 2001' ;# UNIX "From" line
+	    mailScript="$mailScript"'
+	    s|^|Subject: [PATCH'"$num"'] |'
+	    ;;
+	*)
+	    mailScript="$mailScript"'
+	    s|^|[PATCH'"$num"'] |'
+	    ;;
+	esac
 
 	eval "$(sed -ne "$whosepatchScript" $commsg)"
-	test "$au" = "$me" || {
+	test "$author,$au" = ",$me" || {
 		mailScript="$mailScript"'
 	a\
 From: '"$au"
@@ -147,5 +169,20 @@ Date: '"$ad"
 	git-diff-tree -p $diff_opts "$commit" | git-apply --stat --summary
 	echo
 	git-diff-tree -p $diff_opts "$commit" | sed -e "$stripCommitHead"
+
+	case "$mbox" in
+	t)
+		echo
+		;;
+	esac
     } >"$outdir$file"
+    case "$check" in
+    t)
+	# This is slightly modified from Andrew Morton's Perfect Patch.
+	# Lines you introduce should not have trailing whitespace.
+	# Also check for an indentation that has SP before a TAB.
+        grep -n '^+\([ 	]* 	.*\|.*[ 	]\)$' "$outdir$file"
+
+	: do not exit with non-zero because we saw no problem in the last one.
+    esac
 done <$series

^ permalink raw reply

* Re: [PATCH] Misc documentation fixes and improvements
From: Petr Baudis @ 2005-07-20 17:12 UTC (permalink / raw)
  To: Jonas Fonseca; +Cc: git
In-Reply-To: <20050720120501.GA14074@diku.dk>

Dear diary, on Wed, Jul 20, 2005 at 02:05:01PM CEST, I got a letter
where Jonas Fonseca <fonseca@diku.dk> told me that...
> Fix displaying of an error message when cg-help is called with unknown
> command and use $USAGE so the correct cg-help usage string is printed.
> Drop useless use of cat in print_help(). Improve the asciidoc markup.
> 
> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
> ---
> 
> diff --git a/cg-diff b/cg-diff
> --- a/cg-diff
> +++ b/cg-diff
> @@ -3,7 +3,7 @@
>  # Make a diff between two GIT trees.
>  # Copyright (c) Petr Baudis, 2005
>  #
> -# Outputs a diff for converting the first tree to the second one.
> +# Outputs a diff for converting between two trees.
>  # By default compares the current working tree to the state at the
>  # last commit. The output will automatically be displayed in a pager
>  # unless it is piped to a program.

I dropped this hunk (seems to only lose clarity).

> diff --git a/cg-help b/cg-help
> --- a/cg-help
> +++ b/cg-help
> @@ -90,7 +91,7 @@ ADVANCED_COMMANDS="$(ls $bin_path/cg-adm
>  colorize <<__END__
>  The Cogito version control system  $(cg-version)
>  
> -Usage: cg-COMMAND [ARG]...
> +Usage: $USAGE
>  
>  Available commands:
>  $(print_command_listing $REGULAR_COMMANDS)

And I dropped the Usage string here altogether.

Thanks,

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone.  -- Alan Cox

^ permalink raw reply

* Re: [ANNOUNCE] Gct-0.1, a GUI enabled Git commit tool
From: Fredrik Kuivinen @ 2005-07-20 13:23 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Fredrik Kuivinen, git
In-Reply-To: <20050719235810.GF2255@pasky.ji.cz>

On Wed, Jul 20, 2005 at 01:58:11AM +0200, Petr Baudis wrote:
> Dear diary, on Fri, Jul 15, 2005 at 02:46:42AM CEST, I got a letter
> where Fredrik Kuivinen <freku045@student.liu.se> told me that...
> > Hi,
> 
> Hello from a lazy reader who didn't actually try it,
> 
> > Gct v0.1 has been released and can be downloaded from
> > http://www.cyd.liu.se/~freku045/gct/gct-0.1.tar.gz
> > 
> > What follows is an excerpt from the README in the tarball:
> > 
> > Introduction
> > ------------
> > 
> > Git Commit Tool or gct is a simple GUI enabled Git commit tool. It
> > allows the user to select which files should be committed, write
> > commit messages and perform the commit. It also has some support for
> > controlling the synchronisation between the Git cache and the working
> > directory.
> 
> do you have any screenshots please? From the description it appears it
> is actually not any more powerful than cg-commit. Does it let you see
> the diff, actually prune the changes to be committed and such?

I have uploaded a screenshot now, it is available at
http://www.cyd.liu.se/~freku045/gct/

I haven't used cg-commit, but from a quick reading of the code it
seems that the functionality is similar to Gct. You do see the diffs
in Gct but it is currently not possible to do a more fine grained
selection of what to commit (that is, finer than selecting which files
to commit). Selection of individual hunks is on the todo list though.

- Fredrik Kuivinen

^ permalink raw reply

* [PATCH] Misc documentation fixes and improvements
From: Jonas Fonseca @ 2005-07-20 12:05 UTC (permalink / raw)
  To: Petr Baudis, git

Fix displaying of an error message when cg-help is called with unknown
command and use $USAGE so the correct cg-help usage string is printed.
Drop useless use of cat in print_help(). Improve the asciidoc markup.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---

diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -172,7 +172,7 @@ print_help()
 	which "cg-$1" >/dev/null 2>&1 || exit 1
 	sed -n '/^USAGE=/,0s/.*"\(.*\)"/Usage: \1/p' < $(which cg-$1) 
 	echo
-	cat $(which cg-$1) | sed -n '3,/^$/s/^# *//p'
+	sed -n '3,/^$/s/^# *//p' < $(which cg-$1)
 	exit
 }
 
diff --git a/cg-admin-uncommit b/cg-admin-uncommit
--- a/cg-admin-uncommit
+++ b/cg-admin-uncommit
@@ -14,14 +14,14 @@
 # -t::
 #	This optional parameter makes `cg-admin-uncommit` to roll back
 #	the tree as well to the previous commit. Without this option
-#	(by default) Cogito keeps the tree in its current state,
+#	(by default) 'Cogito' keeps the tree in its current state,
 #	therefore generating tree with local changes against the target
 #	commit, consisting of the changes in the rolled back commits.
 #
 # CAVEATS
 # -------
 # This command can be dangerous! It is safe to do as long as you do not
-# push the commit out in the meantime, but you should NEVER uncommit an
+# push the commit out in the meantime, but you should 'NEVER' uncommit an
 # already pushed out commit. Things will break for the pullers since you
 # just broke the fast-forward merging mechanism (the new commit is not
 # descendant of the previous one). The future push scripts will refuse
diff --git a/cg-commit b/cg-commit
--- a/cg-commit
+++ b/cg-commit
@@ -17,7 +17,7 @@
 # -------
 # -C::
 #	Make `cg-commit` ignore the cache and just commit the thing as-is.
-#	Note, this is used internally by Cogito when merging. This option
+#	Note, this is used internally by 'Cogito' when merging. This option
 #	does not make sense when files are given on the command line.
 #
 # -mMESSAGE::
diff --git a/cg-diff b/cg-diff
--- a/cg-diff
+++ b/cg-diff
@@ -3,7 +3,7 @@
 # Make a diff between two GIT trees.
 # Copyright (c) Petr Baudis, 2005
 #
-# Outputs a diff for converting the first tree to the second one.
+# Outputs a diff for converting between two trees.
 # By default compares the current working tree to the state at the
 # last commit. The output will automatically be displayed in a pager
 # unless it is piped to a program.
diff --git a/cg-help b/cg-help
--- a/cg-help
+++ b/cg-help
@@ -14,7 +14,7 @@
 # OPTIONS
 # -------
 # -c::
-#	Colorize to the output.
+#	Colorize the output.
 
 USAGE="cg-help [-c] [cg-COMMAND | COMMAND]"
 _git_repo_unneeded=1
@@ -76,7 +76,8 @@ colorize() {
 
 if [ "$ARGS" ]; then
 	cmd=$(echo "${ARGS[0]}" | sed 's/^cg-//')
-	( print_help $cmd | colorize ) && exit
+	print_help $cmd | colorize
+	[ "${PIPESTATUS[0]}" -eq 0 ] && exit
 	echo "cg-help: no help available for command \"${ARGS[0]}\""
 	echo "Call cg-help without any arguments for the list of available commands"
 	exit 1
@@ -90,7 +91,7 @@ ADVANCED_COMMANDS="$(ls $bin_path/cg-adm
 colorize <<__END__
 The Cogito version control system  $(cg-version)
 
-Usage: cg-COMMAND [ARG]...
+Usage: $USAGE
 
 Available commands:
 $(print_command_listing $REGULAR_COMMANDS)
diff --git a/cg-log b/cg-log
--- a/cg-log
+++ b/cg-log
@@ -14,7 +14,7 @@
 # cg-log then displays only changes in those files.
 #
 # -c::
-#	Colorize to the output. The used colors are listed below together
+#	Colorize the output. The used colors are listed below together
 #	with information about which log output (summary, full or both)
 #	they apply to:
 #		- `author`:	'cyan'		(both)

-- 
Jonas Fonseca

^ 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