git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git fetch over ssh trouble
@ 2007-01-26  5:08 J. Bruce Fields
  2007-01-26  5:24 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: J. Bruce Fields @ 2007-01-26  5:08 UTC (permalink / raw)
  To: git

Any idea why this is happening?:

bfields@pickle:git$ git fetch linux-nfs
Password:
/usr/local/bin/git-parse-remote: line 145: test: !=: unary operator
expected
Password:
error: no such remote ref CVSROOT=bfields@cvs.citi.umich.edu
error: no such remote ref DBUS_SESSION_BUS_ADDRESS=unix
error: no such remote ref DISPLAY=
error: no such remote ref GTK_RC_FILES=/etc/gtk/gtkrc
error: no such remote ref LONG_USAGE='Usage
error: no such remote ref MATHPATH=
error: no such remote ref PATH=/usr/local/bin
error: no such remote ref SESSION_MANAGER=local/pickle
error: no such remote ref SHELLOPTS=braceexpand
error: no such remote ref XPSERVERLIST='
Fetch failure: ssh://linux-nfs.org/~bfields/exports/git.git
bfields@pickle:git$

--b.

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

* Re: git fetch over ssh trouble
  2007-01-26  5:08 git fetch over ssh trouble J. Bruce Fields
@ 2007-01-26  5:24 ` Junio C Hamano
  2007-01-26  5:34   ` J. Bruce Fields
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-01-26  5:24 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: git

"J. Bruce Fields" <bfields@fieldses.org> writes:

> Any idea why this is happening?:
>
> bfields@pickle:git$ git fetch linux-nfs
> Password:
> /usr/local/bin/git-parse-remote: line 145: test: !=: unary operator
> expected

Ouch.

I wonder what should happen when you do not have anything
defined for "linus-nfs" shorthand.  Should it fetch HEAD?

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 1122c83..12023d2 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -82,6 +82,7 @@ get_remote_default_refs_for_push () {
 # a merge candidate
 expand_refs_wildcard () {
 	first_one=yes
+	test "$#" = 0 && echo empty
 	for ref
 	do
 		lref=${ref#'+'}

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

* Re: git fetch over ssh trouble
  2007-01-26  5:24 ` Junio C Hamano
@ 2007-01-26  5:34   ` J. Bruce Fields
  2007-01-26  6:10     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: J. Bruce Fields @ 2007-01-26  5:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, Jan 25, 2007 at 09:24:42PM -0800, Junio C Hamano wrote:
> "J. Bruce Fields" <bfields@fieldses.org> writes:
> 
> > Any idea why this is happening?:
> >
> > bfields@pickle:git$ git fetch linux-nfs
> > Password:
> > /usr/local/bin/git-parse-remote: line 145: test: !=: unary operator
> > expected
> 
> Ouch.
> 
> I wonder what should happen when you do not have anything
> defined for "linus-nfs" shorthand.

Oops; I didn't notice that!

> Should it fetch HEAD?

In my case I'd want it to either default to what I actually wanted
(+refs/heads/*:refs/remotes/linux-nfs/*), or just fail with something
helpful:

	"Nothing to fetch"?
	"No refspec given, and no default fetch configured for linux-nfs"?
	"What do you want me to fetch?"?

I don't know.

> 
> diff --git a/git-parse-remote.sh b/git-parse-remote.sh
> index 1122c83..12023d2 100755
> --- a/git-parse-remote.sh
> +++ b/git-parse-remote.sh
> @@ -82,6 +82,7 @@ get_remote_default_refs_for_push () {
>  # a merge candidate
>  expand_refs_wildcard () {
>  	first_one=yes
> +	test "$#" = 0 && echo empty
>  	for ref
>  	do
>  		lref=${ref#'+'}
> 

Yep, now it does nothing much more quietly....

--b.

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

* Re: git fetch over ssh trouble
  2007-01-26  5:34   ` J. Bruce Fields
@ 2007-01-26  6:10     ` Junio C Hamano
  2007-01-26 14:23       ` J. Bruce Fields
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-01-26  6:10 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: git

"J. Bruce Fields" <bfields@fieldses.org> writes:

>> I wonder what should happen when you do not have anything
>> defined for "linus-nfs" shorthand.
>
> Oops; I didn't notice that!
>
>> Should it fetch HEAD?
>
> In my case I'd want it to either default to what I actually wanted
> (+refs/heads/*:refs/remotes/linux-nfs/*), or just fail with something
> helpful:
>
> 	"Nothing to fetch"?
> 	"No refspec given, and no default fetch configured for linux-nfs"?
> 	"What do you want me to fetch?"?
>
> I don't know.

Saying "let's grab everything" is certainly tempting, but I
think it is a bit too much.  How about doing this instead, then?

-- >8 --
[PATCH] parse-remote: do not barf on a remote shorthand without any refs to fetch.

Signed-off-by: Junio C Hamano <junkio@cox.net>

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 1122c83..7e87f2e 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -81,7 +81,14 @@ get_remote_default_refs_for_push () {
 # is to help prevent randomly "globbed" ref from being chosen as
 # a merge candidate
 expand_refs_wildcard () {
+	remote="$1"
+	shift
 	first_one=yes
+	if test "$#" = 0
+	then
+		echo empty
+		echo >&2 "Nothing specified for fetching with remote.$remote.fetch"
+	fi
 	for ref
 	do
 		lref=${ref#'+'}
@@ -132,7 +139,7 @@ canon_refs_list_for_fetch () {
 	if test "$1" = "-d"
 	then
 		shift ; remote="$1" ; shift
-		set $(expand_refs_wildcard "$@")
+		set $(expand_refs_wildcard "$remote" "$@")
 		is_explicit="$1"
 		shift
 		if test "$remote" = "$(get_default_remote)"

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

* Re: git fetch over ssh trouble
  2007-01-26  6:10     ` Junio C Hamano
@ 2007-01-26 14:23       ` J. Bruce Fields
  0 siblings, 0 replies; 5+ messages in thread
From: J. Bruce Fields @ 2007-01-26 14:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, Jan 25, 2007 at 10:10:34PM -0800, Junio C Hamano wrote:
> "J. Bruce Fields" <bfields@fieldses.org> writes:
> 
> >> I wonder what should happen when you do not have anything
> >> defined for "linus-nfs" shorthand.
> >
> > Oops; I didn't notice that!
> >
> >> Should it fetch HEAD?
> >
> > In my case I'd want it to either default to what I actually wanted
> > (+refs/heads/*:refs/remotes/linux-nfs/*), or just fail with something
> > helpful:
> >
> > 	"Nothing to fetch"?
> > 	"No refspec given, and no default fetch configured for linux-nfs"?
> > 	"What do you want me to fetch?"?
> >
> > I don't know.
> 
> Saying "let's grab everything" is certainly tempting, but I
> think it is a bit too much.

Yeah.

> How about doing this instead, then?

Works for me, thanks!

bfields@pickle:git$ git fetch linux-nfs
Password:
Nothing specified for fetching with remote.linux-nfs.fetch
Password:

Oh, OK, the password requests are a little excessive.  I should go
generate an ssh key.

--b.

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

end of thread, other threads:[~2007-01-26 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26  5:08 git fetch over ssh trouble J. Bruce Fields
2007-01-26  5:24 ` Junio C Hamano
2007-01-26  5:34   ` J. Bruce Fields
2007-01-26  6:10     ` Junio C Hamano
2007-01-26 14:23       ` J. Bruce Fields

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