|
@@ -32,20 +32,20 @@ local function git_cmd(opts)
|
|
Log:debug(stdout)
|
|
Log:debug(stdout)
|
|
end
|
|
end
|
|
|
|
|
|
- return ret, stdout
|
|
|
|
|
|
+ return ret, stdout, stderr
|
|
end
|
|
end
|
|
|
|
|
|
local function safe_deep_fetch()
|
|
local function safe_deep_fetch()
|
|
- local ret, result = git_cmd { args = { "rev-parse", "--is-shallow-repository" } }
|
|
|
|
|
|
+ local ret, result, error = git_cmd { args = { "rev-parse", "--is-shallow-repository" } }
|
|
if ret ~= 0 then
|
|
if ret ~= 0 then
|
|
- Log:error "Git fetch failed! Check the log for further information"
|
|
|
|
|
|
+ Log:error(vim.inspect(error))
|
|
return
|
|
return
|
|
end
|
|
end
|
|
-- git fetch --unshallow will cause an error on a a complete clone
|
|
-- git fetch --unshallow will cause an error on a a complete clone
|
|
local fetch_mode = result[1] == "true" and "--unshallow" or "--all"
|
|
local fetch_mode = result[1] == "true" and "--unshallow" or "--all"
|
|
ret = git_cmd { args = { "fetch", fetch_mode } }
|
|
ret = git_cmd { args = { "fetch", fetch_mode } }
|
|
if ret ~= 0 then
|
|
if ret ~= 0 then
|
|
- Log:error "Git fetch failed! Check the log for further information"
|
|
|
|
|
|
+ Log:error("Git fetch failed! Please pull the changes manually in " .. get_lvim_base_dir())
|
|
return
|
|
return
|
|
end
|
|
end
|
|
return true
|
|
return true
|
|
@@ -55,12 +55,12 @@ end
|
|
function M.update_base_lvim()
|
|
function M.update_base_lvim()
|
|
Log:info "Checking for updates"
|
|
Log:info "Checking for updates"
|
|
|
|
|
|
- local ret = git_cmd { args = { "fetch" } }
|
|
|
|
- if ret ~= 0 then
|
|
|
|
- Log:error "Update failed! Check the log for further information"
|
|
|
|
|
|
+ if not safe_deep_fetch() then
|
|
return
|
|
return
|
|
end
|
|
end
|
|
|
|
|
|
|
|
+ local ret
|
|
|
|
+
|
|
ret = git_cmd { args = { "diff", "--quiet", "@{upstream}" } }
|
|
ret = git_cmd { args = { "diff", "--quiet", "@{upstream}" } }
|
|
if ret == 0 then
|
|
if ret == 0 then
|
|
Log:info "LunarVim is already up-to-date"
|
|
Log:info "LunarVim is already up-to-date"
|
|
@@ -69,7 +69,7 @@ function M.update_base_lvim()
|
|
|
|
|
|
ret = git_cmd { args = { "merge", "--ff-only", "--progress" } }
|
|
ret = git_cmd { args = { "merge", "--ff-only", "--progress" } }
|
|
if ret ~= 0 then
|
|
if ret ~= 0 then
|
|
- Log:error "Update failed! Please pull the changes manually instead."
|
|
|
|
|
|
+ Log:error("Update failed! Please pull the changes manually in " .. get_lvim_base_dir())
|
|
return
|
|
return
|
|
end
|
|
end
|
|
|
|
|