The following commit has been merged in the master branch:
commit 934b0a90ac754d51c7785b2fb10f1f4b91c58525
Author: James Vega <[email protected]>
Date:   Thu Jan 14 21:53:26 2010 -0500

    debcommit: Ensure the edit message has an EOL on the last line.
    
    Without that, some editors may think the user is editing a file with mac 
line
    endings.  If the commit message they draft then has multiple lines, we end 
up
    setting a commit message that has ^M bytes in it.

diff --git a/debian/changelog b/debian/changelog
index 95519e7..d8bf00b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ devscripts (2.10.62) UNRELEASED; urgency=low
     + Treat darcs similar to hg with respect to determining the commit
       message.  Fold a single change into one line and spawn an editor if
       multiple changes are detected.  (Closes: #563901)
+    + Ensure the commit message presented to the user for editing always has
+      an EOL on the last line.
   * rmadison:
     + Add http://qa.debian.org/cgi-madison/madison.cgi, shorthand "udd", as a
       known madison URL.
diff --git a/scripts/debcommit.pl b/scripts/debcommit.pl
index 57ab03e..8555b8a 100755
--- a/scripts/debcommit.pl
+++ b/scripts/debcommit.pl
@@ -792,7 +792,7 @@ sub confirm {
            $message = $confirmmessage;
            return 1;
        } elsif (/^e/i) {
-           ($confirmmessage) = edit("$confirmmessage\n");
+           ($confirmmessage) = edit($confirmmessage);
            print "\n", $confirmmessage, "\n--\n";
        }
     }
@@ -804,7 +804,9 @@ sub edit {
     my $message=shift;
     my $fh=File::Temp->new(TEMPLATE => '.commit-tmp.XXXXXX')
        || die "$progname: unable to create a temporary file.\n";
-    $fh->print($message);
+    # Ensure the message we present to the user has an EOL on the last line.
+    chomp($message);
+    $fh->print("$message\n");
     $fh->close();
     my $mtime = (stat("$fh"))[9];
     defined $mtime || die "$progname: unable to retrieve modification time for 
temporary file: $!\n";

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to