All of lore.kernel.org
 help / color / mirror / Atom feed
* git-commit: allow From: line to be entered in commit message
@ 2006-01-12 14:37 ` sean
  2006-01-12 15:21     ` sean
  2006-01-12 20:13   ` Junio C Hamano
  0 siblings, 2 replies; 30+ messages in thread
From: sean @ 2006-01-12 14:37 UTC (permalink / raw)
  To: git


Mostly just for comment to see if there is any support
for this feature....

Sean

---
Use the author name and email information given as the 
first line of the commit message in the form of:

From: name <email>

as the author's name and email address in the resulting
commit object.  This makes committing foreign patches
a little less cumbersome to handle for some workflows.


diff --git a/git-commit.sh b/git-commit.sh
index 193feeb..6004cd4 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -219,7 +219,7 @@ t)
 	fi
 esac
 
-grep -v '^#' < "$GIT_DIR"/COMMIT_EDITMSG |
+grep -v '^#' < "$GIT_DIR"/COMMIT_EDITMSG | sed -e '1s/^[ \t]*from:.*//I' |
 git-stripspace > "$GIT_DIR"/COMMIT_MSG
 
 if cnt=`grep -v -i '^Signed-off-by' "$GIT_DIR"/COMMIT_MSG |
@@ -227,6 +227,13 @@ if cnt=`grep -v -i '^Signed-off-by' "$GI
 	wc -l` &&
    test 0 -lt $cnt
 then
+	FROM=$(grep -v '^#' < "$GIT_DIR"/COMMIT_EDITMSG | sed -ne '1s/from:[ \t]*\(.*\)/\1/Ip;q')
+	NAME=$(echo "$FROM" | sed -e 's/<.*//;s/[ \t]*$//')
+	EMAIL=$(echo "$FROM" | sed -e 's/.*<\(.*\)>.*/\1/')
+	if test -n "$FROM"; then
+		export GIT_AUTHOR_NAME="$NAME"
+		export GIT_AUTHOR_EMAIL="$EMAIL"
+	fi
 	tree=$(git-write-tree) &&
 	commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) &&
 	git-update-ref HEAD $commit $current &&

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

end of thread, other threads:[~2006-01-13 21:53 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-12 14:37 git-commit: allow From: line to be entered in commit message sean
2006-01-12 14:37 ` sean
2006-01-12 15:21   ` sean
2006-01-12 15:21     ` sean
2006-01-12 20:13   ` Junio C Hamano
2006-01-12 21:53     ` Andreas Ericsson
2006-01-12 22:15       ` Junio C Hamano
2006-01-13  2:43       ` sean
2006-01-13  2:43         ` sean
2006-01-13  2:32     ` sean
2006-01-13  2:32       ` sean
2006-01-13  4:03         ` Junio C Hamano
2006-01-13  4:06           ` sean
2006-01-13  4:06             ` sean
2006-01-13  4:35               ` Junio C Hamano
2006-01-13  4:51                 ` sean
2006-01-13  4:51                   ` sean
2006-01-13 11:11                     ` Artem Khodush
2006-01-13 17:40                       ` Junio C Hamano
2006-01-13 17:54                         ` sean
2006-01-13 17:54                           ` sean
2006-01-13 19:51                             ` Junio C Hamano
2006-01-13 21:53                               ` Johannes Schindelin
2006-01-12 19:00 ` Joel Becker
2006-01-12 20:22   ` Junio C Hamano
2006-01-13  6:58     ` Joel Becker
2006-01-13  7:06       ` Junio C Hamano
2006-01-13 19:12         ` Joel Becker
2006-01-13 19:39           ` Junio C Hamano
2006-01-13 20:01             ` Joel Becker
2006-01-13 20:33               ` Junio C Hamano
2006-01-13 20:46                 ` Junio C Hamano
2006-01-13 21:47           ` Johannes Schindelin
2006-01-12 20:16 ` Alex Riesen
2006-01-13  2:46   ` sean
2006-01-13  2:46     ` sean
2006-01-13  3:58       ` Junio C Hamano
2006-01-13  3:58         ` sean
2006-01-13  3:58           ` sean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.