Skip to content

Commit ef3e1be

Browse files
committed
hyperlink commit hashes of length 7 as well
1 parent 440cdd3 commit ef3e1be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/features/hyperlinks.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ pub fn remote_from_config(cfg: &Option<&GitConfig>) -> Option<GitRemoteRepo> {
3232
}
3333

3434
lazy_static! {
35-
// note: pure numbers are filtered out later again
36-
static ref COMMIT_HASH_REGEX: Regex = Regex::new(r"\b[0-9a-f]{8,40}\b").unwrap();
35+
// Commit hashes can be abbreviated to 7 characters, these necessarily become longer
36+
// when more objects are in a repository.
37+
// Note: pure numbers are filtered out later again.
38+
static ref COMMIT_HASH_REGEX: Regex = Regex::new(r"\b[0-9a-f]{7,40}\b").unwrap();
3739
}
3840

3941
pub fn format_commit_line_with_osc8_commit_hyperlink<'a>(

0 commit comments

Comments
 (0)