Skip to content

Commit

Permalink
fix: new line parsing for windows system
Browse files Browse the repository at this point in the history
  • Loading branch information
Artawower committed Sep 8, 2024
1 parent a652682 commit 4004f8e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blamer.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; Author: Artur Yaroshenko <[email protected]>
;; 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
Expand Down Expand Up @@ -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")
Expand Down
15 changes: 15 additions & 0 deletions test.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected] commit b645fb973309696f51719b03f8a4f478a0e670f2
Author: ISouthRain <[email protected]>
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))
Expand Down

0 comments on commit 4004f8e

Please sign in to comment.