Skip to content

Commit 528271e

Browse files
committed
fix: Make error when upgrading non repository accurate
1 parent 0d18962 commit 528271e

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pkg/lib/commands/do-upgrade.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ do_actual_upgrade() {
6161

6262
# Only upgrade if the package is a Git repository. If it is not, then
6363
# it's a package installed with 'link'
64-
if [ -d "$BPM_PACKAGES_PATH/$id/.git" ]; then
65-
log.info "Upgrading '$id'"
66-
do-plumbing-remove-deps "$id"
67-
do-plumbing-unlink-bins "$id"
68-
do-plumbing-unlink-completions "$id"
69-
do-plumbing-unlink-man "$id"
70-
git -C "$BPM_PACKAGES_PATH/$id" pull
71-
do-plumbing-add-deps "$id"
72-
do-plumbing-link-bins "$id"
73-
do-plumbing-link-completions "$id"
74-
do-plumbing-link-man "$id"
75-
else
76-
log.warn "Package '$id' has been added with 'bpm link'. It cannot be upgraded"
64+
if [ ! -d "$BPM_PACKAGES_PATH/$id/.git" ]; then
65+
die "Package at '$BPM_PACKAGES_PATH/$id' is not a Git repository"
7766
fi
67+
68+
log.info "Upgrading '$id'"
69+
do-plumbing-remove-deps "$id"
70+
do-plumbing-unlink-bins "$id"
71+
do-plumbing-unlink-completions "$id"
72+
do-plumbing-unlink-man "$id"
73+
git -C "$BPM_PACKAGES_PATH/$id" pull
74+
do-plumbing-add-deps "$id"
75+
do-plumbing-link-bins "$id"
76+
do-plumbing-link-completions "$id"
77+
do-plumbing-link-man "$id"
7878
}

tests/do-upgrade.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ load 'util/init.sh'
113113
run 'do-upgrade' 'local/theta'
114114

115115
assert_success
116-
assert_line -p "Package 'github.com/local/theta' has been added with 'bpm link'. It cannot be upgraded"
116+
assert_line -p "Package at '$BPM_PACKAGES_PATH/local/theta' is not a Git repository"
117117
}
118118

119119
@test "errors when no packages are given" {

0 commit comments

Comments
 (0)