Skip to content

Commit

Permalink
Generate better warning for conflicting local repo names
Browse files Browse the repository at this point in the history
Points user to resolution when local repo names are in conflict.

Fixes radian-software#500
  • Loading branch information
progfolio committed Aug 16, 2020
1 parent 0c7c757 commit 1cd48dd
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions straight.el
Original file line number Diff line number Diff line change
Expand Up @@ -3139,8 +3139,7 @@ RECIPE should be a straight.el-style recipe plist."
;; in Step 2, no need to show another one here. Only signal a
;; warning here when the packages are actually *different*
;; packages that share the same repository.
(unless (equal (plist-get recipe :package)
(plist-get existing-recipe :package))
(unless (equal package (plist-get existing-recipe :package))
;; Only the VC-specific keywords are relevant for this.
(cl-dolist (keyword (cons :type (straight-vc-keywords type)))
;; Note that it doesn't matter which recipe we get `:type'
Expand All @@ -3156,13 +3155,17 @@ RECIPE should be a straight.el-style recipe plist."
;; `straight--repo-cache' and `straight--recipe-cache'
;; at the end of this method, this warning will only be
;; displayed once per recipe modification.
(straight--warn (concat "Packages %S and %S have incompatible "
"recipes (%S cannot be both %S and %S)")
(plist-get existing-recipe :package)
package
keyword
(plist-get existing-recipe keyword)
(plist-get recipe keyword))
(straight--warn
(concat
"Packages %S and %S have incompatible "
"recipes (%S cannot be both %S and %S)"
(when (eq keyword :repo)
"\nOne of the recipes must specify a unique :local-repo."))
(plist-get existing-recipe :package)
package
keyword
(plist-get existing-recipe keyword)
(plist-get recipe keyword))
(cl-return)))))
;; Step 2 is to check if the given recipe conflicts with an
;; existing recipe for the *same* package.
Expand Down

0 comments on commit 1cd48dd

Please sign in to comment.