Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Ignore commits starting with "META" in commit message #88

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions lib/jekyll-last-modified-at/determinator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,24 @@ def last_modified_at_time

def last_modified_at_unix
if git.git_repo?
last_commit_date = Executor.sh(
last_commit_date_log = Executor.sh(
'git',
'--git-dir',
git.top_level_directory,
'log',
'-n',
'1',
'--format="%ct"',
'--follow',
'--format="%ct %s"',
'--',
relative_path_from_git_dir
)[/\d+/]
relative_path_from_git_dir,
)
last_commit_date_array = last_commit_date_log.split("\n")
last_commit_date = nil
last_commit_date_array.each do |i|
commit_date, commit_subject_first_word = i.delete_prefix('"').delete_suffix('"').split
next if commit_subject_first_word.eql? 'META'
last_commit_date = commit_date
break
end
# last_commit_date can be nil iff the file was not committed.
last_commit_date.nil? || last_commit_date.empty? ? mtime(absolute_path_to_article) : last_commit_date
else
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll-last-modified-at/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Jekyll
module LastModifiedAt
VERSION = '1.3.0'
VERSION = '1.3.1-PEM1'
end
end