From: Tobias Ulmer Date: Thu, 12 Jan 2017 14:24:39 +0000 (+0100) Subject: Make sure all working_copy_available() functions return an error on false X-Git-Tag: e2factory-2.3.16~4 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=c5bab37dca177e9b2d41bb1fa315a5efd7129281;p=e2factory.git Make sure all working_copy_available() functions return an error on false Behaves more like other functions, reduce potential for bugs in error path Signed-off-by: Tobias Ulmer --- diff --git a/plugins/cvs.lua b/plugins/cvs.lua index 0d5a732..ab2651e 100644 --- a/plugins/cvs.lua +++ b/plugins/cvs.lua @@ -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) diff --git a/plugins/files.lua b/plugins/files.lua index 39b454b..651dcd7 100644 --- a/plugins/files.lua +++ b/plugins/files.lua @@ -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) diff --git a/plugins/svn.lua b/plugins/svn.lua index 23d4c2b..eafe469 100644 --- a/plugins/svn.lua +++ b/plugins/svn.lua @@ -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)