threads / patch / 33894

patchguilt: fix date parsing

Subject: [PATCH] guilt: fix date parsing

## tl;dr

4 messages between May 22, 2013 and May 22, 2013. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Theodore Ts'o· May 22, 2013, 03:13 UTC · lore
If the date field has a space in it, such as:
   Date: Tue, 14 May 2013 18:37:15 +0200
previously guilt would go belly up:
   + export GIT_AUTHOR_DATE=Tue, 14 May 2013 18:37:15 +0200
   /usr/local/bin/guilt: 571: export: 14: bad variable name
Fix this.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 guilt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to guilt +1 −1
diff --git a/guilt b/guilt
index 9953bdf..6e8d542 100755
--- a/guilt
+++ b/guilt
@@ -568,7 +568,7 @@ commit()
 				author_date_str=`sed -n -e '/^Date:/ { s/^Date: //; p; q; }; /^(diff |---$|--- )/ q' "$p"`
 			fi
 			if [ ! -z "$author_date_str" ]; then
-				export GIT_AUTHOR_DATE=`echo $author_date_str`
+				export GIT_AUTHOR_DATE="$author_date_str"
 			fi
 		fi
 
-- 
1.7.12.rc0.22.gcdd159b
Josef 'Jeff' Sipek· May 22, 2013, 03:39 UTC · re: Theodore Ts'o · lore

Re: [PATCH] guilt: fix date parsing

I applied this one and the "guilt: skip empty line after..." patch.
Jeff.
On Tue, May 21, 2013 at 11:13:31PM -0400, Theodore Ts'o wrote:
Show 32 quoted lines
> If the date field has a space in it, such as:
> 
>    Date: Tue, 14 May 2013 18:37:15 +0200
> 
> previously guilt would go belly up:
> 
>    + export GIT_AUTHOR_DATE=Tue, 14 May 2013 18:37:15 +0200
>    /usr/local/bin/guilt: 571: export: 14: bad variable name
> 
> Fix this.
> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
>  guilt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/guilt b/guilt
> index 9953bdf..6e8d542 100755
> --- a/guilt
> +++ b/guilt
> @@ -568,7 +568,7 @@ commit()
>  				author_date_str=`sed -n -e '/^Date:/ { s/^Date: //; p; q; }; /^(diff |---$|--- )/ q' "$p"`
>  			fi
>  			if [ ! -z "$author_date_str" ]; then
> -				export GIT_AUTHOR_DATE=`echo $author_date_str`
> +				export GIT_AUTHOR_DATE="$author_date_str"
>  			fi
>  		fi
>  
> -- 
> 1.7.12.rc0.22.gcdd159b
> 
-- 
The obvious mathematical breakthrough would be development of an easy way to
factor large prime numbers.
		- Bill Gates, The Road Ahead, pg. 265
Theodore Ts'o· May 22, 2013, 12:10 UTC · re: Josef 'Jeff' Sipek · lore

Re: [PATCH] guilt: fix date parsing

On Tue, May 21, 2013 at 11:39:21PM -0400, Josef 'Jeff' Sipek wrote:
> I applied this one and the "guilt: skip empty line after..." patch.

Thanks! BTW, it looks like you are not using "git am -s" to apply these patches? The reason why I ask is that whatever you're using isn't removing the [XXX] subject prefix (e.g., [PATCH] or [PATCH -v2] which is useful for mailing lists, but less useful in the git commit descriptions.

If you're using guilt, do you have some script that preformats a Unix mbox into guilt-friendly files? If so, maybe it would be good to modify it to strip out the [PATCH] annotations. If not, let me know, since I've been thinking about writing a script to take a Unix mbox, and bursts it into a separate patch-per-file with a series file suitable for use by guilt, removing mail headers and doing other appropriate pre-parsing --- basically, a "guilt am" which works much like "git am". But if someone else has done this already, no point duplicating effort. :-)

						- Ted
Josef 'Jeff' Sipek· May 22, 2013, 13:31 UTC · re: Theodore Ts'o · lore

Re: [PATCH] guilt: fix date parsing

On Wed, May 22, 2013 at 08:10:10AM -0400, Theodore Ts'o wrote:
Show 18 quoted lines
> On Tue, May 21, 2013 at 11:39:21PM -0400, Josef 'Jeff' Sipek wrote:
> > I applied this one and the "guilt: skip empty line after..." patch.
> 
> Thanks!  BTW, it looks like you are not using "git am -s" to apply
> these patches?  The reason why I ask is that whatever you're using
> isn't removing the [XXX] subject prefix (e.g., [PATCH] or [PATCH -v2]
> which is useful for mailing lists, but less useful in the git commit
> descriptions.
> 
> If you're using guilt, do you have some script that preformats a Unix
> mbox into guilt-friendly files?  If so, maybe it would be good to
> modify it to strip out the [PATCH] annotations.  If not, let me know,
> since I've been thinking about writing a script to take a Unix mbox,
> and bursts it into a separate patch-per-file with a series file
> suitable for use by guilt, removing mail headers and doing other
> appropriate pre-parsing --- basically, a "guilt am" which works much
> like "git am".  But if someone else has done this already, no point
> duplicating effort.  :-)

You are correct. I just `guilt import -P blah /tmp/mdir/cur/X` and then hand-edit the patch to remove headers. Last night I was thinking about making a `guilt import-mbox` that'd import a mbox or maildir. I don't know off the top of my head how much `git am` would help in this instance.

Feel free to make the import-mbox or whatever command :)
Jeff.
-- 
Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former.
		- Albert Einstein

← back to recent threads