[Pkg-javascript-commits] [node-coveralls] 207/332: Fix parsing git message with REGEX_COMMIT_DETAILS

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 13:54:01 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-coveralls.

commit 249e4673a1f5b956428b0334ac3d19184409cc3b
Author: Joshua Ma <me at joshma.com>
Date:   Mon Jul 13 20:05:32 2015 -0700

    Fix parsing git message with REGEX_COMMIT_DETAILS
    
    Given the commit message
    ```
        tree 2d257d54add0901a72fbe492538aec4a35b4f4a5
        parent 21d9ce4eb278af46561e069d6410e72a88c38036
        author Joshua Ma <josh at benchling.com> 1436838814 -0700
        committer Joshua Ma <josh at benchling.com> 1436839048 -0700
    
        main message
    
        secondary detail
    ```
    REGEX_COMMIT_DETAILS previously incorrectly matched `secondary detail` as the
    message - it lets an optional newline match (A), followed by nongreedy
    `[\S\s]+`, until a double-newline (B) is found. The message used is what
    follows B. Since there's two double-newlines, before `main message` and
    `secondary detail`, the first double-newline is used towards (A) and the second
    set is the one that matches (B). So the message ends up being `secondary detail`.
    
    This change simplifies the regex to just a nongreedy `[\S\s]*` until the first
    double-newline, after which the message is expected.
---
 lib/fetchGitData.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fetchGitData.js b/lib/fetchGitData.js
index 67b6190..0c516d3 100644
--- a/lib/fetchGitData.js
+++ b/lib/fetchGitData.js
@@ -59,7 +59,7 @@ function fetchBranch(git, cb) {
   });
 }
 
-var REGEX_COMMIT_DETAILS = /\nauthor (.+?) <(.+?)>.+\ncommitter (.+?) <(.+?)>.+\n?[\S\s]+?\n\n(.*)/m;
+var REGEX_COMMIT_DETAILS = /\nauthor (.+?) <(.+?)>.+\ncommitter (.+?) <(.+?)>.+[\S\s]*?\n\n(.*)/m;
 
 function fetchHeadDetails(git, cb) {
   exec('git cat-file -p ' + git.head.id, function(err, response) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git



More information about the Pkg-javascript-commits mailing list