summaryrefslogtreecommitdiff
path: root/xmake/modules/private
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-12 23:05:38 +0800
committerruki <[email protected]>2022-04-12 23:05:38 +0800
commit8db3cdabf865392bdf3734a3cc0803bdbd045a09 (patch)
tree741e115fffb231781ec8d66b9be3f68b69086a53 /xmake/modules/private
parent52f324b543b512f53a75a653f3b32cc7dbfe601e (diff)
reset files
Diffstat (limited to 'xmake/modules/private')
-rw-r--r--xmake/modules/private/service/remote_build/session.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/xmake/modules/private/service/remote_build/session.lua b/xmake/modules/private/service/remote_build/session.lua
index 7d961faaa..2adf73dfa 100644
--- a/xmake/modules/private/service/remote_build/session.lua
+++ b/xmake/modules/private/service/remote_build/session.lua
@@ -76,6 +76,7 @@ end
-- reset sourcedir
function session:_reset_sourcedir()
+ vprint("%s: reset %s", self, self:sourcedir())
-- init sourcedir first if .git not exists
local sourcedir = self:sourcedir()
@@ -86,8 +87,17 @@ function session:_reset_sourcedir()
git.init({repodir = sourcedir})
end
- -- checkout and reset branch
- -- TODO
+ -- reset the current branch
+ local branch = git.branch({repodir = sourcedir})
+ if branch then
+ git.clean({repodir = sourcedir, force = true, all = true})
+ git.reset({repodir = sourcedir, hard = true})
+ end
+end
+
+-- get working branch of the source directory
+function session:_source_branch()
+ return "remote_build"
end
function session:__tostring()