Merge branch 'fixes'
This commit is contained in:
@ -658,7 +658,7 @@ static int fetch_indices(struct alt_base *repo)
|
|||||||
switch (data[i]) {
|
switch (data[i]) {
|
||||||
case 'P':
|
case 'P':
|
||||||
i++;
|
i++;
|
||||||
if (i + 52 < buffer.posn &&
|
if (i + 52 <= buffer.posn &&
|
||||||
!strncmp(data + i, " pack-", 6) &&
|
!strncmp(data + i, " pack-", 6) &&
|
||||||
!strncmp(data + i + 46, ".pack\n", 6)) {
|
!strncmp(data + i + 46, ".pack\n", 6)) {
|
||||||
get_sha1_hex(data + i + 6, sha1);
|
get_sha1_hex(data + i + 6, sha1);
|
||||||
@ -667,7 +667,7 @@ static int fetch_indices(struct alt_base *repo)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
while (data[i] != '\n')
|
while (i < buffer.posn && data[i] != '\n')
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -440,7 +440,7 @@ int main(int argc, char **argv)
|
|||||||
if (len < 5 || strcmp(pack_name + len - 5, ".pack"))
|
if (len < 5 || strcmp(pack_name + len - 5, ".pack"))
|
||||||
die("packfile name '%s' does not end with '.pack'",
|
die("packfile name '%s' does not end with '.pack'",
|
||||||
pack_name);
|
pack_name);
|
||||||
index_name_buf = xmalloc(len - 1);
|
index_name_buf = xmalloc(len);
|
||||||
memcpy(index_name_buf, pack_name, len - 5);
|
memcpy(index_name_buf, pack_name, len - 5);
|
||||||
strcpy(index_name_buf + len - 5, ".idx");
|
strcpy(index_name_buf + len - 5, ".idx");
|
||||||
index_name = index_name_buf;
|
index_name = index_name_buf;
|
||||||
|
6
quote.c
6
quote.c
@ -126,8 +126,10 @@ static int quote_c_style_counted(const char *name, int namelen,
|
|||||||
|
|
||||||
if (!no_dq)
|
if (!no_dq)
|
||||||
EMIT('"');
|
EMIT('"');
|
||||||
for (sp = name; (ch = *sp++) && (sp - name) <= namelen; ) {
|
for (sp = name; sp < name + namelen; sp++) {
|
||||||
|
ch = *sp;
|
||||||
|
if (!ch)
|
||||||
|
break;
|
||||||
if ((ch < ' ') || (ch == '"') || (ch == '\\') ||
|
if ((ch < ' ') || (ch == '"') || (ch == '\\') ||
|
||||||
(ch == 0177)) {
|
(ch == 0177)) {
|
||||||
needquote = 1;
|
needquote = 1;
|
||||||
|
@ -272,7 +272,7 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
|
|||||||
packet_flush(out);
|
packet_flush(out);
|
||||||
if (new_refs)
|
if (new_refs)
|
||||||
pack_objects(out, remote_refs);
|
pack_objects(out, remote_refs);
|
||||||
else
|
else if (ret == 0)
|
||||||
fprintf(stderr, "Everything up-to-date\n");
|
fprintf(stderr, "Everything up-to-date\n");
|
||||||
close(out);
|
close(out);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -99,7 +99,10 @@ static int read_pack_info_file(const char *infofile)
|
|||||||
while (fgets(line, sizeof(line), fp)) {
|
while (fgets(line, sizeof(line), fp)) {
|
||||||
int len = strlen(line);
|
int len = strlen(line);
|
||||||
if (line[len-1] == '\n')
|
if (line[len-1] == '\n')
|
||||||
line[len-1] = 0;
|
line[--len] = 0;
|
||||||
|
|
||||||
|
if (!len)
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (line[0]) {
|
switch (line[0]) {
|
||||||
case 'P': /* P name */
|
case 'P': /* P name */
|
||||||
@ -200,6 +203,7 @@ static void write_pack_info_file(FILE *fp)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < num_pack; i++)
|
for (i = 0; i < num_pack; i++)
|
||||||
fprintf(fp, "P %s\n", info[i]->p->pack_name + objdirlen + 6);
|
fprintf(fp, "P %s\n", info[i]->p->pack_name + objdirlen + 6);
|
||||||
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_info_packs(int force)
|
static int update_info_packs(int force)
|
||||||
|
Reference in New Issue
Block a user