hgfs: fix loadrevinfo() for empty log bug
loadrevinfo() would fail on a empty log portion due to a bug in the previous commit. the loop is supposed to skip all bytes until we encounter a empty line. the loop starts at the beginning of a line so when we encounter a \n, we have to terminate, otherwise read bytes until we see \n (end of a line) and then read another and test the condition again.
This commit is contained in:
parent
2f976d8b56
commit
17136370d8
|
@ -45,18 +45,16 @@ loadrevinfo(Revlog *changelog, int rev)
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
ri->logoff = Boffset(buf);
|
ri->logoff = Boffset(buf);
|
||||||
|
|
||||||
for(;;){
|
for(;;){
|
||||||
if((c = Bgetc(buf)) < 0)
|
if((c = Bgetc(buf)) < 0)
|
||||||
goto Error;
|
goto Error;
|
||||||
if(c == '\n'){
|
if(c == '\n')
|
||||||
|
break;
|
||||||
|
do {
|
||||||
if((c = Bgetc(buf)) < 0)
|
if((c = Bgetc(buf)) < 0)
|
||||||
goto Error;
|
goto Error;
|
||||||
if(c == '\n')
|
} while(c != '\n');
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ri->loglen = Boffset(buf) - ri->logoff - 1;
|
ri->loglen = Boffset(buf) - ri->logoff - 1;
|
||||||
|
|
||||||
line = Brdstr(buf, '\0', 1);
|
line = Brdstr(buf, '\0', 1);
|
||||||
|
|
Loading…
Reference in a new issue