diff --git a/blamer.el b/blamer.el index 8e708d5..aa6bd60 100644 --- a/blamer.el +++ b/blamer.el @@ -5,7 +5,7 @@ ;; Author: Artur Yaroshenko ;; URL: https://github.com/artawower/blamer.el ;; Package-Requires: ((emacs "27.1") (posframe "1.1.7") (async "1.9.8")) -;; Version: 0.9.2 +;; Version: 0.9.3 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ 3 - date 3 - time") -(defconst blamer--commit-message-regexp "\n\n[\s]+\\(\\(?:.\\|\n\\)+\\):?" +(defconst blamer--commit-message-regexp "\r?\n\r?\n[\s]+\\(\\(?:.\\|\r?\n\\)+\\):?" "Regexp for commit message parsing.") (defconst blamer--git-author-cmd '("config" "--get" "user.name") diff --git a/test.el b/test.el index 5a085d6..7d07bd4 100644 --- a/test.el +++ b/test.el @@ -76,6 +76,21 @@ But! What we can do with this enormous commit message? Nothing. 123955!!.~\n\n") )) +(ert-deftest test-parse-commit-message-from-windows-machine () + "Test commit parser regexp for windows commit message." + (let ((commit-msg-1 "my@gmail.com commit b645fb973309696f51719b03f8a4f478a0e670f2 + +Author: ISouthRain + +Date: Sun Aug 4 12:35:21 2024 +0800 + + deadgrep: Add this package: 替代 rg(ripgrep) 包 + +")) + (string-match blamer--commit-message-regexp commit-msg-1) + (should (equal (match-string 1 commit-msg-1) "deadgrep: Add this package: 替代 rg(ripgrep) 包\n\n")))) + + (defun format-date-to-string (date) "Format date to test string." (format-time-string "%Y-%m-%d" date))