]> git.e2factory.org Git - e2factory.git/commitdiff
git: tolerate improper configuration of source for development
authorTobias Ulmer <tu@emlix.com>
Fri, 3 May 2019 17:38:08 +0000 (19:38 +0200)
committerTobias Ulmer <tu@emlix.com>
Fri, 3 May 2019 17:38:13 +0000 (19:38 +0200)
Often one wants to create a git repo and start doing some explorative
work without setting up the repository on the server.

Allow this by downgrading the error messages to very loud warnings. Will
still fail to build in release mode.

Due to design limitations, multiple warnings may appear, but this might
be considered a good thing by some.

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

index 17389c491f39acb4d5f146b65c036ac336f5a522..fa93f0e2d1b49a987e49f90e3631bb681333c4c5 100644 (file)
@@ -242,7 +242,14 @@ function git.git_source:git_commit_id(sourceset, check_remote)
 
     rc, re = self:check_workingcopy()
     if not rc then
-        return false, e:cat(re)
+        if check_remote or policy.opts.check() or policy.opts.check_remote() then
+            return false, e:cat(re)
+        else
+            -- allow building with an improper git workingcopy setup to ease
+            -- development, but complain about it loudly.
+            e2lib.warnf("WOTHER", "please fix: %s",
+                e:cat(re):tostring():gsub('\n', ''))
+        end
     end
 
     gitdir = e2lib.join(e2tool.root(), self:get_working(), ".git")
@@ -623,7 +630,13 @@ function git.git_source:prepare_source(sourceset, buildpath)
 
     rc, re = self:check_workingcopy()
     if not rc then
-        return false, e:cat(re)
+        if policy.opts.check() or policy.opts.check_remote() then
+            return false, e:cat(re)
+        else
+            -- see git.git_source:git_commit_id()
+            e2lib.warnf("WOTHER", "please fix: %s",
+                e:cat(re):tostring():gsub('\n', ''))
+        end
     end
 
     srcdir = e2lib.join(e2tool.root(), self:get_working())