commit ncdu for openSUSE:Factory
Hello community, here is the log from the commit of package ncdu for openSUSE:Factory checked in at 2019-05-22 12:19:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ncdu (Old) and /work/SRC/openSUSE:Factory/.ncdu.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ncdu" Wed May 22 12:19:56 2019 rev:11 rq:704645 version:1.14 Changes: -------- --- /work/SRC/openSUSE:Factory/ncdu/ncdu.changes 2018-02-07 18:42:31.817044965 +0100 +++ /work/SRC/openSUSE:Factory/.ncdu.new.5148/ncdu.changes 2019-05-22 12:20:02.680849530 +0200 @@ -1,0 +2,13 @@ +Sat May 18 08:08:05 UTC 2019 - Martin Hauke <mardnh@gmx.de> + +- Update to version 1.14 + * Add mtime display and sorting + * Add (limited) --follow-symlinks option + * Display larger file counts in browser UI + * Add -V, --version, and --help alias flags + * Fix crash when attempting to sort an empty directory + * Fix 100% CPU bug when ncdu loses the terminal + * Fix '--color=off' flag + * Fix some typos + +------------------------------------------------------------------- Old: ---- ncdu-1.13.tar.gz ncdu-1.13.tar.gz.asc New: ---- ncdu-1.14.tar.gz ncdu-1.14.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ncdu.spec ++++++ --- /var/tmp/diff_new_pack.eBvwc3/_old 2019-05-22 12:20:04.724848196 +0200 +++ /var/tmp/diff_new_pack.eBvwc3/_new 2019-05-22 12:20:04.744848182 +0200 @@ -1,7 +1,7 @@ # # spec file for package ncdu # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,12 +12,12 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: ncdu -Version: 1.13 +Version: 1.14 Release: 0 Summary: NCurses Disk Usage License: MIT ++++++ ncdu-1.13.tar.gz -> ncdu-1.14.tar.gz ++++++ ++++ 2114 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/COPYING new/ncdu-1.14/COPYING --- old/ncdu-1.13/COPYING 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/COPYING 2019-02-04 16:50:09.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2007-2018 Yoran Heling +Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/ChangeLog new/ncdu-1.14/ChangeLog --- old/ncdu-1.13/ChangeLog 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/ChangeLog 2019-02-04 16:49:21.000000000 +0100 @@ -1,3 +1,13 @@ +1.14 - 2019-02-04 + - Add mtime display and sorting (Alex Wilson) + - Add (limited) --follow-symlinks option (Simon Doppler) + - Display larger file counts in browser UI + - Add -V, --version, and --help alias flags + - Fix crash when attempting to sort an empty directory + - Fix 100% CPU bug when ncdu loses the terminal + - Fix '--color=off' flag + - Fix some typos + 1.13 - 2018-01-29 - Add "extended information" mode and -e flag - Add file mode, modification time and uid/gid to info window with -e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/README new/ncdu-1.14/README --- old/ncdu-1.13/README 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/README 2019-02-04 16:50:19.000000000 +0100 @@ -1,4 +1,4 @@ -ncdu 1.13 +ncdu 1.14 ========= DESCRIPTION @@ -33,7 +33,7 @@ COPYING - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/compile new/ncdu-1.14/compile --- old/ncdu-1.13/compile 2018-01-29 11:58:45.000000000 +0100 +++ new/ncdu-1.14/compile 2019-02-04 16:50:48.000000000 +0100 @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -340,7 +340,7 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/configure.ac new/ncdu-1.14/configure.ac --- old/ncdu-1.13/configure.ac 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/configure.ac 2019-02-04 16:50:32.000000000 +0100 @@ -1,5 +1,5 @@ -AC_INIT(ncdu, 1.13, projects@yorhel.nl) +AC_INIT(ncdu, 1.14, projects@yorhel.nl) AC_CONFIG_SRCDIR([src/global.h]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([foreign subdir-objects]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/doc/ncdu.pod new/ncdu-1.14/doc/ncdu.pod --- old/ncdu-1.13/doc/ncdu.pod 2018-01-23 14:17:16.000000000 +0100 +++ new/ncdu-1.14/doc/ncdu.pod 2019-01-24 08:55:04.000000000 +0100 @@ -20,11 +20,11 @@ =over -=item -h +=item -h, --help Print a short help message and quit. -=item -v +=item -v, -V, --version Print ncdu version and quit. @@ -67,6 +67,9 @@ effect when importing a file that has been exported without the extended information. +This enables viewing and sorting by the latest child mtime, or modified time, +using 'm' and 'M', respectively. + =back =head2 Interface options @@ -169,6 +172,13 @@ usage statistics. See http://www.brynosaurus.com/cachedir/ +=item -L, --follow-symlinks + +Follow symlinks and count the size of the file they point to. As of ncdu 1.14, +this option will not follow symlinks to directories and will count each +symlinked file as a unique file (i.e. unlike how hard links are handled). This +is subject to change in later versions. + =back @@ -208,6 +218,11 @@ Toggle between showing disk usage and showing apparent size. +=item M + +Order by latest child mtime, or modified time. (press again for descending order) +Requires the -e flag. + =item d Delete the selected file or directory. An error message will be shown when the @@ -228,6 +243,10 @@ Toggle display of child item counts. +=item m + +Toggle display of latest child mtime, or modified time. Requires the -e flag. + =item e Show/hide 'hidden' or 'excluded' files and directories. Please note that even @@ -263,6 +282,45 @@ =back + +=head1 FILE FLAGS + +Entries in the browser interface may be prefixed by a one-character flag. These +flags have the following meaning: + +=over + +=item ! + +An error occurred while reading this directory. + +=item . + +An error occurred while reading a subdirectory, so the indicated size may not be +correct. + +=item < + +File or directory is excluded from the statistics by using exlude patterns. + +=item > + +Directory is on another filesystem. + +=item @ + +This is neither a file nor a folder (symlink, socket, ...). + +=item H + +Same file was already counted (hard link). + +=item e + +Empty directory. + +=back + =head1 EXAMPLES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/missing new/ncdu-1.14/missing --- old/ncdu-1.13/missing 2018-01-29 11:58:45.000000000 +0100 +++ new/ncdu-1.14/missing 2019-02-04 16:50:48.000000000 +0100 @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,7 +207,7 @@ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/ncdu.1 new/ncdu-1.14/ncdu.1 --- old/ncdu-1.13/ncdu.1 2018-01-23 14:19:18.000000000 +0100 +++ new/ncdu-1.14/ncdu.1 2019-02-04 16:52:44.000000000 +0100 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) +.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "NCDU 1" -.TH NCDU 1 "2018-01-23" "ncdu-1.12g" "ncdu manual" +.TH NCDU 1 "2019-01-24" "ncdu-1.14" "ncdu manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -147,11 +147,11 @@ .IX Header "OPTIONS" .SS "Mode Selection" .IX Subsection "Mode Selection" -.IP "\-h" 4 -.IX Item "-h" +.IP "\-h, \-\-help" 4 +.IX Item "-h, --help" Print a short help message and quit. -.IP "\-v" 4 -.IX Item "-v" +.IP "\-v, \-V, \-\-version" 4 +.IX Item "-v, -V, --version" Print ncdu version and quit. .IP "\-f \fI\s-1FILE\s0\fR" 4 .IX Item "-f FILE" @@ -188,6 +188,9 @@ when importing (to read this extra information in memory). This flag has no effect when importing a file that has been exported without the extended information. +.Sp +This enables viewing and sorting by the latest child mtime, or modified time, +using 'm' and 'M', respectively. .SS "Interface options" .IX Subsection "Interface options" .IP "\-0" 4 @@ -264,10 +267,16 @@ by a newline. .IP "\-\-exclude\-caches" 4 .IX Item "--exclude-caches" -Exclude directories containing \s-1CACHEDIR.TAG. \s0 The directories will still be +Exclude directories containing \s-1CACHEDIR.TAG.\s0 The directories will still be displayed, but not their content, and they are not counted towards the disk usage statistics. See http://www.brynosaurus.com/cachedir/ +.IP "\-L, \-\-follow\-symlinks" 4 +.IX Item "-L, --follow-symlinks" +Follow symlinks and count the size of the file they point to. As of ncdu 1.14, +this option will not follow symlinks to directories and will count each +symlinked file as a unique file (i.e. unlike how hard links are handled). This +is subject to change in later versions. .SH "KEYS" .IX Header "KEYS" .IP "?" 4 @@ -293,6 +302,10 @@ .IP "a" 4 .IX Item "a" Toggle between showing disk usage and showing apparent size. +.IP "M" 4 +.IX Item "M" +Order by latest child mtime, or modified time. (press again for descending order) +Requires the \-e flag. .IP "d" 4 .IX Item "d" Delete the selected file or directory. An error message will be shown when the @@ -309,6 +322,9 @@ .IP "c" 4 .IX Item "c" Toggle display of child item counts. +.IP "m" 4 +.IX Item "m" +Toggle display of latest child mtime, or modified time. Requires the \-e flag. .IP "e" 4 .IX Item "e" Show/hide 'hidden' or 'excluded' files and directories. Please note that even @@ -339,6 +355,27 @@ .IP "q" 4 .IX Item "q" Quit +.SH "FILE FLAGS" +.IX Header "FILE FLAGS" +Entries in the browser interface may be prefixed by a one-character flag. These +flags have the following meaning: +.IP "!" 4 +An error occurred while reading this directory. +.IP "." 4 +An error occurred while reading a subdirectory, so the indicated size may not be +correct. +.IP "<" 4 +File or directory is excluded from the statistics by using exlude patterns. +.IP ">" 4 +Directory is on another filesystem. +.IP "@" 4 +This is neither a file nor a folder (symlink, socket, ...). +.IP "H" 4 +.IX Item "H" +Same file was already counted (hard link). +.IP "e" 4 +.IX Item "e" +Empty directory. .SH "EXAMPLES" .IX Header "EXAMPLES" To scan and browse the directory you're currently in, all you need is a simple: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/browser.c new/ncdu-1.14/src/browser.c --- old/ncdu-1.13/src/browser.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/browser.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -31,7 +31,7 @@ #include <time.h> -static int graph = 1, show_as = 0, info_show = 0, info_page = 0, info_start = 0, show_items = 0; +static int graph = 1, show_as = 0, info_show = 0, info_page = 0, info_start = 0, show_items = 0, show_mtime = 0; static char *message = NULL; @@ -169,19 +169,54 @@ static void browse_draw_items(struct dir *n, int *x) { enum ui_coltype c = n->flags & FF_BSEL ? UIC_SEL : UIC_DEFAULT; + enum ui_coltype cn = c == UIC_SEL ? UIC_NUM_SEL : UIC_NUM; if(!show_items) return; *x += 7; - if(n->items > 99999) { - addstrc(c, "> "); - addstrc(c == UIC_SEL ? UIC_NUM_SEL : UIC_NUM, "100"); - addchc(c, 'k'); - } else if(n->items) { - uic_set(c == UIC_SEL ? UIC_NUM_SEL : UIC_NUM); + if(!n->items) + return; + else if(n->items < 100*1000) { + uic_set(cn); printw("%6s", fullsize(n->items)); + } else if(n->items < 1000*1000) { + uic_set(cn); + printw("%5.1f", n->items / 1000.0); + addstrc(c, "k"); + } else if(n->items < 1000*1000*1000) { + uic_set(cn); + printw("%5.1f", n->items / 1e6); + addstrc(c, "M"); + } else { + addstrc(c, " > "); + addstrc(cn, "1"); + addchc(c, 'B'); + } +} + + +static void browse_draw_mtime(struct dir *n, int *x) { + enum ui_coltype c = n->flags & FF_BSEL ? UIC_SEL : UIC_DEFAULT; + char mbuf[26]; + struct dir_ext *e; + time_t t; + + if (n->flags & FF_EXT) { + e = dir_ext_ptr(n); + } else if (!strcmp(n->name, "..") && (n->parent->flags & FF_EXT)) { + e = dir_ext_ptr(n->parent); + } else { + snprintf(mbuf, sizeof(mbuf), "no mtime"); + goto no_mtime; } + t = (time_t)e->mtime; + + strftime(mbuf, sizeof(mbuf), "%Y-%m-%d %H:%M:%S %z", localtime(&t)); + uic_set(c == UIC_SEL ? UIC_NUM_SEL : UIC_NUM); +no_mtime: + printw("%26s", mbuf); + *x += 27; } @@ -207,6 +242,11 @@ browse_draw_items(n, &x); move(row, x); + if (extended_info && show_mtime) { + browse_draw_mtime(n, &x); + move(row, x); + } + if(n->flags & FF_DIR) c = c == UIC_SEL ? UIC_DIR_SEL : UIC_DIR; addchc(c, n->flags & FF_DIR ? '/' : ' '); @@ -398,6 +438,12 @@ dirlist_set_sort(DL_COL_ITEMS, dirlist_sort_col == DL_COL_ITEMS ? !dirlist_sort_desc : 1, DL_NOCHANGE); info_show = 0; break; + case 'M': + if (extended_info) { + dirlist_set_sort(DL_COL_MTIME, dirlist_sort_col == DL_COL_MTIME ? !dirlist_sort_desc : 1, DL_NOCHANGE); + info_show = 0; + } + break; case 'e': dirlist_set_hidden(!dirlist_hidden); info_show = 0; @@ -463,6 +509,10 @@ case 'c': show_items = !show_items; break; + case 'm': + if (extended_info) + show_mtime = !show_mtime; + break; case 'i': info_show = !info_show; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/browser.h new/ncdu-1.14/src/browser.h --- old/ncdu-1.13/src/browser.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/browser.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/delete.c new/ncdu-1.14/src/delete.c --- old/ncdu-1.13/src/delete.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/delete.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -195,7 +195,7 @@ r = unlink(dr->name); delete_nxt: - /* error occured, ask user what to do */ + /* error occurred, ask user what to do */ if(r == -1 && !ignoreerr) { state = DS_FAILED; lasterrno = errno; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/delete.h new/ncdu-1.14/src/delete.h --- old/ncdu-1.13/src/delete.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/delete.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dir.h new/ncdu-1.14/src/dir.h --- old/ncdu-1.13/src/dir.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dir.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -123,7 +123,7 @@ void dir_curpath_enter(const char *); void dir_curpath_leave(); -/* Sets the path where the last error occured, or reset on NULL. */ +/* Sets the path where the last error occurred, or reset on NULL. */ void dir_setlasterr(const char *); /* Error message on fatal error, or NULL if there hasn't been a fatal error yet. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dir_common.c new/ncdu-1.14/src/dir_common.c --- old/ncdu-1.13/src/dir_common.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dir_common.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -36,7 +36,7 @@ char *dir_fatalerr; /* Error message on a fatal error. (NULL if there was no fatal error) */ int dir_ui; /* User interface to use */ static int confirm_quit_while_scanning_stage_1_passed; /* Additional check before quitting */ -static char *lasterr; /* Path where the last error occured. */ +static char *lasterr; /* Path where the last error occurred. */ static int curpathl; /* Allocated length of dir_curpath */ static int lasterrl; /* ^ of lasterr */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dir_export.c new/ncdu-1.14/src/dir_export.c --- old/ncdu-1.13/src/dir_export.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dir_export.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dir_import.c new/ncdu-1.14/src/dir_import.c --- old/ncdu-1.13/src/dir_import.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dir_import.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -81,7 +81,7 @@ /* Fills readbuf with data from the stream. *buf will have at least n (< * READ_BUF_SIZE) bytes available, unless the stream reached EOF or an error - * occured. If the file data contains a null-type, this is considered an error. + * occurred. If the file data contains a null-type, this is considered an error. * Returns 0 on success, non-zero on error. */ static int fill(int n) { int r; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dir_mem.c new/ncdu-1.14/src/dir_mem.c --- old/ncdu-1.13/src/dir_mem.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dir_mem.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -67,10 +67,8 @@ /* found in the table? update hlnk */ if(!i) { - t = d->hlnk = kh_key(links, k); - if(t->hlnk != NULL) - for(t=t->hlnk; t->hlnk!=d->hlnk; t=t->hlnk) - ; + t = kh_key(links, k); + d->hlnk = t->hlnk == NULL ? t : t->hlnk; t->hlnk = d; } @@ -146,10 +144,13 @@ * possible hard link, because hlnk_check() will take care of it in that * case. */ if(item->flags & FF_HLNKC) { - addparentstats(item->parent, 0, 0, 1); + addparentstats(item->parent, 0, 0, 0, 1); hlink_check(item); - } else - addparentstats(item->parent, item->size, item->asize, 1); + } else if(item->flags & FF_EXT) { + addparentstats(item->parent, item->size, item->asize, dir_ext_ptr(item)->mtime, 1); + } else { + addparentstats(item->parent, item->size, item->asize, 0, 1); + } /* propagate ERR and SERR back up to the root */ if(item->flags & FF_SERR || item->flags & FF_ERR) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dir_scan.c new/ncdu-1.14/src/dir_scan.c --- old/ncdu-1.13/src/dir_scan.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dir_scan.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -84,7 +84,7 @@ /* Reads all filenames in the currently chdir'ed directory and stores it as a * nul-separated list of filenames. The list ends with an empty filename (i.e. * two nuls). . and .. are not included. Returned memory should be freed. *err - * is set to 1 if some error occured. Returns NULL if that error was fatal. + * is set to 1 if some error occurred. Returns NULL if that error was fatal. * The reason for reading everything in memory first and then walking through * the list is to avoid eating too many file descriptors in a deeply recursive * directory. */ @@ -185,7 +185,7 @@ * directory. Assumes we're chdir'ed in the directory in which this item * resides. */ static int dir_scan_item(const char *name) { - struct stat st; + static struct stat st, stl; int fail = 0; #ifdef __CYGWIN__ @@ -204,8 +204,12 @@ dir_setlasterr(dir_curpath); } - if(!(buf_dir->flags & (FF_ERR|FF_EXL))) - stat_to_dir(&st); + if(!(buf_dir->flags & (FF_ERR|FF_EXL))) { + if(follow_symlinks && S_ISLNK(st.st_mode) && !stat(name, &stl) && !S_ISDIR(stl.st_mode)) + stat_to_dir(&stl); + else + stat_to_dir(&st); + } if(cachedir_tags && (buf_dir->flags & FF_DIR) && !(buf_dir->flags & (FF_ERR|FF_EXL|FF_OTHFS))) if(has_cachedir_tag(buf_dir->name)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dirlist.c new/ncdu-1.14/src/dirlist.c --- old/ncdu-1.13/src/dirlist.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dirlist.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -50,6 +50,14 @@ )) +static inline int cmp_mtime(struct dir *x, struct dir*y) { + int64_t x_mtime = 0, y_mtime = 0; + if (x->flags & FF_EXT) + x_mtime = dir_ext_ptr(x)->mtime; + if (y->flags & FF_EXT) + y_mtime = dir_ext_ptr(y)->mtime; + return (x_mtime > y_mtime ? 1 : (x_mtime == y_mtime ? 0 : -1)); +} static int dirlist_cmp(struct dir *x, struct dir *y) { int r; @@ -80,7 +88,8 @@ r = dirlist_sort_col == DL_COL_NAME ? CMP_NAME : dirlist_sort_col == DL_COL_SIZE ? CMP_SIZE : dirlist_sort_col == DL_COL_ASIZE ? CMP_ASIZE : - CMP_ITEMS; + dirlist_sort_col == DL_COL_ITEMS ? CMP_ITEMS : + cmp_mtime(x, y); /* try 2 */ if(!r) r = dirlist_sort_col == DL_COL_SIZE ? CMP_ASIZE : CMP_SIZE; @@ -306,7 +315,7 @@ * 1 = selected has moved down * -1 = selected has moved up * -2 = selected = first item in the list (faster version of '1') - * -3 = top should be considered as invalid (after sorting or opening an other dir) + * -3 = top should be considered as invalid (after sorting or opening another dir) * -4 = an item has been deleted * -5 = hidden flag has been changed * @@ -371,7 +380,8 @@ dirlist_sort_df = df; /* sort the list (excluding the parent, which is always on top) */ - head_real = dirlist_sort(head_real); + if(head_real) + head_real = dirlist_sort(head_real); if(dirlist_parent) dirlist_parent->next = head_real; else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/dirlist.h new/ncdu-1.14/src/dirlist.h --- old/ncdu-1.13/src/dirlist.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/dirlist.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -37,6 +37,7 @@ #define DL_COL_SIZE 1 #define DL_COL_ASIZE 2 #define DL_COL_ITEMS 3 +#define DL_COL_MTIME 4 void dirlist_open(struct dir *); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/exclude.c new/ncdu-1.14/src/exclude.c --- old/ncdu-1.13/src/exclude.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/exclude.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/exclude.h new/ncdu-1.14/src/exclude.h --- old/ncdu-1.13/src/exclude.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/exclude.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/global.h new/ncdu-1.14/src/global.h --- old/ncdu-1.13/src/global.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/global.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -45,7 +45,7 @@ #define FF_DIR 0x01 #define FF_FILE 0x02 #define FF_ERR 0x04 /* error while reading this item */ -#define FF_OTHFS 0x08 /* excluded because it was an other filesystem */ +#define FF_OTHFS 0x08 /* excluded because it was another filesystem */ #define FF_EXL 0x10 /* excluded using exlude patterns */ #define FF_SERR 0x20 /* error in subdirectory */ #define FF_HLNKC 0x40 /* hard link candidate (file with st_nlink > 1) */ @@ -103,6 +103,8 @@ extern int confirm_quit; /* flag whether we want to enable use of struct dir_ext */ extern int extended_info; +/* flag whether we want to follow symlinks */ +extern int follow_symlinks; /* handle input from keyboard and update display */ int input_handle(int); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/help.c new/ncdu-1.14/src/help.c --- old/ncdu-1.13/src/help.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/help.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -32,7 +32,7 @@ int page, start; -#define KEYS 17 +#define KEYS 19 char *keys[KEYS*2] = { /*|----key----| |----------------description----------------|*/ "up, k", "Move cursor up", @@ -42,11 +42,13 @@ "n", "Sort by name (ascending/descending)", "s", "Sort by size (ascending/descending)", "C", "Sort by items (ascending/descending)", + "M", "Sort by mtime (-e flag)", "d", "Delete selected file or directory", "t", "Toggle dirs before files when sorting", "g", "Show percentage and/or graph", "a", "Toggle between apparent size and disk usage", "c", "Toggle display of child item counts", + "m", "Toggle display of latest mtime (-e flag)", "e", "Show/hide hidden or excluded files", "i", "Show information about selected item", "r", "Recalculate the current directory", @@ -97,10 +99,10 @@ ncaddch(10, 4, 'H'); ncaddch(11, 4, 'e'); uic_set(UIC_DEFAULT); - ncaddstr( 5, 7, "An error occured while reading this directory"); - ncaddstr( 6, 7, "An error occured while reading a subdirectory"); + ncaddstr( 5, 7, "An error occurred while reading this directory"); + ncaddstr( 6, 7, "An error occurred while reading a subdirectory"); ncaddstr( 7, 7, "File or directory is excluded from the statistics"); - ncaddstr( 8, 7, "Directory was on an other filesystem"); + ncaddstr( 8, 7, "Directory was on another filesystem"); ncaddstr( 9, 7, "This is not a file nor a dir (symlink, socket, ...)"); ncaddstr(10, 7, "Same file was already counted (hard link)"); ncaddstr(11, 7, "Empty directory"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/help.h new/ncdu-1.14/src/help.h --- old/ncdu-1.13/src/help.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/help.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/main.c new/ncdu-1.14/src/main.c --- old/ncdu-1.13/src/main.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/main.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -41,6 +41,7 @@ long update_delay = 100; int cachedir_tags = 0; int extended_info = 0; +int follow_symlinks = 0; static int min_rows = 17, min_cols = 60; static int ncurses_init = 0; @@ -103,6 +104,8 @@ } screen_draw(); } + if(errno == EPIPE || errno == EBADF) + return 1; return 0; } @@ -117,9 +120,9 @@ char *dir = NULL; static yopt_opt_t opts[] = { - { 'h', 0, "-h,-?" }, + { 'h', 0, "-h,-?,--help" }, { 'q', 0, "-q" }, - { 'v', 0, "-v" }, + { 'v', 0, "-v,-V,--version" }, { 'x', 0, "-x" }, { 'e', 0, "-e" }, { 'r', 0, "-r" }, @@ -130,6 +133,7 @@ { '2', 0, "-2" }, { 1, 1, "--exclude" }, { 'X', 1, "-X,--exclude-from" }, + { 'L', 0, "-L,--follow-symlinks" }, { 'C', 0, "--exclude-caches" }, { 's', 0, "--si" }, { 'Q', 0, "--confirm-quit" }, @@ -146,9 +150,9 @@ case 0 : dir = val; break; case 'h': printf("ncdu <options> <directory>\n\n"); - printf(" -h This help message\n"); + printf(" -h,--help This help message\n"); printf(" -q Quiet mode, refresh interval 2 seconds\n"); - printf(" -v Print version\n"); + printf(" -v,-V,--version Print version\n"); printf(" -x Same filesystem\n"); printf(" -e Enable extended information\n"); printf(" -r Read only\n"); @@ -158,6 +162,7 @@ printf(" --si Use base 10 (SI) prefixes instead of base 2\n"); printf(" --exclude PATTERN Exclude files that match PATTERN\n"); printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n"); + printf(" -L, --follow-symlinks Follow symbolic links (excluding directories)\n"); printf(" --exclude-caches Exclude directories containing CACHEDIR.TAG\n"); printf(" --confirm-quit Confirm quitting ncdu\n"); printf(" --color SCHEME Set color scheme\n"); @@ -183,12 +188,13 @@ exit(1); } break; + case 'L': follow_symlinks = 1; break; case 'C': cachedir_tags = 1; break; case 'c': if(strcmp(val, "off") == 0) { uic_theme = 0; } - if(strcmp(val, "dark") == 0) { uic_theme = 1; } + else if(strcmp(val, "dark") == 0) { uic_theme = 1; } else { fprintf(stderr, "Unknown --color option: %s\n", val); exit(1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/path.c new/ncdu-1.14/src/path.c --- old/ncdu-1.13/src/path.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/path.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/path.h new/ncdu-1.14/src/path.h --- old/ncdu-1.13/src/path.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/path.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/quit.c new/ncdu-1.14/src/quit.c --- old/ncdu-1.13/src/quit.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/quit.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2015-2018 Yoran Heling + Copyright (c) 2015-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/quit.h new/ncdu-1.14/src/quit.h --- old/ncdu-1.13/src/quit.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/quit.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2015-2018 Yoran Heling + Copyright (c) 2015-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/shell.c new/ncdu-1.14/src/shell.c --- old/ncdu-1.13/src/shell.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/shell.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Shell support: Copyright (c) 2014 Thomas Jarosch Permission is hereby granted, free of charge, to any person obtaining diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/shell.h new/ncdu-1.14/src/shell.h --- old/ncdu-1.13/src/shell.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/shell.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Shell support: Copyright (c) 2014 Thomas Jarosch Permission is hereby granted, free of charge, to any person obtaining diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/util.c new/ncdu-1.14/src/util.c --- old/ncdu-1.13/src/util.c 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/util.c 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -344,8 +344,11 @@ freedir_hlnk(dr); /* update sizes of parent directories if this isn't a hard link. - * If this is a hard link, freedir_hlnk() would have done so already */ - addparentstats(dr->parent, dr->flags & FF_HLNKC ? 0 : -dr->size, dr->flags & FF_HLNKC ? 0 : -dr->asize, -(dr->items+1)); + * If this is a hard link, freedir_hlnk() would have done so already + * + * mtime is 0 here because recalculating the maximum at every parent + * dir is expensive, but might be good feature to add later if desired */ + addparentstats(dr->parent, dr->flags & FF_HLNKC ? 0 : -dr->size, dr->flags & FF_HLNKC ? 0 : -dr->asize, 0, -(dr->items+1)); free(dr); } @@ -397,11 +400,16 @@ } -void addparentstats(struct dir *d, int64_t size, int64_t asize, int items) { +void addparentstats(struct dir *d, int64_t size, int64_t asize, uint64_t mtime, int items) { + struct dir_ext *e; while(d) { d->size = adds64(d->size, size); d->asize = adds64(d->asize, asize); d->items += items; + if (d->flags & FF_EXT) { + e = dir_ext_ptr(d); + e->mtime = (e->mtime > mtime) ? e->mtime : mtime; + } d = d->parent; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ncdu-1.13/src/util.h new/ncdu-1.14/src/util.h --- old/ncdu-1.13/src/util.h 2018-01-29 11:58:14.000000000 +0100 +++ new/ncdu-1.14/src/util.h 2019-02-04 16:49:57.000000000 +0100 @@ -1,6 +1,6 @@ /* ncdu - NCurses Disk Usage - Copyright (c) 2007-2018 Yoran Heling + Copyright (c) 2007-2019 Yoran Heling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -163,7 +163,7 @@ : (a)+(b) < 0 ? 0 : (a)+(b)) /* Adds a value to the size, asize and items fields of *d and its parents */ -void addparentstats(struct dir *, int64_t, int64_t, int); +void addparentstats(struct dir *, int64_t, int64_t, uint64_t, int); /* A simple stack implemented in macros */
participants (1)
-
root