* hgfs(4) getrevinfo patch
@ 2019-12-05 8:44 Alex Musolino
0 siblings, 0 replies; only message in thread
From: Alex Musolino @ 2019-12-05 8:44 UTC (permalink / raw)
To: 9front
Hi again,
Another problem with hgfs(4) is that it incorrectly reports the size
of files under the 'changes' directory that were renamed in a commit.
Here's my fix. Seems to work, but also seems too obvious not to have
been done this way already. Thoughts?
diff -r 754916eeedf1 sys/src/cmd/hgfs/fs.c
--- a/sys/src/cmd/hgfs/fs.c Tue Dec 03 18:32:30 2019 +1030
+++ b/sys/src/cmd/hgfs/fs.c Thu Dec 05 19:13:06 2019 +1030
@@ -104,7 +104,6 @@
getrevinfo(int rev)
{
Revinfo *ri;
-
if(rev < 0 || rev >= changelog.nmap)
return nil;
if(ri = changelog.map[rev].aux)
@@ -236,7 +235,7 @@
char buf[64], *s;
Revnode *nd;
Revinfo *ri;
- int rev;
+ int rev, fd;
memset(d, 0, sizeof(*d));
@@ -302,15 +301,9 @@
break;
if((rev = hashrev(rl, nd->hash)) >= 0){
if(level == Qtree){
- /*
- * BUG: this is not correct. mercurial might
- * prefix the data log with random \1\n escaped
- * metadata strings (see fmetaheader()) and the flen
- * *includes* the metadata part. we try to compensate
- * for this once the revision got extracted and
- * subtract the metadata header in fsstat().
- */
- d->length = rl->map[rev].flen;
+ fd = revlogopentemp(rl, rev);
+ d->length = rl->map[rev].flen - fmetaheader(fd);
+ close(fd);
}
ri = getrevinfo(rl->map[rev].linkrev);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-12-05 8:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 8:44 hgfs(4) getrevinfo patch Alex Musolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).