-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: caret that indicates about deleted line from commit sha1 (#72)
- Loading branch information
Showing
2 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.3 | ||
;; Version: 0.9.4 | ||
|
||
;; 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 | ||
|
@@ -542,7 +542,8 @@ avatar will be downloaded and included in the plist. | |
Run CALLBACK after async process is done." | ||
|
||
(string-match blamer--regexp-info blame-msg) | ||
(let* ((commit-hash (string-trim (match-string 1 blame-msg))) | ||
(let* ((commit-hash (blamer--remove-commit-hash-caret | ||
(string-trim (match-string 1 blame-msg)))) | ||
(raw-commit-author (match-string 2 blame-msg)) | ||
(uncommitted (string= raw-commit-author "Not Committed Yet")) | ||
(commit-author (if (and (string= raw-commit-author blamer--current-author) blamer-self-author-name) | ||
|
@@ -584,8 +585,11 @@ Run CALLBACK after async process is done." | |
:commit-message ,commit-message | ||
:commit-description ,commit-description | ||
:raw-commit-message ,raw-commit-message | ||
:line-number ,line-number))))) | ||
)) | ||
:line-number ,line-number))))))) | ||
|
||
(defun blamer--remove-commit-hash-caret (commit-hash) | ||
"Remove caret from COMMIT-HASH." | ||
(replace-regexp-in-string "^\\^" "" commit-hash)) | ||
|
||
(defun blamer--github-avatar-uploader (remote-url file-path author-email) | ||
"Download the author avatar from REMOTE-URL using the AUTHOR-EMAIL to FILE-PATH." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,21 @@ Date: Sun Aug 4 12:35:21 2024 +0800 | |
(should (equal (match-string 1 commit-msg-1) "deadgrep: Add this package: 替代 rg(ripgrep) 包\n\n")))) | ||
|
||
|
||
(ert-deftest test-parse-commit-message-with-cjk-characters () | ||
"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 | ||
magit: 添加自动分裂窗口功能 | ||
")) | ||
(string-match blamer--commit-message-regexp commit-msg-1) | ||
(should (equal (match-string 1 commit-msg-1) "magit: 添加自动分裂窗口功能\n\n")))) | ||
|
||
|
||
(defun format-date-to-string (date) | ||
"Format date to test string." | ||
(format-time-string "%Y-%m-%d" date)) | ||
|
@@ -171,3 +186,12 @@ Date: Sun Aug 4 12:35:21 2024 +0800 | |
(should (equal "15:40" (blamer--truncate-time "15:40:22"))) | ||
(should (equal "00:00" (blamer--truncate-time "00:00:00"))) | ||
(should (equal "12:30" (blamer--truncate-time "12:30:21")))) | ||
|
||
|
||
(ert-deftest test-replace-caret-in-sha-commit () | ||
"Test replacing caret in commit sha." | ||
(should (equal "fcb7278" (blamer--remove-commit-hash-caret "^fcb7278")))) | ||
|
||
(ert-deftest test-note-replace-caret-in-sha-commit () | ||
"Test not replacing caret in commit sha." | ||
(should (equal "fcb7278" (blamer--remove-commit-hash-caret "fcb7278")))) |