Re: [PATCH] mergetools: Add tortoisegitmerge helper
- From
John Keeping <john@keeping.me.uk>
- Date
- Jan 25, 2013, 09:48 UTC
- Message-ID
- <20130125094823.GW7498@serenity.lan>
- In-Reply-To
- <CAJDDKr4oerSq16rYt2iKNtQNK79L+jOiKROhEW_yiBPKjkVhuQ@mail.gmail.com>
On Thu, Jan 24, 2013 at 11:54:25PM -0800, David Aguilar wrote:
Show 29 quoted lines
> On Thu, Jan 24, 2013 at 11:21 PM, Junio C Hamano <gitster@pobox.com> wrote: > > Is there a way for me to programatically tell what merge.tool and > > diff.tool could be enabled for a particular source checkout of Git > > regardless of what platform am I on (that is, even though I won't > > touch Windows, I want to see 'tortoise' appear in the output of such > > a procedure)? We could generate a small text file from the Makefile > > in Documentation and include it when building the manual pages if > > such a procedure is available. > > That's a good idea. > Here's one way... (typed into gmail, so probably broken) > > LF=' > ' > mergetools= > difftools= > scriptlets="$(git --exec-path)"/mergetools > > for script in "$scriptlets"/* > do > tool="$(basename "$script")" > if test "$tool" = "defaults" > then > continue > fi > . "$scriptlets"/defaults > can_diff && difftools="$difftools$tool$LF" > can_merge && mergetools="$mergetools$tool$LF" > done
I don't think this will work since the names of the valid tools are not necessarily the same as the names of the scriptlets - this is the exact issue that prompted my patches to git-difftool yesterday.
The best option I can see given what's currently available is something like this:
-- >8 --
sed -n -e '/^list_merge_tool_candidates/,/^}/ {
/tools=/ {
s/.*tools=//
s/"//g
s/\$tools//
s/ /\n/g
p
}
}' git-mergetool--lib.sh |sort |uniq |while read -r tool
do
test -z "$tool" && continue
( . git-mergetool--lib && setup_tool $tool
# Use can_diff and can_merge here.
)
done-- 8< --
John