Module: Ace::Git::Molecules::RecentCommitsFetcher
- Defined in:
- lib/ace/git/molecules/recent_commits_fetcher.rb
Overview
Fetches recent commits from the repository Returns commit hashes and subjects in oneline format
Class Method Summary collapse
-
.fetch(limit: 3, executor: Atoms::CommandExecutor) ⇒ Hash
Fetch recent commits.
Class Method Details
.fetch(limit: 3, executor: Atoms::CommandExecutor) ⇒ Hash
Fetch recent commits
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ace/git/molecules/recent_commits_fetcher.rb', line 14 def fetch(limit: 3, executor: Atoms::CommandExecutor) return {success: true, commits: []} if limit <= 0 result = executor.execute( "git", "log", "-#{limit}", "--format=%h %s" ) if result[:success] commits = parse_commits(result[:output]) {success: true, commits: commits} else {success: false, commits: [], error: result[:error]} end rescue => e {success: false, commits: [], error: e.} end |