From: Sebastian Schuberth <sschuberth@gmail.com>
To: David Aguilar <davvid@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Tim Henigan <tim.henigan@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 2/5] difftool: Eliminate global variables
Date: Mon, 23 Jul 2012 08:13:51 +0200 [thread overview]
Message-ID: <500CEB9F.4030406@gmail.com> (raw)
In-Reply-To: <1343014940-16439-2-git-send-email-davvid@gmail.com>
On 23.07.2012 05:42, David Aguilar wrote:
> Organize the script so that it has a single main() function which
> calls out to dir_diff() and file_diff() functions. This eliminates
> "dir-diff"-specific variables that do not need to be calculated when
> performing a regular file-diff.
Funny, I just have prepared a patch along the same lines so that one can
call git-difftool -h and --tool-help also outside a repository, see
below. Does you patch offer the same? If so, I'll drop mine.
---
git-difftool.perl | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/git-difftool.perl b/git-difftool.perl
index ae1e052..e7b71c9 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -25,8 +25,9 @@ use Git;
my @tools;
my @working_tree;
my $rc;
-my $repo = Git->repository();
-my $repo_path = $repo->repo_path();
+my $repo;
+my $repo_path;
+my $workdir;
sub usage
{
@@ -62,8 +63,6 @@ sub find_worktree
return $worktree;
}
-my $workdir = find_worktree();
-
sub filter_tool_scripts
{
if (-d $_) {
@@ -293,6 +292,11 @@ if (defined($help)) {
if (defined($tool_help)) {
print_tool_help();
}
+
+$repo = Git->repository();
+$repo_path = $repo->repo_path();
+$workdir = find_worktree();
+
if (defined($difftool_cmd)) {
if (length($difftool_cmd) > 0) {
$ENV{GIT_DIFF_TOOL} = $difftool_cmd;
--
1.7.11.msysgit.2
next prev parent reply other threads:[~2012-07-23 6:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-23 3:42 [PATCH 1/5] difftool: Simplify print_tool_help() David Aguilar
2012-07-23 3:42 ` [PATCH 2/5] difftool: Eliminate global variables David Aguilar
2012-07-23 6:13 ` Sebastian Schuberth [this message]
2012-07-23 6:21 ` David Aguilar
2012-07-23 6:30 ` Sebastian Schuberth
2012-07-23 6:44 ` David Aguilar
2012-07-23 6:54 ` Sebastian Schuberth
2012-07-23 3:42 ` [PATCH 3/5] difftool: Move option values into a hash David Aguilar
2012-07-23 3:49 ` David Aguilar
2012-07-23 3:42 ` [PATCH 5/5] difftool: Use symlinks when diffing against the worktree David Aguilar
2012-07-24 12:43 ` [PATCH 1/5] difftool: Simplify print_tool_help() Tim Henigan
2012-07-25 1:52 ` David Aguilar
2012-07-25 2:18 ` David Aguilar
2012-07-25 2:40 ` Junio C Hamano
2012-07-25 3:00 ` David Aguilar
-- strict thread matches above, loose matches on Subject: below --
2012-07-23 3:57 [PATCH v2 0/5] difftool: Use symlinks in dir-diff mode David Aguilar
2012-07-23 3:57 ` [PATCH v2 1/5] difftool: Simplify print_tool_help() David Aguilar
2012-07-23 3:57 ` [PATCH 2/5] difftool: Eliminate global variables 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=500CEB9F.4030406@gmail.com \
--to=sschuberth@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tim.henigan@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).