From 8db3cdabf865392bdf3734a3cc0803bdbd045a09 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 12 Apr 2022 23:05:38 +0800 Subject: reset files --- xmake/modules/private/service/remote_build/session.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'xmake/modules/private') 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() -- cgit v1.3.1