Skip to content

Commit f9a8672

Browse files
jonathantanmygitster
authored andcommitted
pack: move has_pack_index()
Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 150e300 commit f9a8672

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

cache.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,8 +1226,6 @@ extern int has_object_file_with_flags(const struct object_id *oid, int flags);
12261226
*/
12271227
extern int has_loose_object_nonlocal(const unsigned char *sha1);
12281228

1229-
extern int has_pack_index(const unsigned char *sha1);
1230-
12311229
extern void assert_sha1_type(const unsigned char *sha1, enum object_type expect);
12321230

12331231
/* Helper to check and "touch" a file */

packfile.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,3 +1846,11 @@ int has_sha1_pack(const unsigned char *sha1)
18461846
struct pack_entry e;
18471847
return find_pack_entry(sha1, &e);
18481848
}
1849+
1850+
int has_pack_index(const unsigned char *sha1)
1851+
{
1852+
struct stat st;
1853+
if (stat(sha1_pack_index_name(sha1), &st))
1854+
return 0;
1855+
return 1;
1856+
}

packfile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,6 @@ extern int find_pack_entry(const unsigned char *sha1, struct pack_entry *e);
122122

123123
extern int has_sha1_pack(const unsigned char *sha1);
124124

125+
extern int has_pack_index(const unsigned char *sha1);
126+
125127
#endif

sha1_file.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,14 +1623,6 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
16231623
return ret;
16241624
}
16251625

1626-
int has_pack_index(const unsigned char *sha1)
1627-
{
1628-
struct stat st;
1629-
if (stat(sha1_pack_index_name(sha1), &st))
1630-
return 0;
1631-
return 1;
1632-
}
1633-
16341626
int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
16351627
{
16361628
if (!startup_info->have_repository)

0 commit comments

Comments
 (0)