Method: GitHelpers::GitExtraInfos#neck

Defined in:
lib/git_helpers/extra_helpers.rb

#neck(*args, **opts) ⇒ Object

inspired by git-neck from https://github.com/cypher/dotfiles



150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/git_helpers/extra_helpers.rb', line 150

def neck(*args, **opts)
	with_dir do
		commit=`git rev-parse --revs-only --default HEAD #{args.shelljoin}`.chomp
		log_opts=`git rev-parse --flags --no-revs #{args.shelljoin}`.chomp
		hash=`git rev-parse #{commit.shellescape}`.chomp
		merges=trails(commit, **opts)
		merges.delete(hash) #todo: only delete if we are the only tip
		merges.delete(:disjoint)
		system("git --no-pager -c color.ui=always log --pretty=suminfo #{log_opts} #{merges.keys.map {|mb| "^#{mb}"}.join(" ")} #{commit}")
		puts
	end
end