git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make git-clone obey "--" (end argument parsing)
@ 2007-11-01 19:54 Heikki Orsila
  2007-11-01 20:39 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Heikki Orsila @ 2007-11-01 19:54 UTC (permalink / raw)
  To: git

Oops. Reposting the patch.

This patch handles "--" argument for git-clone.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>

>From bd2d661c565062eacc80dda90f3978303308f9bb Mon Sep 17 00:00:00 2001
From: Heikki Orsila <heikki.orsila@iki.fi>
Date: Thu, 1 Nov 2007 16:21:39 +0200
Subject: [PATCH] Make git-clone obey "--" (end argument parsing)

---
 Documentation/git-clone.txt |    2 +-
 git-clone.sh                |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 253f4f0..7fdcd42 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 'git-clone' [--template=<template_directory>]
 	  [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare]
 	  [-o <name>] [-u <upload-pack>] [--reference <repository>]
-	  [--depth <depth>] <repository> [<directory>]
+	  [--depth <depth>] [--] <repository> [<directory>]
 
 DESCRIPTION
 -----------
diff --git a/git-clone.sh b/git-clone.sh
index 0ea3c24..3f00693 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -14,7 +14,7 @@ die() {
 }
 
 usage() {
-	die "Usage: $0 [--template=<template_directory>] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [--depth <n>] [-n] <repo> [<dir>]"
+	die "Usage: $0 [--template=<template_directory>] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [--depth <n>] [-n] [--] <repo> [<dir>]"
 }
 
 get_repo_base() {
@@ -160,6 +160,9 @@ while
 	*,--depth)
 		shift
 		depth="--depth=$1";;
+	*,--)
+		shift
+		break ;;
 	*,-*) usage ;;
 	*) break ;;
 	esac
-- 
1.5.3.4.498.g9c514-dirty

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

* Re: [PATCH] Make git-clone obey "--" (end argument parsing)
  2007-11-01 19:54 Heikki Orsila
@ 2007-11-01 20:39 ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-11-01 20:39 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git

shd@jolt.modeemi.cs.tut.fi (Heikki Orsila) writes:

> Oops. Reposting the patch.
>
> This patch handles "--" argument for git-clone.
>
> Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
>
>>From bd2d661c565062eacc80dda90f3978303308f9bb Mon Sep 17 00:00:00 2001
> From: Heikki Orsila <heikki.orsila@iki.fi>
> Date: Thu, 1 Nov 2007 16:21:39 +0200
> Subject: [PATCH] Make git-clone obey "--" (end argument parsing)
>
> ---
>  Documentation/git-clone.txt |    2 +-
>  git-clone.sh                |    5 ++++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
> index 253f4f0..7fdcd42 100644
> --- a/Documentation/git-clone.txt
> +++ b/Documentation/git-clone.txt
> @@ -12,7 +12,7 @@ SYNOPSIS
>  'git-clone' [--template=<template_directory>]
>  	  [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare]
>  	  [-o <name>] [-u <upload-pack>] [--reference <repository>]
> -	  [--depth <depth>] <repository> [<directory>]
> +	  [--depth <depth>] [--] <repository> [<directory>]

I do not think this breaks anything, but does it _help_
anything in practice?

What kind of breakage does this patch fix?

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

* Re: [PATCH] Make git-clone obey "--" (end argument parsing)
@ 2007-11-02 14:21 Heikki Orsila
  2007-11-02 21:32 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Heikki Orsila @ 2007-11-02 14:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> I do not think this breaks anything, but does it _help_
> anything in practice?
> 
> What kind of breakage does this patch fix?

It doesn't fix anything, but it is a good usability standard to obey --.
I was creating a script that would _automatically_ clone repositories of 
other users. As a little bit pedantic shell script writer I added "--" 
and noticed that git clone doesn't handle that, although it's expected 
behavior from many tools.

-- 
Heikki Orsila			Barbie's law:
heikki.orsila@iki.fi		"Math is hard, let's go shopping!"
http://www.iki.fi/shd

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

* Re: [PATCH] Make git-clone obey "--" (end argument parsing)
  2007-11-02 14:21 [PATCH] Make git-clone obey "--" (end argument parsing) Heikki Orsila
@ 2007-11-02 21:32 ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-11-02 21:32 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git

Heikki Orsila <shd@modeemi.fi> writes:

> Junio C Hamano wrote:
>> I do not think this breaks anything, but does it _help_
>> anything in practice?
>> 
>> What kind of breakage does this patch fix?
>
> It doesn't fix anything, but it is a good usability standard to obey --.
> I was creating a script that would _automatically_ clone repositories of 
> other users. As a little bit pedantic shell script writer I added "--" 
> and noticed that git clone doesn't handle that,...

The first real parameter will always be the remote repo
URL^Wlocator, and sane people won't have anything that begin
with a hyphen for that, will they?

So the change is only for consistency's sake.

I am not saying that is a bad thing.  I just wanted to
understand if there was a real breakage there.

Thanks. Will apply.

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

end of thread, other threads:[~2007-11-02 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-02 14:21 [PATCH] Make git-clone obey "--" (end argument parsing) Heikki Orsila
2007-11-02 21:32 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2007-11-01 19:54 Heikki Orsila
2007-11-01 20:39 ` 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).