module Git::Repository::Merging::Private
Private helpers local to {Git::Repository::Merging}
@api private
Constants
- STAGE_PREFIXES
-
Tempfile name prefixes for staged content, keyed by git stage index
Public Instance Methods
Source
# File lib/git/repository/merging.rb, line 319 def unmerged_paths(execution_context) result = Git::Commands::Diff.new(execution_context).call(cached: true) result.stdout.split("\n").filter_map do |line| ::Regexp.last_match(1) if line =~ /^\* Unmerged path (.*)/ end end
Returns the list of file paths with unresolved merge conflicts
@param execution_context [Git::ExecutionContext] the execution context
used to run git commands
@return [Array<String>] unmerged file paths
@api private
Source
# File lib/git/repository/merging.rb, line 346 def write_staged_file(execution_context, file_path, stage) Tempfile.create([STAGE_PREFIXES[stage], File.basename(file_path)]) do |f| Git::Commands::Show.new(execution_context).call(":#{stage}:#{file_path}", out: f) f.flush yield f end end
Creates a Tempfile with the staged content for βfile_path` at `stage` and yields the open IO object to the block
@param execution_context [Git::ExecutionContext] the execution context
used to run git commands
@param file_path [String] repository-relative path to the conflicting file
@param stage [Integer] git stage index (2 = ours, 3 = theirs)
@return [void]
@yield [f] yields the open Tempfile containing the staged content
@yieldparam f [Tempfile] open IO object for the staged content
@yieldreturn [void]
@api private