mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Some fixes in mtime propagation and hardlink refresh counting
This commit is contained in:
parent
db51987446
commit
ddbed8b07f
1 changed files with 10 additions and 4 deletions
14
src/sink.zig
14
src/sink.zig
|
|
@ -148,6 +148,9 @@ const MemDir = struct {
|
||||||
self.dir.entry.pack.blocks +|= stat.blocks;
|
self.dir.entry.pack.blocks +|= stat.blocks;
|
||||||
self.dir.entry.size +|= stat.size;
|
self.dir.entry.size +|= stat.size;
|
||||||
}
|
}
|
||||||
|
if (self.dir.entry.ext()) |e| {
|
||||||
|
if (stat.ext.mtime > e.mtime) e.mtime = stat.ext.mtime;
|
||||||
|
}
|
||||||
|
|
||||||
const etype = if (stat.dir) model.EType.dir
|
const etype = if (stat.dir) model.EType.dir
|
||||||
else if (stat.hlinkc) model.EType.link
|
else if (stat.hlinkc) model.EType.link
|
||||||
|
|
@ -191,7 +194,7 @@ const MemDir = struct {
|
||||||
self.dir.items +|= self.items;
|
self.dir.items +|= self.items;
|
||||||
if (self.suberr) self.dir.pack.suberr = true;
|
if (self.suberr) self.dir.pack.suberr = true;
|
||||||
if (self.dir.entry.ext()) |e| {
|
if (self.dir.entry.ext()) |e| {
|
||||||
if (self.mtime > e.mtime) self.mtime = e.mtime;
|
if (self.mtime > e.mtime) e.mtime = self.mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add own counts to parent
|
// Add own counts to parent
|
||||||
|
|
@ -202,7 +205,7 @@ const MemDir = struct {
|
||||||
p.bytes +|= self.dir.entry.size - self.own_bytes;
|
p.bytes +|= self.dir.entry.size - self.own_bytes;
|
||||||
p.items +|= self.dir.items;
|
p.items +|= self.dir.items;
|
||||||
if (self.dir.entry.ext()) |e| {
|
if (self.dir.entry.ext()) |e| {
|
||||||
if (e.mtime > p.mtime) e.mtime = p.mtime;
|
if (e.mtime > p.mtime) p.mtime = e.mtime;
|
||||||
}
|
}
|
||||||
if (self.suberr or self.dir.pack.suberr or self.dir.pack.err) p.suberr = true;
|
if (self.suberr or self.dir.pack.suberr or self.dir.pack.err) p.suberr = true;
|
||||||
}
|
}
|
||||||
|
|
@ -353,7 +356,6 @@ pub fn done() void {
|
||||||
if (state.out == .mem) {
|
if (state.out == .mem) {
|
||||||
state.status = .hlcnt;
|
state.status = .hlcnt;
|
||||||
main.handleEvent(false, true);
|
main.handleEvent(false, true);
|
||||||
model.inodes.addAllStats();
|
|
||||||
const dir = state.out.mem orelse model.root;
|
const dir = state.out.mem orelse model.root;
|
||||||
var it: ?*model.Dir = dir;
|
var it: ?*model.Dir = dir;
|
||||||
while (it) |p| : (it = p.parent) {
|
while (it) |p| : (it = p.parent) {
|
||||||
|
|
@ -364,6 +366,7 @@ pub fn done() void {
|
||||||
p.items +|= dir.items + 1;
|
p.items +|= dir.items + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
model.inodes.addAllStats();
|
||||||
}
|
}
|
||||||
state.status = .done;
|
state.status = .done;
|
||||||
main.allocator.free(state.threads);
|
main.allocator.free(state.threads);
|
||||||
|
|
@ -423,7 +426,10 @@ fn drawConsole() void {
|
||||||
st.lines_written -= 1;
|
st.lines_written -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.status == .running) {
|
if (state.status == .hlcnt) {
|
||||||
|
wr.writeAll("Counting hardlinks...\n") catch {};
|
||||||
|
|
||||||
|
} else if (state.status == .running) {
|
||||||
var bytes: u64 = 0;
|
var bytes: u64 = 0;
|
||||||
var files: u64 = 0;
|
var files: u64 = 0;
|
||||||
for (state.threads) |*t| {
|
for (state.threads) |*t| {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue