Subject: Re: [PATCH 00/12] Towards a better merge resolution support

From: Thomas Rast <[email-masked]>
Date: Mon, 1 Sep 2008 14:20:58 +0200

Abhijit Menon-Sen wrote:
> At 2008-09-01 11:44:12 +0200, [email-masked] wrote:
> >
> > IOW, copy the commit resolution from some other merge commit. Maybe
> > can be a way to use rerere mechanism with that?
> 
> That's what I'm trying to implement on Dscho's suggestion. I'm still
> just trying to understand the code, so any suggestions about how to
> do this are very welcome.

Random idea: you could use a script that just replays the merges
present in history and lets rerere record them.  Like so:

-- 8< --
#!/bin/sh

. "$(git --exec-path)/git-sh-setup"

require_work_tree
git update-index --refresh || die "can't run with dirty index"

git rev-list --parents "$@" |
grep '.* .* .*' |
while read merge firstparent otherparents
do
	git checkout $firstparent >/dev/null 2>/dev/null
	git merge $otherparents >/dev/null
	if test -z "$(git ls-files -u)"; then
		echo -n 'no conflicts: '
		git --no-pager log -1 --pretty=oneline --abbrev-commit $merge
		continue
	fi
	git rerere
	git ls-files -t | grep ^M | cut -c 3- | xargs git checkout $merge --
	git rerere
	git reset --hard >/dev/null 2>/dev/null
	echo -n 'recorded:     '
	git --no-pager log -1 --pretty=oneline --abbrev-commit $merge
done
-- >8 --

The intended usage is like

  ./rerereimport.sh v1.6.0..origin/next

to import all resolutions in the specified range.  Granted, it's
probably not as good and definitely not as fast as an automatic
feature integrated with the merge machinery.

- Thomas

-- 
Thomas Rast
[email-masked]