git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Set AUTHOR_DATE in git-tools
@ 2005-04-21  7:32 David Woodhouse
  2005-04-26 18:44 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: David Woodhouse @ 2005-04-21  7:32 UTC (permalink / raw)
  To: torvalds; +Cc: git

Entirely untested.

Makefile: eca3a5d5256cca06d86ebb85ec9d3218752ffcd2
applypatch: 397e4a0e506f1c5765767057dfe506154b743b83
--- a/applypatch
+++ b/applypatch
@@ -26,6 +26,7 @@ EDIT=${EDIT:-vi}
 
 export AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' .dotest/info)"
 export AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' .dotest/info)"
+export AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' .dotest/info)"
 export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' .dotest/info)"
 
 if [ -n "$signoff" -a -f "$signoff" ]; then
dotest: a3e3d35ae0afa358f01b49eecb358d64c616c3e4
mailinfo.c: c1dcac130530174ec5335d2c752d76403ad1d3ad
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -13,6 +13,7 @@ static char line[1000];
 static char name[1000];
 static char email[1000];
 static char subject[1000];
+static char date[1000];
 
 static char *sanity_check(char *name, char *email)
 {
@@ -83,6 +84,11 @@ static void handle_subject(char *line)
 	strcpy(subject, line);
 }
 
+static void handle_date(char *line)
+{
+	strcpy(date, line);
+}
+
 static void add_subject_line(char *line)
 {
 	while (isspace(*line))
@@ -99,6 +105,11 @@ static void check_line(char *line, int l
 		cont = 0;
 		return;
 	}
+	if (!memcmp(line, "Date:", 5) && isspace(line[5])) {
+		handle_date(line+6);
+		cont = 0;
+		return;
+	}
 	if (!memcmp(line, "Subject:", 8) && isspace(line[8])) {
 		handle_subject(line+9);
 		cont = 1;
@@ -107,7 +118,7 @@ static void check_line(char *line, int l
 	if (isspace(*line)) {
 		switch (cont) {
 		case 0:
-			fprintf(stderr, "I don't do 'From:' line continuations\n");
+			fprintf(stderr, "I don't do 'From:' or 'Date:' header continuations\n");
 			break;
 		case 1:
 			add_subject_line(line);
@@ -215,7 +226,8 @@ static void handle_rest(void)
 	cleanup_space(name);
 	cleanup_space(email);
 	cleanup_space(sub);
-	printf("Author: %s\nEmail: %s\nSubject: %s\n\n", name, email, sub);
+	cleanup_space(date);
+	printf("Author: %s\nEmail: %s\nSubject: %s\nDate: %s\n", name, email, sub, date);
 	FILE *out = cmitmsg;
 
 	do {
mailsplit.c: 9379fbc5e84983e5ea0754a6587cc3490c696c69

-- 
dwmw2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Set AUTHOR_DATE in git-tools
  2005-04-21  7:32 [PATCH] Set AUTHOR_DATE in git-tools David Woodhouse
@ 2005-04-26 18:44 ` Greg KH
  2005-04-27  3:52   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2005-04-26 18:44 UTC (permalink / raw)
  To: David Woodhouse; +Cc: torvalds, git

On Thu, Apr 21, 2005 at 05:32:16PM +1000, David Woodhouse wrote:
> Entirely untested.

Doesn't work :(

And I couldn't see a simple reason why, oh well.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Set AUTHOR_DATE in git-tools
  2005-04-26 18:44 ` Greg KH
@ 2005-04-27  3:52   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2005-04-27  3:52 UTC (permalink / raw)
  To: David Woodhouse; +Cc: torvalds, git

On Tue, Apr 26, 2005 at 11:44:42AM -0700, Greg KH wrote:
> On Thu, Apr 21, 2005 at 05:32:16PM +1000, David Woodhouse wrote:
> > Entirely untested.
> 
> Doesn't work :(

I take it back, it works just fine... 

My problem was that bk generates dates with a non-rfc compliant timezone
string.  And I was trying to apply patches exported from bk in plain
text format (building a udev git tree...)  The patch below to
commit-tree.c fixes this issue, if anyone runs into this same issue (I
wouldn't recommend it to be applied, as it's probably a one-off
issue...)

thanks,

greg k-h
--------------
Allow commit-tree to handle the bk date format.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


--- a/commit-tree.c	2005-04-25 22:08:49.000000000 -0700
+++ b/commit-tree.c	2005-04-26 20:46:37.000000000 -0700
@@ -204,6 +204,12 @@
 	else
 	       return;
 
+	/* Handle messed up bk dates */
+	if (p[3] == ':') {
+		p[3] = p[4];
+		p[4] = p[5];
+		p[5] = p[6];
+	}
 	if (!isdigit(p[1]) || !isdigit(p[2]) || !isdigit(p[3]) || !isdigit(p[4]))
 		return;
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-27  3:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-21  7:32 [PATCH] Set AUTHOR_DATE in git-tools David Woodhouse
2005-04-26 18:44 ` Greg KH
2005-04-27  3:52   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).