]> git.e2factory.org Git - e2factory.git/commitdiff
Make sure all working_copy_available() functions return an error on false
authorTobias Ulmer <tu@emlix.com>
Thu, 12 Jan 2017 14:24:39 +0000 (15:24 +0100)
committerTobias Ulmer <tu@emlix.com>
Thu, 12 Jan 2017 14:24:44 +0000 (15:24 +0100)
Behaves more like other functions, reduce potential for bugs in error
path

Signed-off-by: Tobias Ulmer <tu@emlix.com>
plugins/cvs.lua
plugins/files.lua
plugins/svn.lua

index 0d5a73253dc7a8762dc8bc13a0f1b927d1a10a7b..ab2651e32267fda3eb50773ac5c8fa45e7affeca 100644 (file)
@@ -403,7 +403,10 @@ end
 function cvs.working_copy_available(info, sourcename)
     local src = source.sources[sourcename]
     local dir = e2lib.join(info.root, src:get_working())
-    return e2lib.isdir(dir)
+    if not e2lib.isdir(dir) then
+        return false, err.new("working copy for %s is not available", sourcename)
+    end
+    return true
 end
 
 function cvs.has_working_copy(info, sourcename)
index 39b454bf982ea8f6034a67e71d9dc74f1f81533e..651dcd74e91ee80f87385631eea9d1263eaacf30 100644 (file)
@@ -313,7 +313,7 @@ function files.fetch_source(info, sourcename)
 end
 
 function files.working_copy_available(info, sourcename)
-    return false
+    return false, err.new("source %s doesn't require a working copy", sourcename)
 end
 
 function files.has_working_copy(info, sourcename)
index 23d4c2b5e75920b4610d74701975559a5da57814..eafe4696b8fc83218d0150a5a4fb81a1e814026a 100644 (file)
@@ -421,7 +421,10 @@ function svn.working_copy_available(info, sourcename)
     local src = source.sources[sourcename]
 
     local dir = e2lib.join(info.root, src:get_working())
-    return e2lib.isdir(dir)
+    if not e2lib.isdir(dir) then
+        return false, err.new("working copy for %s is not available", sourcename)
+    end
+    return true
 end
 
 function svn.check_workingcopy(info, sourcename)