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

Re: shallow clone not very shallow due to tags

From
Shawn Pearce <spearce@spearce.org>
Date
Aug 17, 2011, 14:19 UTC
Message-ID
<CAJo=hJvySfuWmz6vGUveC5KoR1NZGC4ji0saByVX40UxLqHqdg@mail.gmail.com>
In-Reply-To
<CACsJy8CXiZ8uGruAk5XGFhY8MJsTHAPv3Mvh0euQdFE3U43MCg@mail.gmail.com>
On Tue, Aug 16, 2011 at 19:49, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
Show 13 quoted lines
> On Tue, Aug 16, 2011 at 12:16 AM, Shawn Pearce > Yes, I think a user
> who is making a shallow clone should only get the
>> HEAD branch to the depth specified, nothing else. If they want
>> additional branches, they should either pass them on the command line
>> to a new flag for clone, or modify their fetch configuration
>> after-the-fact and fetch those separately.
>
> I'd like maintain all refs of the repo, even though we though we only
> have objects for one branch. If I do a shallow clone and want to
> change branch, I could just list available branch locally instead of
> going to gitweb.somewhere for the branch name.
>
> Do we have someway to represent a ref placeholder?

Not currently, no. I haven't checked refs.c, but you may be able to create an empty (0 byte) ref file for each remote reference we didn't obtain. These should be ignored since they aren't a valid reference.. Though they might cause warnings to be sent to stderr on every command, since they exist in the refs directory but aren't a valid reference.

Of course a placeholder ref cannot be used as a starting point to checkout something, can it? It has no commit object available. So if you did decide to checkout a placeholder, you would need to first fetch that placeholder. So why not use git ls-remote to list the remotely available branches?

-- 
Shawn.
Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 6 of 7 in “shallow clone not very shallow due to tags”
  1. Shawn PearceAug 14, 2011
  2. Nguyen Thai Ngoc DuyAug 15, 2011
  3. Shawn PearceAug 15, 2011
  4. Philip OakleyAug 15, 2011
  5. Nguyen Thai Ngoc DuyAug 17, 2011
  6. Shawn PearceAug 17, 2011
  7. Nguyen Thai Ngoc DuyAug 17, 2011

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.