Class: Command::Commit
- Includes:
- WriteCommit
- Defined in:
- lib/command/commit.rb
Constant Summary collapse
- COMMIT_NOTES =
<<~MSG Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. MSG
Constants included from WriteCommit
WriteCommit::CHERRY_PICK_NOTES, WriteCommit::CONFLICT_MESSAGE, WriteCommit::MERGE_NOTES
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from WriteCommit
#commit_message_path, #compose_merge_message, #current_author, #define_write_commit_options, #handle_conflicted_index, #pending_commit, #print_commit, #read_message, #resume_merge, #write_cherry_pick_commit, #write_commit, #write_merge_commit, #write_revert_commit, #write_tree
Methods inherited from Base
Constructor Details
This class inherits a constructor from Command::Base
Instance Method Details
#define_options ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/command/commit.rb', line 16 def @parser.on("--amend") { @options[:amend] = true } @parser.on "-C <commit>", "--reuse-message=<commit>" do |commit| @options[:reuse] = commit @options[:edit] = false end @parser.on "-c <commit>", "--reedit-message=<commit>" do |commit| @options[:reuse] = commit @options[:edit] = true end end |
#run ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/command/commit.rb', line 32 def run repo.index.load handle_amend if @options[:amend] merge_type = pending_commit.merge_type resume_merge(merge_type) if merge_type parent = repo.refs.read_head = ( || ) commit = write_commit([*parent], ) print_commit(commit) exit 0 end |