Skip to contentSkip to conversation

git-am: catch missing author date early.

DISCUSSION Len Brown 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Len Brown

author
#0 lore raw

This change made git-am more difficult to use.

I tend to check-in a fair number of patches that didn't come from an e-mail message. In the past, I slap a Subject: and a From: on the top of the commit message and off I go.

With this change git-am fails b/c I haven't also conjured up the time, when in the past it figured out what time it was for me.

thanks,
-Len

commit 6e9e0327b7d7f384d8a223b4bc40330ef3e7fb61

Author: Junio C Hamano <[email protected]>
Date:   Sun Dec 2 14:38:40 2007 -0800

git-am: catch missing author date early.

Even though commit-tree would default to the current time if the incoming e-mail message somehow did not record the timestamp, it is safer to catch the breakage sooner.

git-am.sh +2 -2
index 76c1c84..2e40708 100755
@@ -307,9 +307,9 @@ do
 	GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$dotest/info")"
 	GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$dotest/info")"
 
-	if test -z "$GIT_AUTHOR_EMAIL"
+	if test -z "$GIT_AUTHOR_EMAIL" || test -z "$GIT_AUTHOR_DATE"
 	then
-		echo "Patch does not have a valid e-mail address."
+		echo "Patch does not have valid authorship information."
 		stop_here $this
 	fi
 
#1 lore raw

Sorry, and thanks for the report.

Jens complained the same yesterday and the change was reverted.