summaryrefslogtreecommitdiff
path: root/xmake/modules/devel/git/lastcommit.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-08-29 21:56:52 +0800
committerruki <[email protected]>2021-08-29 21:56:52 +0800
commitab2c5e2a3b29bb63b23a7fa59c3f6d56cc56c47c (patch)
tree0d2324fcf8b215228a0c1ce49baed48b61b792cf /xmake/modules/devel/git/lastcommit.lua
parent4497dd33fb475a388d5d51192d432b0156be78a3 (diff)
improve git ops
Diffstat (limited to 'xmake/modules/devel/git/lastcommit.lua')
-rw-r--r--xmake/modules/devel/git/lastcommit.lua13
1 files changed, 1 insertions, 12 deletions
diff --git a/xmake/modules/devel/git/lastcommit.lua b/xmake/modules/devel/git/lastcommit.lua
index 876812f86..1ad6de1f4 100644
--- a/xmake/modules/devel/git/lastcommit.lua
+++ b/xmake/modules/devel/git/lastcommit.lua
@@ -57,21 +57,10 @@ function main(opt)
envs = {ALL_PROXY = proxy_conf}
end
- -- enter repository directory
- local oldir = nil
- if opt.repodir then
- oldir = os.cd(opt.repodir)
- end
-
-- get last commit
- local lastcommit = os.iorunv(git.program, argv, {envs = envs})
+ local lastcommit = os.iorunv(git.program, argv, {envs = envs, curdir = opt.repodir})
if lastcommit then
lastcommit = lastcommit:trim()
end
-
- -- leave repository directory
- if oldir then
- os.cd(oldir)
- end
return lastcommit
end