From 131105d7fcf17cc25ce3f65e8223706d5387cd0a Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 7 Jan 2021 00:38:36 +0800 Subject: git clean all files for packages --- xmake/actions/require/impl/actions/download.lua | 4 ++-- xmake/modules/devel/git/clean.lua | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xmake/actions/require/impl/actions/download.lua b/xmake/actions/require/impl/actions/download.lua index 3db3e2da9..9a6dbbce8 100644 --- a/xmake/actions/require/impl/actions/download.lua +++ b/xmake/actions/require/impl/actions/download.lua @@ -40,7 +40,7 @@ function _checkout(package, url, sourcedir, url_alias) not (option.get("force") and package:branch()) then -- we need disable cache if we force to clone from the given branch -- clean the previous build files - git.clean({repodir = packagedir, force = true}) + git.clean({repodir = packagedir, force = true, all = true}) -- reset the previous modified files git.reset({repodir = packagedir, hard = true}) tty.erase_line_to_start().cr() @@ -50,7 +50,7 @@ function _checkout(package, url, sourcedir, url_alias) -- we can use local package from the search directories directly if network is too slow local localdir = find_directory(package:name() .. archive.extension(url), core_package.searchdirs()) if localdir and os.isdir(localdir) then - git.clean({repodir = localdir, force = true}) + git.clean({repodir = localdir, force = true, all = true}) tty.erase_line_to_start().cr() return end diff --git a/xmake/modules/devel/git/clean.lua b/xmake/modules/devel/git/clean.lua index 0f6c57e3f..ae21c3d88 100644 --- a/xmake/modules/devel/git/clean.lua +++ b/xmake/modules/devel/git/clean.lua @@ -56,6 +56,11 @@ function main(opt) table.insert(argv, "-f") end + -- remove all files and does not use the standard ignore rules + if opt.all then + table.insert(argv, "-x") + end + -- enter repository directory local oldir = nil if opt.repodir then -- cgit v1.3.1