git-sh-setup: move GIT_DIR initialization into a function
PATCH v3 1/3 git-sh-setup: move GIT_DIR initialization into a function
---
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(-)
git-sh-setup.sh +6 -2
@@ -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 () {
Signature · 1 line
2.1.2.378.g89c0b73
PATCH v3 2/3 mergetool: don't require a work tree for --tool-help
From: Charles Bailey <[email protected]>
---
Changes since v2:
This now uses the new git_dir_init function.
git-mergetool.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
git-mergetool.sh +4 -1
@@ -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
Signature · 1 line
2.1.2.378.g89c0b73
PATCH v3 3/3 difftool: don't assume that default sh is sane
From: Charles Bailey <[email protected]>
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.
---
No changes since v2.
git-difftool.perl | 6 +----- git-mergetool.sh | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-)
git-difftool.perl +1 -5
@@ -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)); }
git-mergetool.sh +4 -0
@@ -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 ;;
Signature · 1 line
2.1.2.378.g89c0b73
Re: [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help
In reply to David AguilarQuoted 30 lines · David Aguilar
From: Charles Bailey <[email protected]>
Signed-off-by Charles Bailey <[email protected]>Signed-off-by David Aguilar <[email protected]>---
Changes since v2:This now uses the new
git_dir_initfunction.git-mergetool.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)git-mergetool.sh +1
-1@@ -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 () {
git-mergetool.sh prompt_after_failed_merge () { · line 382
Quoted 5 lines
git-mergetool.sh +2
-0@@ -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?
Quoted 4 lines
git-mergetool.sh +1
-0+ if test -z "$merge_tool" then # Check if a merge tool has been configured
Re: [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help
Quoted 35 lines · Junio C Hamano
Quoted 33 lines · David Aguilar
From: Charles Bailey <[email protected]>
Signed-off-by Charles Bailey <[email protected]>Signed-off-by David Aguilar <[email protected]>---
Changes since v2:This now uses the new
git_dir_initfunction.git-mergetool.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)git-mergetool.sh +1
-1@@ -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 }
Quoted 4 lines
git-mergetool.sh prompt_after_failed_merge () { · line 382
Quoted 2 lines
git-mergetool.sh +2
-0+require_work_tree +git_dir_initThis is somewhat curious. Shouldn't the order of these swapped?
Yes. I'll send a replacement patch for 2/3 only.
Signature · 1 line
David
Re: [PATCH v3 2/3] mergetool: don't require a work tree for --tool-help
Quoted 36 lines · David Aguilar
Quoted 35 lines · Junio C Hamano
Quoted 33 lines · David Aguilar
From: Charles Bailey <[email protected]>
Signed-off-by Charles Bailey <[email protected]>Signed-off-by David Aguilar <[email protected]>---
Changes since v2:This now uses the new
git_dir_initfunction.git-mergetool.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)git-mergetool.sh +1
-1@@ -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 }
Quoted 6 lines
Quoted 4 lines
git-mergetool.sh prompt_after_failed_merge () { · line 382
Quoted 2 lines
git-mergetool.sh +2
-0+require_work_tree +git_dir_initThis 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,
Signature · 1 line
David