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

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

From
HWHui Wang <jason77.wang@gmail.com>
Date
Aug 22, 2011, 09:05 UTC
Message-ID
<1314003957-9455-1-git-send-email-jason77.wang@gmail.com>
Hi Junio,

In the V2 version, i use strbuf_xxxx() to help to parse alternates file and change relative paths to absolute paths according to your suggestion, now the strbuf operations are safer.

When updating new content to the lockfile, i choose to write whole content at one time instead of update it line by line. The reason is:

1. we will conditionally update the lockfile, if original alternates doesn't
include relative path, we don't need to update the lockfile. This logic can't
easily be handled line by line.
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, we need to add a similar function to empty and write to
lockfile, and we must guarantee the first line update will call this function,
then remaining update line call add_to_alternates_file(), this logic is a
little complicated comparing to update whole content at one time.
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.

If we choose update lockfile at one time, we can add a new function to implement this requirement and overcome all above complexity.

Hui Wang (1):
      clone: replace relative paths in the alternates
 builtin/clone.c |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 cache.h         |    1 +
 sha1_file.c     |   11 +++++++++++
Next: Hui Wang
Message 1 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.