Printing all of "Installed", "Removed" and "Net Upgrade" sizes is
redundant as the difference of the first two is the last. Instead,
only print "Net Upgrade Size" when both the installed and removed
are non-zero.

This results in the following output in the following cases:
 - package installation only: Installed Size
 - package installation involving replacement: Net Upgrade Size
 - package removal only: Removed Size
 - package upgrade: Net Upgrade Size
 - combination upgrade and installation: Net Upgrade Size

Signed-off-by: Allan McRae <al...@archlinux.org>
---
 src/pacman/util.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index 34cdc8c..65bd8d3 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -881,11 +881,11 @@ static void _display_targets(alpm_list_t *targets)
                printf(_("Total Download Size:    %.2f %s\n"), size, label);
        }
        if(!config->op_s_downloadonly) {
-               if(isize > 0) {
+               if(isize > 0 && rsize == 0) {
                        size = humanize_size(isize, 'M', &label);
                        printf(_("Total Installed Size:   %.2f %s\n"), size, 
label);
                }
-               if(rsize > 0) {
+               if(rsize > 0 && isize == 0) {
                        size = humanize_size(rsize, 'M', &label);
                        printf(_("Total Removed Size:     %.2f %s\n"), size, 
label);
                }
-- 
1.7.6.4


Reply via email to