Skip to content

Commit

Permalink
loose: don't rewrite idx unnecessarily
Browse files Browse the repository at this point in the history
As a minor optimization, don't rewrite the idx when there are no new
entries.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
  • Loading branch information
artagnon committed Aug 28, 2012
1 parent 388227f commit 94f5ac2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions loose.c
Expand Up @@ -43,6 +43,13 @@ void packup_loose_objects(FILE *packfh, const void *idx_data,
off_t this_offset;
int existing_nr;

/* Don't unnecessarily rewrite the index */
if (idx_data && !looseroot.nr) {
PHOENIXFS_DBG("packup_loose_objects:: Not rewriting idx");
return;
}

/* Write packfile and idx */
fseek(packfh, 0L, SEEK_END);
for (i = 0; i < looseroot.nr; i++) {
this_entry = looseroot.entries[i];
Expand Down

0 comments on commit 94f5ac2

Please sign in to comment.