@@ -39,44 +39,40 @@ updater._cwd = vim.fn.stdpath("config")
3939--- @param callback function Handler to receive the list of versions
4040updater ._pull_tags = function (callback )
4141 local Job = require (" plenary.job" )
42- Job
43- :new ({
44- command = " git" ,
45- args = { " fetch" , " --tags" , " --all" },
46- cwd = updater ._cwd ,
47- on_exit = function (j , exit_code )
48- if exit_code ~= 0 then
49- callback (nil , " Error pulling tags... \n\n " .. vim .inspect (j .result ()))
50- end
51- callback (j :result ())
52- end ,
53- })
54- :start ()
42+ Job :new ({
43+ command = " git" ,
44+ args = { " fetch" , " --tags" , " --all" },
45+ cwd = updater ._cwd ,
46+ on_exit = function (j , exit_code )
47+ if exit_code ~= 0 then
48+ callback (nil , " Error pulling tags... \n\n " .. vim .inspect (j .result ()))
49+ end
50+ callback (j :result ())
51+ end ,
52+ }):start ()
5553end
5654
5755--- Gets the current commit sha or error
5856--- @param callback function (commit_sha , error_string )
5957updater ._get_commit_sha = function (callback )
6058 local Job = require (" plenary.job" )
6159
62- Job
63- :new ({
64- command = " git" ,
65- args = { " rev-parse" , " HEAD" },
66- on_exit = function (j , exit_code )
67- if exit_code ~= 0 then
68- callback (nil , " Error getting current commit... \n\n " .. vim .inspect (j :result ()))
69- return
70- end
71- local result = j :result ()
72- if # result == 1 then
73- callback (result [1 ])
74- else
75- callback (nil , " Error getting current commit... No output." )
76- end
77- end ,
78- })
79- :start ()
60+ Job :new ({
61+ command = " git" ,
62+ args = { " rev-parse" , " HEAD" },
63+ on_exit = function (j , exit_code )
64+ if exit_code ~= 0 then
65+ callback (nil , " Error getting current commit... \n\n " .. vim .inspect (j :result ()))
66+ return
67+ end
68+ local result = j :result ()
69+ if # result == 1 then
70+ callback (result [1 ])
71+ else
72+ callback (nil , " Error getting current commit... No output." )
73+ end
74+ end ,
75+ }):start ()
8076end
8177
8278--- Given a version string, checks if it's an alpha/beta version
@@ -116,25 +112,23 @@ end
116112--- @param callback function (version_tag , error_string )
117113updater ._get_last_version_for_commit = function (commit_sha , callback )
118114 local Job = require (" plenary.job" )
119- Job
120- :new ({
121- command = " git" ,
122- args = { " tag" , " -l" , " --sort" , " -version:refname" , " --merged" , commit_sha },
123- cwd = updater ._cwd ,
124- on_exit = function (j , exit_code )
125- if exit_code ~= 0 then
126- callback (nil , " Error getting current version... \n\n " .. vim .inspect (j :result ()))
127- return
128- end
129- local result = j :result ()
130- if # result > 0 then
131- callback (result [1 ])
132- else
133- callback (nil , " Error getting current version... No output." )
134- end
135- end ,
136- })
137- :start ()
115+ Job :new ({
116+ command = " git" ,
117+ args = { " tag" , " -l" , " --sort" , " -version:refname" , " --merged" , commit_sha },
118+ cwd = updater ._cwd ,
119+ on_exit = function (j , exit_code )
120+ if exit_code ~= 0 then
121+ callback (nil , " Error getting current version... \n\n " .. vim .inspect (j :result ()))
122+ return
123+ end
124+ local result = j :result ()
125+ if # result > 0 then
126+ callback (result [1 ])
127+ else
128+ callback (nil , " Error getting current version... No output." )
129+ end
130+ end ,
131+ }):start ()
138132end
139133
140134--- Gets the current version and the latest upstream version
@@ -255,25 +249,23 @@ end
255249--- @param callback function (branch_name , error )
256250updater ._get_branch_name = function (callback )
257251 local Job = require (" plenary.job" )
258- Job
259- :new ({
260- command = " git" ,
261- args = { " symbolic-ref" , " --short" , " -q" , " HEAD" },
262- cwd = updater ._cwd ,
263- on_exit = function (j , exit_code )
264- if exit_code ~= 0 then
265- callback (nil , " Error getting branch name... \n\n " .. vim .inspect (j :result ()))
266- return
267- end
268- local result = j :result ()
269- if # result > 0 then
270- callback (result [1 ])
271- else
272- callback (nil , " Error getting branch name... No output." )
273- end
274- end ,
275- })
276- :start ()
252+ Job :new ({
253+ command = " git" ,
254+ args = { " symbolic-ref" , " --short" , " -q" , " HEAD" },
255+ cwd = updater ._cwd ,
256+ on_exit = function (j , exit_code )
257+ if exit_code ~= 0 then
258+ callback (nil , " Error getting branch name... \n\n " .. vim .inspect (j :result ()))
259+ return
260+ end
261+ local result = j :result ()
262+ if # result > 0 then
263+ callback (result [1 ])
264+ else
265+ callback (nil , " Error getting branch name... No output." )
266+ end
267+ end ,
268+ }):start ()
277269end
278270
279271--- Entry point for `:DoomUpdate`, fetches new tags, compares with current version and attempts to merge new tags into current branch
0 commit comments