@@ -225,26 +225,24 @@ end
225225local get_depth = function (plugin )
226226if config .is_lockfile then
227227local info = lockfile .get (plugin .short_name )
228- return info .date and fmt (' --shallow-since="%s"' ,info .date )or ' --depth=999999'
228+ return info .date and fmt (' --shallow-since="%s"' ,info .date )or ' --depth=999999'
229229else
230230local depth = plugin .commit and 999999 or config .depth
231- return fmt (' --depth="%s"' ,depth )
231+ return fmt (' --depth="%s"' ,depth )
232232end
233233end
234234
235235git .setup = function (plugin )
236+ local depth_opt = get_depth (plugin )
236237local plugin_name = util .get_plugin_full_name (plugin )
237238local install_to = plugin .install_path
238- local install_cmd = vim .split (config .exec_cmd .. config .subcommands .install ,' %s+' )
239- install_cmd [# install_cmd + 1 ]= get_depth (plugin )
239+ local install_cmd = vim .split (config .exec_cmd .. config .subcommands .install .. depth_opt ,' %s+' )
240240
241241local submodule_cmd = config .exec_cmd .. config .subcommands .submodules
242242local rev_cmd = config .exec_cmd .. config .subcommands .get_rev
243243
244- local use_fetch = config .is_lockfile or plugin .commit or plugin .tag
245- local update_subcmd = use_fetch and config .subcommands .fetch or config .subcommands .update
246- local update_cmd = vim .split (config .exec_cmd .. update_subcmd ,' %s+' )
247- update_cmd [# update_cmd + 1 ]= get_depth (plugin )
244+ local fetch_cmd = vim .split (config .exec_cmd .. config .subcommands .fetch .. depth_opt ,' %s+' )
245+ local pull_cmd = vim .split (config .exec_cmd .. config .subcommands .update .. depth_opt ,' %s+' )
248246
249247local branch_cmd = config .exec_cmd .. config .subcommands .current_branch
250248local current_commit_cmd = vim .split (config .exec_cmd .. config .subcommands .get_header ,' %s+' )
@@ -441,6 +439,8 @@ git.setup = function(plugin)
441439
442440disp :task_update (plugin_name ,' pulling updates...' )
443441
442+ local commit = plugin .commit or get_lockfile_info (plugin ).commit
443+ local update_cmd = commit and fetch_cmd or pull_cmd
444444r
445445 :and_then (await ,jobs .run (update_cmd ,update_opts ))
446446 :and_then (await ,jobs .run (submodule_cmd ,update_opts ))