class MetaCommit::Index::Adapters::GitNotes
Adapter class to write repository changes to git notes @attr [String] git_folder_path
Attributes
git_folder_path[RW]
Public Class Methods
new(git_folder_path)
click to toggle source
@param [String] git_folder_path
# File lib/meta_commit/index/adapters/git_notes.rb, line 9 def initialize(git_folder_path) @git_folder_path = git_folder_path end
Public Instance Methods
write_repository_change_chunk(repo, repository_changes)
click to toggle source
@param [MetaCommit::Git::Repo] repo @param [MetaCommit::Models::Changes::Repository] repository_changes
# File lib/meta_commit/index/adapters/git_notes.rb, line 15 def write_repository_change_chunk(repo, repository_changes) repository_changes.each do |commit_changes| diffs=[] commit_changes.file_changes.uniq.each do |change| diffs.push(" - #{change.string_representation}") end write_to_notes(commit_changes.new_commit_id, diffs.uniq.join("\n")) end end
Protected Instance Methods
write_to_notes(commit_id, message)
click to toggle source
@param [String] commit_id @param [String] message
# File lib/meta_commit/index/adapters/git_notes.rb, line 27 def write_to_notes(commit_id, message) msg = message.gsub('"', '') return if msg.empty? system("git --git-dir '#{@git_folder_path}' notes add -f -m \"#{msg}\" #{commit_id}") end