From 2ead99f732f75ee7bed384b73cd2d3251d6feb25 Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Sun, 7 Oct 2018 00:54:00 +0900 Subject: [PATCH] refactor: improve commit error msg when fishfile is not empty --- fisher.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fisher.fish b/fisher.fish index 8dfe55d..578519c 100644 --- a/fisher.fish +++ b/fisher.fish @@ -163,7 +163,8 @@ function _fisher_commit command mv -f $fishfile@ $fishfile command rm -f $fishfile@ - set -l added_pkgs (_fisher_pkg_fetch_all (_fisher_fishfile_load < $fishfile)) + set -l expected_pkgs (_fisher_fishfile_load < $fishfile) + set -l added_pkgs (_fisher_pkg_fetch_all $expected_pkgs) set -l updated_pkgs ( for pkg in $removed_pkgs set pkg (echo $pkg | command sed "s|$fisher_config/||") @@ -172,7 +173,7 @@ function _fisher_commit end end) - if test -z "$added_pkgs$updated_pkgs$removed_pkgs" -a ! -s "$fishfile" + if test -z "$added_pkgs$updated_pkgs$removed_pkgs$expected_pkgs" echo "nothing to commit -- try adding some packages" >&2 return 1 end