Skip to contentSkip to conversation

send-pull-request: send all patches as the local user

PATCH In review Darren Hart 2 participants 2 messages Jan 21, 2011 – Jan 28, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 send-pull-request: send all patches as the local user

Please pull the following patch from poky-contrib/dvhart/git-pull

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: dvhart/git-pull
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/git-pull

Thanks,
Darren Hart <[email protected]>

When using sendmail to send patches, patches would appear to be from the original author as git adds a From: header in the generated patches. This patch changes this behavior to match that of git-send-email, where the email From:
header is that of the current sender (according to sendmail) and a "From:
Original Author <email>" line is inserted into the body of the message.

---
 scripts/send-pull-request |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
scripts/send-pull-request +6 -1
index 9872c0d..af7ce2a 100755
@@ -140,13 +140,18 @@ if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then
                 # appending them to the sendmail command as -- $TO $CC has
                 # proven to be an exercise in futility.
                 #
+                # Clear the From header, leaving it up to sendmail to insert an
+                # appropriate one. Insert the original sender (per git) into the
+                # body of the message.
+                #
                 # Use tail to remove the email envelope from git or formail as
                 # msmtp (sendmail) would choke on them.
                 #
                 # Modify the patch date for sequential delivery, but retain the
                 # original date as "Old-Date".
                 DATE=$(date +"%a, %d %b %Y %k:%M:%S %z")
-                cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -i "Date: $DATE" | tail -n +2 | sendmail -t
+                GIT_FROM=$(cat $PATCH | formail -X "From:")
+                cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -I "From:" -i "Date: $DATE" | sed "0,/^$/s/^$/\n$GIT_FROM\n/" | tail -n +2 | sendmail -t
                 if [ $? -eq 1 ]; then
                     ERROR=1
                 fi
Signature · 5 lines
1.7.1
-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#1 lore raw
Quoted 35 lines · Darren Hart

Please pull the following patch from poky-contrib/dvhart/git-pull

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: dvhart/git-pull
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/git-pull

Thanks,
Darren Hart<[email protected]>

When using sendmail to send patches, patches would appear to be from the original author as git adds a From: header in the generated patches. This patch changes this behavior to match that of git-send-email, where the email From:
header is that of the current sender (according to sendmail) and a "From:
Original Author<email>" line is inserted into the body of the message.

---
  scripts/send-pull-request |    7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)
scripts/send-pull-request +4 -0
index 9872c0d..af7ce2a 100755
@@ -140,13 +140,18 @@ if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then
                  # appending them to the sendmail command as -- $TO $CC has
                  # proven to be an exercise in futility.
                  #
+                # Clear the From header, leaving it up to sendmail to insert an
+                # appropriate one. Insert the original sender (per git) into the
+                # body of the message.
+                #
                  # Use tail to remove the email envelope from git or formail as
                  # msmtp (sendmail) would choke on them.

scripts/send-pull-request if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then · line 157

Quoted 10 lines
scripts/send-pull-request +2 -1
                  #
                  # Modify the patch date for sequential delivery, but retain the
                  # original date as "Old-Date".
                  DATE=$(date +"%a, %d %b %Y %k:%M:%S %z")
-                cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -i "Date: $DATE" | tail -n +2 | sendmail -t
+                GIT_FROM=$(cat $PATCH | formail -X "From:")
+                cat $PATCH | formail -I "To: $TO" -I "CC: $CC" -I "From:" -i "Date: $DATE" | sed "0,/^$/s/^$/\n$GIT_FROM\n/" | tail -n +2 | sendmail -t
                  if [ $? -eq 1 ]; then
                      ERROR=1
                  fi

Pulled into Master

Thanks
Sau!