All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] git-sh-setup: move GIT_DIR initialization into a function
@ 2014-10-11  8:39 David Aguilar
  2014-10-11  8:39 ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help David Aguilar
  0 siblings, 1 reply; 6+ messages in thread
From: David Aguilar @ 2014-10-11  8:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Charles Bailey

Signed-off-by: David Aguilar <davvid@gmail.com>
---
This is a new patch since the last round, prep for 2/3

 git-sh-setup.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 9447980..d968760 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -330,8 +330,7 @@ esac
 
 # Make sure we are in a valid repository of a vintage we understand,
 # if we require to be in a git repository.
-if test -z "$NONGIT_OK"
-then
+git_dir_init () {
 	GIT_DIR=$(git rev-parse --git-dir) || exit
 	if [ -z "$SUBDIRECTORY_OK" ]
 	then
@@ -346,6 +345,11 @@ then
 		exit 1
 	}
 	: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
+}
+
+if test -z "$NONGIT_OK"
+then
+	git_dir_init
 fi
 
 peel_committish () {
-- 
2.1.2.378.g89c0b73

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help
  2014-10-11  8:39 [PATCH v3 1/3] git-sh-setup: move GIT_DIR initialization into a function David Aguilar
@ 2014-10-11  8:39 ` David Aguilar
  2014-10-11  8:39   ` [PATCH v3 3/3] difftool: don't assume that default sh is sane David Aguilar
  2014-10-13 19:16   ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: David Aguilar @ 2014-10-11  8:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Charles Bailey, Charles Bailey

From: Charles Bailey <cbailey32@bloomberg.net>

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Changes since v2:

This now uses the new git_dir_init function.

 git-mergetool.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 96a61ba..cddb533 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -10,11 +10,11 @@
 
 USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...'
 SUBDIRECTORY_OK=Yes
+NONGIT_OK=Yes
 OPTIONS_SPEC=
 TOOL_MODE=merge
 . git-sh-setup
 . git-mergetool--lib
-require_work_tree
 
 # Returns true if the mode reflects a symlink
 is_symlink () {
@@ -378,6 +378,9 @@ prompt_after_failed_merge () {
 	done
 }
 
+require_work_tree
+git_dir_init
+
 if test -z "$merge_tool"
 then
 	# Check if a merge tool has been configured
-- 
2.1.2.378.g89c0b73

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 3/3] difftool: don't assume that default sh is sane
  2014-10-11  8:39 ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help David Aguilar
@ 2014-10-11  8:39   ` David Aguilar
  2014-10-13 19:16   ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: David Aguilar @ 2014-10-11  8:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Charles Bailey, Charles Bailey

From: Charles Bailey <cbailey32@bloomberg.net>

git-difftool used to create a command list script containing $( ... )
and explicitly calls "sh -c" with this list.

Instead, allow mergetool --tool-help to take a mode parameter and call
mergetool directly to invoke the show_tool_help function. This mode
parameter is intented for use solely by difftool.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Helped-by: John Keeping <john@keeping.me.uk>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
No changes since v2.

 git-difftool.perl | 6 +-----
 git-mergetool.sh  | 4 ++++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index 18ca61e..598fcc2 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -47,13 +47,9 @@ sub find_worktree
 
 sub print_tool_help
 {
-	my $cmd = 'TOOL_MODE=diff';
-	$cmd .= ' && . "$(git --exec-path)/git-mergetool--lib"';
-	$cmd .= ' && show_tool_help';
-
 	# See the comment at the bottom of file_diff() for the reason behind
 	# using system() followed by exit() instead of exec().
-	my $rc = system('sh', '-c', $cmd);
+	my $rc = system(qw(git mergetool --tool-help=diff));
 	exit($rc | ($rc >> 8));
 }
 
diff --git a/git-mergetool.sh b/git-mergetool.sh
index cddb533..10782b8 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -327,6 +327,10 @@ guessed_merge_tool=false
 while test $# != 0
 do
 	case "$1" in
+	--tool-help=*)
+		TOOL_MODE=${1#--tool-help=}
+		show_tool_help
+		;;
 	--tool-help)
 		show_tool_help
 		;;
-- 
2.1.2.378.g89c0b73

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help
  2014-10-11  8:39 ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help David Aguilar
  2014-10-11  8:39   ` [PATCH v3 3/3] difftool: don't assume that default sh is sane David Aguilar
@ 2014-10-13 19:16   ` Junio C Hamano
  2014-10-15  6:35     ` David Aguilar
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2014-10-13 19:16 UTC (permalink / raw)
  To: David Aguilar; +Cc: git, Charles Bailey, Charles Bailey

David Aguilar <davvid@gmail.com> writes:

> From: Charles Bailey <cbailey32@bloomberg.net>
>
> Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> Changes since v2:
>
> This now uses the new git_dir_init function.
>
>  git-mergetool.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index 96a61ba..cddb533 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -10,11 +10,11 @@
>  
>  USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...'
>  SUBDIRECTORY_OK=Yes
> +NONGIT_OK=Yes
>  OPTIONS_SPEC=
>  TOOL_MODE=merge
>  . git-sh-setup
>  . git-mergetool--lib
> -require_work_tree
>  
>  # Returns true if the mode reflects a symlink
>  is_symlink () {
> @@ -378,6 +378,9 @@ prompt_after_failed_merge () {
>  	done
>  }
>  
> +require_work_tree
> +git_dir_init

This is somewhat curious.  Shouldn't the order of these swapped?

> +
>  if test -z "$merge_tool"
>  then
>  	# Check if a merge tool has been configured

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help
  2014-10-13 19:16   ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help Junio C Hamano
@ 2014-10-15  6:35     ` David Aguilar
  2014-10-15  6:48       ` David Aguilar
  0 siblings, 1 reply; 6+ messages in thread
From: David Aguilar @ 2014-10-15  6:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Charles Bailey, Charles Bailey

On Mon, Oct 13, 2014 at 12:16:55PM -0700, Junio C Hamano wrote:
> David Aguilar <davvid@gmail.com> writes:
> 
> > From: Charles Bailey <cbailey32@bloomberg.net>
> >
> > Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
> > Signed-off-by: David Aguilar <davvid@gmail.com>
> > ---
> > Changes since v2:
> >
> > This now uses the new git_dir_init function.
> >
> >  git-mergetool.sh | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/git-mergetool.sh b/git-mergetool.sh
> > index 96a61ba..cddb533 100755
> > --- a/git-mergetool.sh
> > +++ b/git-mergetool.sh
> > @@ -10,11 +10,11 @@
> >  
> >  USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...'
> >  SUBDIRECTORY_OK=Yes
> > +NONGIT_OK=Yes
> >  OPTIONS_SPEC=
> >  TOOL_MODE=merge
> >  . git-sh-setup
> >  . git-mergetool--lib
> > -require_work_tree
> >  
> >  # Returns true if the mode reflects a symlink
> >  is_symlink () {
> > @@ -378,6 +378,9 @@ prompt_after_failed_merge () {
> >  	done
> >  }
> >  
> > +require_work_tree
> > +git_dir_init
> 
> This is somewhat curious.  Shouldn't the order of these swapped?

Yes.  I'll send a replacement patch for 2/3 only.
-- 
David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help
  2014-10-15  6:35     ` David Aguilar
@ 2014-10-15  6:48       ` David Aguilar
  0 siblings, 0 replies; 6+ messages in thread
From: David Aguilar @ 2014-10-15  6:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Charles Bailey, Charles Bailey

On Tue, Oct 14, 2014 at 11:35:11PM -0700, David Aguilar wrote:
> On Mon, Oct 13, 2014 at 12:16:55PM -0700, Junio C Hamano wrote:
> > David Aguilar <davvid@gmail.com> writes:
> > 
> > > From: Charles Bailey <cbailey32@bloomberg.net>
> > >
> > > Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
> > > Signed-off-by: David Aguilar <davvid@gmail.com>
> > > ---
> > > Changes since v2:
> > >
> > > This now uses the new git_dir_init function.
> > >
> > >  git-mergetool.sh | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/git-mergetool.sh b/git-mergetool.sh
> > > index 96a61ba..cddb533 100755
> > > --- a/git-mergetool.sh
> > > +++ b/git-mergetool.sh
> > > @@ -10,11 +10,11 @@
> > >  
> > >  USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...'
> > >  SUBDIRECTORY_OK=Yes
> > > +NONGIT_OK=Yes
> > >  OPTIONS_SPEC=
> > >  TOOL_MODE=merge
> > >  . git-sh-setup
> > >  . git-mergetool--lib
> > > -require_work_tree
> > >  
> > >  # Returns true if the mode reflects a symlink
> > >  is_symlink () {
> > > @@ -378,6 +378,9 @@ prompt_after_failed_merge () {
> > >  	done
> > >  }
> > >  
> > > +require_work_tree
> > > +git_dir_init
> > 
> > This is somewhat curious.  Shouldn't the order of these swapped?
> 
> Yes.  I'll send a replacement patch for 2/3 only.

Nevermind, I noticed you already fixed this up in pu.

Thank you,
-- 
David

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-10-15  6:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-11  8:39 [PATCH v3 1/3] git-sh-setup: move GIT_DIR initialization into a function David Aguilar
2014-10-11  8:39 ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help David Aguilar
2014-10-11  8:39   ` [PATCH v3 3/3] difftool: don't assume that default sh is sane David Aguilar
2014-10-13 19:16   ` [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help Junio C Hamano
2014-10-15  6:35     ` David Aguilar
2014-10-15  6:48       ` David Aguilar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.