@@ -129,44 +129,47 @@ end
129129
130130--- Git file status for an absolute path with optional fallback
131131--- @param parent_ignored boolean
132- --- @param status table | nil
132+ --- @param status table ?
133133--- @param path string
134134--- @param path_fallback string ?
135135--- @return GitStatus
136136function M .git_status_file (parent_ignored , status , path , path_fallback )
137- if parent_ignored then
138- return { file = " !!" }
139- end
137+ --- @type GitStatus
138+ local st = {}
140139
141- if not status or not status .files then
142- return {}
140+ if parent_ignored then
141+ st .file = " !!"
142+ elseif status and status .files then
143+ st .file = status .files [path ] or status .files [path_fallback ]
143144 end
144145
145- return {
146- file = status .files [path ] or status .files [path_fallback ]
147- }
146+ return st
148147end
149148
150149--- Git file and directory status for an absolute path with optional file fallback
151150--- @param parent_ignored boolean
152- --- @param status table | nil
151+ --- @param status table ?
153152--- @param path string
154153--- @param path_file string ? alternative file path when no other file status
155- --- @return GitStatus | nil
154+ --- @return GitStatus ?
156155function M .git_status_dir (parent_ignored , status , path , path_file )
156+ --- @type GitStatus ?
157+ local st
158+
157159 if parent_ignored then
158- return { file = " !!" }
160+ st = {}
161+ st .file = " !!"
162+ elseif status then
163+ st = {}
164+ st .file = status .files and (status .files [path ] or status .files [path_file ])
165+ if status .dirs then
166+ st .dir = {}
167+ st .dir .direct = status .dirs .direct and status .dirs .direct [path ]
168+ st .dir .indirect = status .dirs .indirect and status .dirs .indirect [path ]
169+ end
159170 end
160171
161- if status then
162- return {
163- file = status .files and (status .files [path ] or status .files [path_file ]),
164- dir = status .dirs and {
165- direct = status .dirs .direct and status .dirs .direct [path ],
166- indirect = status .dirs .indirect and status .dirs .indirect [path ],
167- },
168- }
169- end
172+ return st
170173end
171174
172175function M .setup (opts )
0 commit comments