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

Re: [PATCH v2 0/1] git-clone: fix relative path problem in the alternates

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 22, 2011, 19:10 UTC
Message-ID
<7v7h65w9d7.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1314003957-9455-1-git-send-email-jason77.wang@gmail.com>
Hui Wang <jason77.wang@gmail.com> writes:
> 2. current git system only provides add_to_alternates_file()in the sha1_file.c
> to update lockfile, this function can add a line to lockfile but can't empty
> and write lockfile,

I do not see the need for "empty and write" in the first place. You are spending cycles to go through all the lines in the input, inspecting and holding the replacement somewhere, it is a one-time cost for cloning, and the alternates file wouldn't be humongous anyway, so I do not see the need for "we don't touch if there is no relative path in the file" if it makes the code more complex than a stupid "one line at a time" approach.

> 3. current existing add_to_alternates_file() will unconditionally append
> "/objects" at each new added line, that need us to parse and  remove
> "/objects" from each line read out from source alternates, this is a little
> bit complicated.

Clone with --reference is the only other caller of that function; I would say it is perfectly fine to make it the caller's responsibility to append "/objects" if that makes the resulting code easier to maintain.

Previous: Hui WangNext: Junio C Hamano
Message 3 of 10 in “git-clone: fix relative path problem in the alternates”
  1. 0/1 git-clone: fix relative path problem in the alternatesHui Wang, Aug 22, 2011
  2. 1/1 clone: replace relative paths in the alternatesHui Wang, Aug 22, 2011
  3. Junio C HamanoAug 22, 2011
  4. Junio C HamanoAug 22, 2011
  5. Junio C HamanoAug 22, 2011
  6. 0/2 clone-local fixupJunio C Hamano, Aug 23, 2011
  7. 1/2 clone: allow more than one --referenceJunio C Hamano, Aug 23, 2011
  8. 2/2 clone: clone from a repository with relative alternatesJunio C Hamano, Aug 23, 2011
  9. Hui WangAug 23, 2011
  10. Junio C HamanoAug 23, 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.