]> git.e2factory.org Git - e2factory.git/commitdiff
fetch-project: enforce mutual exclusivness of --tag and --branch
authorTobias Ulmer <tu@emlix.com>
Tue, 18 Sep 2018 17:55:01 +0000 (19:55 +0200)
committerTobias Ulmer <tu@emlix.com>
Mon, 10 Dec 2018 17:00:11 +0000 (18:00 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
global/e2-fetch-project.lua

index 012ac66d7ef5495471fd29e030f163bf982797a6..a8be637708883673c8cccf8dab3797a796c0b92b 100644 (file)
@@ -76,6 +76,10 @@ local function e2_fetch_project(arg)
         error(err.new("too many arguments"))
     end
 
+    if opts["tag"] and opts["branch"] then
+        error(err.new("--tag and --branch are mutually exclusive"))
+    end
+
     local sl, re = e2lib.parse_server_location(arguments[1],
         e2lib.globals.default_projects_server)
     if not sl then
@@ -104,13 +108,8 @@ local function e2_fetch_project(arg)
 
     if opts["branch"] then
         p.branch = opts["branch"]
-    else
-        p.branch = nil
-    end
-    if opts["tag"] then
+    elseif opts["tag"] then
         p.tag = opts["tag"]
-    else
-        p.tag = nil
     end
 
     -- fetch project descriptor file