Skip to content

Commit

Permalink
Honor the --force option when publishing a crate (alire-project#1083)
Browse files Browse the repository at this point in the history
When publishing and checking for existing crate with same version,
if the crate already exist and the force option is used,
emit a warning message and continue.
  • Loading branch information
stcarrez committed Aug 3, 2022
1 parent 3e561be commit 48488cb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/alire/alire-publish.adb
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,15 @@ package body Alire.Publish is

Index_On_Disk.Loading.Load_All (Strict => True).Assert;
if Index.Exists (Release.Name, Release.Version) then
Raise_Checked_Error
("Target release " & Release.Milestone.TTY_Image
& " already exist in a loaded index");
if not Force then
Raise_Checked_Error
("Target release " & Release.Milestone.TTY_Image
& " already exist in a loaded index");
end if;
Ada.Text_IO.New_Line;
Trace.Warning
("Target release " & Release.Milestone.TTY_Image
& " already exist in a loaded index (ignored)");
end if;

-- Present release information to user
Expand Down

0 comments on commit 48488cb

Please sign in to comment.