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

Re: [PATCH v2] clone: Allow combining --bare and --origin

From
RNRoman Neuhauser <rn+git@sigpipe.cz>
Date
Aug 6, 2021, 20:23 UTC
Message-ID
<YQ2aXpfzyOOUFhQk@isis.sigpipe.cz>
In-Reply-To
<xmqqbl6dqgvc.fsf@gitster.g>
Hello,

i'm "the user" in this story. Muchas gracias to osse for turning my bickering into a patch.

A little background. I use --origin a lot (or git remmote rename afterwards), because origin carries no information about the remote repository, and I could have cloned any of those. The URL I used in `git clone` has little to do with which remotes I'll want to pull from and which I'll want to push to. "origin" is suspicious and I'm used to giving my remotes names that mean something to me.

My need for git clone --bare --origin surfaced when I was writing a tool for versioning dotfiles (don't we all have one). It has to be able to work with pre-existing files in the home dir:

$ git dirs clone $url x # git-dir is $PWD/.git-dirs/repo.d/x # work-tree is $PWD

I used git clone --bare / git config core.bare false / git config core.worktree ... and hit the error message when I tried to add support for --origin.

# gitster@pobox.com / 2021-08-04 10:06:31 -0700:
> In other words, if there were two remotes in the configuration file,
> you cannot tell which one was given to --origin when you made the
> repository with "git clone".
I'm not sure why this matters (not saying it doesn't).
 
Show 7 quoted lines
> But we'd end up treating them the same.  And something like
> remote.originName would help that.  Otherwise, we'd end up sending
> this message:
> 
>     Even if we give "--bare --origin yourfavouritename" to you now,
>     unlike how 'origin' is treated in the default case, in the
>     resulting repository, 'yourfavouritename' is not special at all.
Isn't that the case in non-bare repositories as well?
BTW I don't like special cases but realize that the "origin" ship has
sailed long ago.
 
> Some people may want to treat yourfavouritename is not special at
> all, while some people may want to treat yourfavouritename truly as
> a replacement for 'origin' that is the default.  The message we
> would be sending is that we'd ignore the latter folks.
 
Can't they just continue doing what they've been doing so far,
that is leave it at "origin"?  I'm not sure this would be my concern
as a user of this feature.
-- 
roman
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 13 in “clone: Remove constraint on --bare and --origin”
  1. clone: Remove constraint on --bare and --originØystein Walle, Aug 1, 2021
  2. Junio C HamanoAug 2, 2021
  3. Ævar Arnfjörð BjarmasonAug 2, 2021
  4. clone: Allow combining --bare and --originØystein Walle, Aug 2, 2021
  5. Junio C HamanoAug 3, 2021
  6. Øystein WalleAug 4, 2021
  7. Junio C HamanoAug 4, 2021
  8. Roman NeuhauserAug 6, 2021
  9. Junio C HamanoAug 6, 2021
  10. Roman NeuhauserAug 7, 2021
  11. Re* [PATCH v2] clone: Allow combining --bare and --originJunio C Hamano, Aug 7, 2021
  12. Roman NeuhauserAug 8, 2021
  13. Junio C HamanoAug 4, 2021

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.