git-2.22.0/server-info.c
/* Returns non-zero when we detect that the info in the
 * old file is useless.
 */
Returns non-zero when we detect that the info in the
old file is useless.
Returns non - zero when we detect that the info in the old file is useless .
static int read_pack_info_file(const char *infofile)
{
	FILE *fp;
	struct strbuf line = STRBUF_INIT;
	int old_cnt = 0;
	int stale = 1;
	fp = fopen_or_warn(infofile, "r");
	if (!fp)
		return 1; 
	while (strbuf_getline(&line, fp) != EOF) {
		const char *arg;
		if (!line.len)
			continue;
		if (skip_prefix(line.buf, "P ", &arg)) {
			if (parse_pack_def(arg, old_cnt++))
				goto out_stale;
		} else if (line.buf[0] == 'D') {
			goto out_stale;
		} else if (line.buf[0] == 'T') {
			goto out_stale;
		} else {
			error("unrecognized: %s", line.buf);
		}
	}
	stale = 0;
 out_stale:
	strbuf_release(&line);
	fclose(fp);
	return stale;
}
static int read_pack_info_file ( const char * infofile ) { FILE * fp ; struct strbuf line = STRBUF_INIT ; int old_cnt = 0 ; int stale = 1 ; fp = fopen_or_warn ( infofile , " " ) ; if ( ! fp ) return 1 ; while ( strbuf_getline ( & line , fp ) != EOF ) { const char * arg ; if ( ! line . len ) continue ; if ( skip_prefix ( line . buf , " " , & arg ) ) { if ( parse_pack_def ( arg , old_cnt ++ ) ) goto out_stale ; } else if ( line . buf [ 0 ] == ' ' ) { goto out_stale ; } else if ( line . buf [ 0 ] == ' ' ) { goto out_stale ; } else { error ( " " , line . buf ) ; } } stale = 0 ; out_stale : strbuf_release ( & line ) ; fclose ( fp ) ; return stale ; }
Returns non-zero when we detect that the info in the
 old file is useless.
Returns non - zero when we detect that the info in the old file is useless .
/* nonexistent is not an error. */ /* P name */ /* we used to emit D but that was misguided. */ /* we used to emit T but nobody uses it. */