On Sun, Jul 22, 2012 at 11:13 PM, Sebastian Schuberth <sschuberth@xxxxxxxxx> wrote: > 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. It *should*. I did not consider this case but that is indeed the desired behavior. What my patch did not offer was a test to ensure this behavior... > > --- > 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 -- David -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html