Skip to content

Commit

Permalink
Fix up progress report for off-by-one error
Browse files Browse the repository at this point in the history
We used to print the index of the object we unpacked, not how many we
had unpacked.  Which caused slightly confusing progress reports like

	100% (2/3) done

rather than the more obvious "3/3" for 100% ;)
  • Loading branch information
Linus Torvalds committed Jul 10, 2005
1 parent 4bc5fbf commit cf21919
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions unpack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static void unpack_one(unsigned nr, unsigned total)
static unsigned long last_sec;
static unsigned last_percent;
struct timeval now;
unsigned percentage = ((1+nr) * 100) / total;
unsigned percentage = (nr * 100) / total;

gettimeofday(&now, NULL);
if (percentage != last_percent || now.tv_sec != last_sec) {
Expand Down Expand Up @@ -255,7 +255,7 @@ static void unpack_all(void)

use(sizeof(struct pack_header));
for (i = 0; i < nr_objects; i++)
unpack_one(i, nr_objects);
unpack_one(i+1, nr_objects);
if (delta_list)
die("unresolved deltas left after unpacking");
}
Expand Down

0 comments on commit cf21919

Please sign in to comment.