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

Re: [PATCH] builtin/clone: teach git-clone(1) the --ref= argument

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 27, 2024, 19:29 UTC
Message-ID
<ZvcHpd26te8TPacz@tapette.crustytoothpaste.net>
In-Reply-To
<xmqqikuggaz5.fsf@gitster.g>
On 2024-09-27 at 19:20:14, Junio C Hamano wrote:
Show 17 quoted lines
> Toon Claes <toon@iotcl.com> writes:
> 
> > It's pretty similar to --branch and
> > while --branch takes a branch name or tag name, it doesn't take a fully
> > qualified reference. This allows the user to clone a reference that
> > doesn't start with refs/heads or refs/tags. This can be useful when the
> > server uses custom references.
> 
> "when the server uses custom references" is a rather weak
> explanation.
> 
> The answer to "Doctor, it hurts when I turn my elbow in this
> unnatural direction" is usually "Well, do not do it then".  The
> answer to "Doctor, I cannot use the --branch option because I use
> non branches to keep track of some histories" should be the same.
> Why do you want to turn your elbow in an unnatural angle in the
> first place?

I can't speak for what Toon intended here, but GitHub uses some references under `refs/pull` that are used for tracking pull requests. We even have some in the Git repository on GitHub:

  % git ls-remote upstream refs/pull/* | head -n 5
  f0d0fd3a5985d5e588da1e1d11c85fba0ae132f8        refs/pull/10/head
  c8198f6c2c9fc529b25988dfaf5865bae5320cb5        refs/pull/10/merge
  d604669e32e847c2ba5010c89895dd707ba45f55        refs/pull/100/head
  55ab0c9399879683b4cc6e1baea5dc41484ca52f        refs/pull/100/merge
  08d39e0bb5b9dbd16e9e4c2250e75848718c453b        refs/pull/1000/head

These are not kept under `refs/heads` because `refs/heads` belongs to the user, but it is generally useful to check them out in case of very large changes or changes with complex binary files which don't render well in the web interface (among other reasons) that might need to be inspected for code review. So I think this is a generally useful feature, although I agree that perhaps the commit message might explain the benefits in a more concrete way for those who don't already understand the utility of the feature (such as our illustrious maintainer).

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “builtin/clone: teach git-clone(1) the --ref= argument”
  1. builtin/clone: teach git-clone(1) the --ref= argumentToon Claes, Sep 27, 2024
  2. Junio C HamanoSep 27, 2024
  3. brian m. carlsonSep 27, 2024
  4. Junio C HamanoSep 27, 2024
  5. Kristoffer HaugsbakkSep 27, 2024

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.