git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Schuberth <sschuberth@gmail.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: David Aguilar <davvid@gmail.com>, Phil Susi <phillsusi@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Philip Oakley <philipoakley@iee.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH v2] mergetools: add winmerge as a builtin tool
Date: Wed, 13 May 2015 22:36:15 +0200	[thread overview]
Message-ID: <5553B5BF.7040408@gmail.com> (raw)
In-Reply-To: <5553AD43.9010807@gmail.com>

On 13.05.2015 22:00, Sebastian Schuberth wrote:

> So how about something like this which hopefully covers all cases (including case-sensitivity issues regarding environment variable names and the problem of querying a variable that contains parentheses as part of its name):
> 
> for directory in "$(env | sed -nr 's/^PROGRAM(FILES(\(X86\))?|W6432)=//pI')"
> do
>      test -n "$directory" &&
>      test -x "$directory/$winmerge_exe" &&
>      echo "$directory/$winmerge_exe" &&
>      break
> done
> 
> sed's "I" seems to be a GNU extension that's not available with OS X' BSD sed. This shouldn't be an issue as WinMerge is Windows only anyway. If it still turns out to be an issue we probably should come up with an equivalent Perl expression.

Or even better, as that does not rely on GNU sed, sorts matches so that "C:\Program Files" for sure comes before "C:\Program Files (x86)" and removes any duplicates:

for directory in "$(env | grep -E '^PROGRAM(FILES(\(X86\))?|W6432)=' | cut -d '=' -f 2 | sort -u)"
do
     test -n "$directory" &&
     test -x "$directory/$winmerge_exe" &&
     echo "$directory/$winmerge_exe" &&
     break
done

-- 
Sebastian Schuberth

  reply	other threads:[~2015-05-13 20:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13  2:00 [PATCH v2] mergetools: add winmerge as a builtin tool David Aguilar
2015-05-13  8:10 ` Johannes Schindelin
2015-05-13 13:19 ` Sebastian Schuberth
2015-05-13 15:22   ` Johannes Schindelin
2015-05-13 15:33     ` Sebastian Schuberth
2015-05-13 20:00       ` Sebastian Schuberth
2015-05-13 20:36         ` Sebastian Schuberth [this message]
2015-05-13 20:37           ` Sebastian Schuberth
2015-05-14 21:48             ` SZEDER Gábor
2015-05-15  5:46               ` Sebastian Schuberth
2015-05-15  9:01                 ` SZEDER Gábor
2015-05-14 21:24       ` SZEDER Gábor
2015-05-15  5:40         ` Sebastian Schuberth
2015-05-20  4:10           ` David Aguilar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5553B5BF.7040408@gmail.com \
    --to=sschuberth@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=philipoakley@iee.org \
    --cc=phillsusi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).