From 130e475e1f8aa72e48dde43159a28232ff31fee6 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 7 Mar 2015 21:04:09 -0800 Subject: git-instaweb: allow running in a working tree subdirectory Signed-off-by: Kyle J. McKay Signed-off-by: Junio C Hamano --- git-instaweb.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git-instaweb.sh b/git-instaweb.sh index 513efa662..4c0af04fe 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -20,6 +20,7 @@ start start the web server restart restart the web server " +SUBDIRECTORY_OK=Yes . git-sh-setup fqgitdir="$GIT_DIR" -- cgit v1.2.1 From ff7a9dc2c503360190650d604dbdbc293d99b765 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 7 Mar 2015 21:05:38 -0800 Subject: git-instaweb: use @SHELL_PATH@ instead of /bin/sh If the user has configured a value for SHELL_PATH then be sure to use it for any generated scripts instead of hard-coding /bin/sh. The first line of the script is handled specially, but the embedded #!/bin/sh line in the here document will not be automatically updated unless it uses @SHELL_PATH@. Signed-off-by: Kyle J. McKay Signed-off-by: Junio C Hamano --- git-instaweb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-instaweb.sh b/git-instaweb.sh index 4c0af04fe..47e38f34c 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -205,7 +205,7 @@ webrick_conf () { # actual gitweb.cgi using a shell script to force it wrapper="$fqgitdir/gitweb/$httpd/wrapper.sh" cat > "$wrapper" < Date: Sat, 7 Mar 2015 21:07:59 -0800 Subject: git-compat-util.h: move SHELL_PATH default into header If SHELL_PATH is not defined we use "/bin/sh". However, run-command.c is not the only file that needs to use the default value so move it into a common header. Signed-off-by: Kyle J. McKay Signed-off-by: Junio C Hamano --- git-compat-util.h | 4 ++++ run-command.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index 8b72e2a8d..f55234dd2 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -872,4 +872,8 @@ struct tm *git_gmtime_r(const time_t *, struct tm *); #define gmtime_r git_gmtime_r #endif +#ifndef SHELL_PATH +# define SHELL_PATH "/bin/sh" +#endif + #endif diff --git a/run-command.c b/run-command.c index 0b432cc97..3afb124c7 100644 --- a/run-command.c +++ b/run-command.c @@ -4,10 +4,6 @@ #include "sigchain.h" #include "argv-array.h" -#ifndef SHELL_PATH -# define SHELL_PATH "/bin/sh" -#endif - void child_process_init(struct child_process *child) { memset(child, 0, sizeof(*child)); -- cgit v1.2.1 From b680a86a86f44444643b9be5bf4822feda128cd0 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 7 Mar 2015 21:08:00 -0800 Subject: help.c: use SHELL_PATH instead of hard-coded "/bin/sh" If the user has set SHELL_PATH in the Makefile then we should respect that value and use it. Signed-off-by: Kyle J. McKay Signed-off-by: Junio C Hamano --- builtin/help.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/help.c b/builtin/help.c index e78c135e0..7082c23b7 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -171,7 +171,7 @@ static void exec_man_cmd(const char *cmd, const char *page) { struct strbuf shell_cmd = STRBUF_INIT; strbuf_addf(&shell_cmd, "%s %s", cmd, page); - execl("/bin/sh", "sh", "-c", shell_cmd.buf, (char *)NULL); + execl(SHELL_PATH, SHELL_PATH, "-c", shell_cmd.buf, (char *)NULL); warning(_("failed to exec '%s': %s"), cmd, strerror(errno)); } -- cgit v1.2.1 From ce026cc7e2ff729c9809fef860cd696d1f7bb06c Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 8 Mar 2015 08:37:50 -0700 Subject: t5528: do not fail with FreeBSD shell The FreeBSD shell converts this expression: git ${1:+-c push.default="$1"} push to this when "$1" is not empty: git "-c push.default=$1" push which causes git to fail. To avoid this we simply break up the expansion into two parts so that the whitespace which creates two arguments instead of one is outside the ${...} like so: git ${1:+-c} ${1:+push.default="$1"} push This has the desired effect on all platforms allowing the test to pass on FreeBSD. Signed-off-by: Kyle J. McKay Signed-off-by: Junio C Hamano --- t/t5528-push-default.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh index cc7451908..73f4bb634 100755 --- a/t/t5528-push-default.sh +++ b/t/t5528-push-default.sh @@ -26,7 +26,7 @@ check_pushed_commit () { # $2 = expected target branch for the push # $3 = [optional] repo to check for actual output (repo1 by default) test_push_success () { - git ${1:+-c push.default="$1"} push && + git ${1:+-c} ${1:+push.default="$1"} push && check_pushed_commit HEAD "$2" "$3" } @@ -34,7 +34,7 @@ test_push_success () { # check that push fails and does not modify any remote branch test_push_failure () { git --git-dir=repo1 log --no-walk --format='%h %s' --all >expect && - test_must_fail git ${1:+-c push.default="$1"} push && + test_must_fail git ${1:+-c} ${1:+push.default="$1"} push && git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual && test_cmp expect actual } -- cgit v1.2.1