git-clone: fix relative path problem in the alternates
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest1 patch 3 repliesIn review
- v11 patch 2 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | clone: replace relative paths in the alternatesbuiltin/ cache.h sha1_file.c | +58 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/1] git-clone: fix relative path problem in the alternates
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 +++++++++++