git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-sh-setup.sh: use dashdash with basename call
@ 2014-11-24 23:03 Dan Wyand
  2014-11-25  0:28 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Wyand @ 2014-11-24 23:03 UTC (permalink / raw)
  To: git; +Cc: Dan Wyand

Calling basename on a argument that starts with a dash, like a login shell,
will result in an error. This patch adds '--' before the argument so that the
argument is interpreted properly.
---
 git-sh-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 9447980..5cdae33 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -81,7 +81,7 @@ if test -n "$OPTIONS_SPEC"; then
 		echo exit $?
 	)"
 else
-	dashless=$(basename "$0" | sed -e 's/-/ /')
+	dashless=$(basename -- "$0" | sed -e 's/-/ /')
 	usage() {
 		die "usage: $dashless $USAGE"
 	}
-- 
2.1.3

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

* [PATCH] git-sh-setup.sh: use dashdash with basename call
@ 2014-11-24 23:20 Dan Wyand
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Wyand @ 2014-11-24 23:20 UTC (permalink / raw)
  To: git; +Cc: Dan Wyand

Calling basename on a argument that starts with a dash, like a login shell,
will result in an error. This patch adds '--' before the argument so that the
argument is interpreted properly.

Signed-off-by: Dan Wyand <danwyand@gmail.com>
---
 git-sh-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 9447980..5cdae33 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -81,7 +81,7 @@ if test -n "$OPTIONS_SPEC"; then
 		echo exit $?
 	)"
 else
-	dashless=$(basename "$0" | sed -e 's/-/ /')
+	dashless=$(basename -- "$0" | sed -e 's/-/ /')
 	usage() {
 		die "usage: $dashless $USAGE"
 	}
-- 
2.1.3

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

* Re: [PATCH] git-sh-setup.sh: use dashdash with basename call
  2014-11-24 23:03 Dan Wyand
@ 2014-11-25  0:28 ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2014-11-25  0:28 UTC (permalink / raw)
  To: Dan Wyand; +Cc: git

Dan Wyand <danwyand@gmail.com> writes:

> Calling basename on a argument that starts with a dash, like a login shell,
> will result in an error. This patch adds '--' before the argument so that the
> argument is interpreted properly.
> ---

Makes sense.

Please sign-off your patch (see Documentation/SubmittingPatches).

>  git-sh-setup.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-sh-setup.sh b/git-sh-setup.sh
> index 9447980..5cdae33 100644
> --- a/git-sh-setup.sh
> +++ b/git-sh-setup.sh
> @@ -81,7 +81,7 @@ if test -n "$OPTIONS_SPEC"; then
>  		echo exit $?
>  	)"
>  else
> -	dashless=$(basename "$0" | sed -e 's/-/ /')
> +	dashless=$(basename -- "$0" | sed -e 's/-/ /')
>  	usage() {
>  		die "usage: $dashless $USAGE"
>  	}

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

end of thread, other threads:[~2014-11-25  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-24 23:20 [PATCH] git-sh-setup.sh: use dashdash with basename call Dan Wyand
  -- strict thread matches above, loose matches on Subject: below --
2014-11-24 23:03 Dan Wyand
2014-11-25  0:28 ` Junio C Hamano

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).