Hui Wang <jason77.wang@xxxxxxxxx> 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html