git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] Move remote parsing into a library file out of builtin-push.

From
Junio C Hamano <junkio@cox.net>
Date
May 10, 2007, 08:43 UTC
Message-ID
<7v3b25kr0t.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0705100421490.18541@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
Show 32 quoted lines
> On Thu, 10 May 2007, Junio C Hamano wrote:
>
>> Daniel Barkalow <barkalow@iabervon.org> writes:
>> 
>> >> And I think it does today.
>> >
>> > Hmm, and I guess URIs on the command line work the same way. How about 
>> > requiring a '/' somewhere in a repository argument in order to treat it as 
>> > a repository instead of a remote name? Then "../next-door-neighbour" would 
>> > work, "./gitcvs.git" would work (in the odd case where you actually have a 
>> > bare repository sitting in your working directory), but we'd avoid the 
>> > current default of pushing to a bare repository in "./origin/" if nothing 
>> > at all is configured.
>> 
>> When I wrote the message you are responding to, I thought this
>> was a regression from the current behaviour, which (IIRC--it's
>> getting late and I am tired to double check) essentially says if
>> the token is a name of the directory, the target repository is a
>> local one, but "we'd avoid..." part seems to suggest that you
>> actually did this deliberately as a fix to some problem in the
>> current behaviour.  I am not however sure what it exactly is.
>> Could you care to elaborate the part after "we'd avoid..." to
>> clarify what the problem is, please?
>
> The problem, in general, is that, if the remote name you specify (or 
> "origin" if you don't specify any) is not configured as a remote, it is 
> treated as a filename in the current directory for a local push. E.g.:
>
> $ git init
> $ git push
> fatal: 'origin': unable to chdir or not a git archive
> fatal: The remote end hung up unexpectedly
Ahh.  You were trying to give it a better error message.

I think I lied in the previous message. I said we try to see if it is a local directory name before using that name, but we do not do it, and leave the error detection to the lower level on the other side (push spawns send-pack which in turn spawns receive-pack) instead.

Perhaps an alternative is to see if the name is configured as a remote (if so, we obviously use it), and if not do stat() to see if it is a directory (if so, use it as a local repository). Then we do not have to impose new restriction of slash at all, although it might complicate the code a bit more.

Previous: Daniel BarkalowNext: Daniel Barkalow
Message 8 of 10 in “Move remote parsing into a library file out of builtin-push.”
  1. 1/3 Move remote parsing into a library file out of builtin-push.Daniel Barkalow, May 10, 2007
  2. Junio C HamanoMay 10, 2007
  3. Daniel BarkalowMay 10, 2007
  4. Junio C HamanoMay 10, 2007
  5. Daniel BarkalowMay 10, 2007
  6. Junio C HamanoMay 10, 2007
  7. Daniel BarkalowMay 10, 2007
  8. Junio C HamanoMay 10, 2007
  9. Daniel BarkalowMay 10, 2007
  10. Junio C HamanoMay 10, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.