зеркало из https://github.com/microsoft/git.git
clone/sha1_file: read info/alternates with strbuf_getline()
$GIT_OBJECT_DIRECTORY/info/alternates is a text file that can be edited with a DOS editor. We do not want to use the real path with CR appended at the end. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
18814d0e2d
Коммит
3f16396228
|
@ -339,7 +339,7 @@ static void copy_alternates(struct strbuf *src, struct strbuf *dst,
|
|||
FILE *in = fopen(src->buf, "r");
|
||||
struct strbuf line = STRBUF_INIT;
|
||||
|
||||
while (strbuf_getline_lf(&line, in) != EOF) {
|
||||
while (strbuf_getline(&line, in) != EOF) {
|
||||
char *abs_path;
|
||||
if (!line.len || line.buf[0] == '#')
|
||||
continue;
|
||||
|
|
|
@ -396,7 +396,7 @@ void add_to_alternates_file(const char *reference)
|
|||
struct strbuf line = STRBUF_INIT;
|
||||
int found = 0;
|
||||
|
||||
while (strbuf_getline_lf(&line, in) != EOF) {
|
||||
while (strbuf_getline(&line, in) != EOF) {
|
||||
if (!strcmp(reference, line.buf)) {
|
||||
found = 1;
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче