@@ -47,9 +47,11 @@ GitAdapter.bootstrap = {
4747GitAdapter .COMMIT_PRETTY_FMT = (
4848 " %H %P" -- Commit hash followed by parent hashes
4949 .. " %n%an" -- Author name
50- .. " %n%ad" -- Author date
51- .. " %n%ar" -- Author date relative
50+ .. " %n%at" -- Author date: UNIX timestamp
51+ .. " %n%ai" -- Author date: ISO (gives us timezone)
52+ .. " %n%ar" -- Author date: relative
5253 .. " %n..%D" -- Ref names
54+ .. " %n..%gd" -- Reflog selectors
5355 .. " %n..%s" -- Subject
5456 -- The leading dots here are only used for padding to ensure those lines
5557 -- won't ever be completetely empty. This way the lines will be
@@ -388,6 +390,7 @@ function GitAdapter:prepare_fh_options(log_options, single_file)
388390 o .first_parent and { " --first-parent" } or nil ,
389391 o .show_pulls and { " --show-pulls" } or nil ,
390392 o .reflog and { " --reflog" } or nil ,
393+ o .walk_reflogs and { " --walk-reflogs" } or nil ,
391394 o .all and { " --all" } or nil ,
392395 o .merges and { " --merges" } or nil ,
393396 o .no_merges and { " --no-merges" } or nil ,
451454--- @field time_offset string
452455--- @field rel_date string
453456--- @field ref_names string
457+ --- @field reflog_selector string
454458--- @field subject string
455459--- @field namestat string[]
456460--- @field numstat string[]
@@ -462,22 +466,23 @@ end
462466--- @return GitAdapter.LogData data
463467local function structure_fh_data (stat_data , keep_diff )
464468 local right_hash , left_hash , merge_hash = unpack (utils .str_split (stat_data [1 ]))
465- local time , time_offset = unpack ( utils .str_split (stat_data [3 ]))
469+ local time_offset = utils .str_split (stat_data [4 ])[ 3 ]
466470
467471 --- @type GitAdapter.LogData
468472 local ret = {
469473 left_hash = left_hash ~= " " and left_hash or nil ,
470474 right_hash = right_hash ,
471475 merge_hash = merge_hash ,
472476 author = stat_data [2 ],
473- time = tonumber (time ),
477+ time = tonumber (stat_data [ 3 ] ),
474478 time_offset = time_offset ,
475- rel_date = stat_data [4 ],
476- ref_names = stat_data [5 ] and stat_data [5 ]:sub (3 ) or " " ,
477- subject = stat_data [6 ] and stat_data [6 ]:sub (3 ) or " " ,
479+ rel_date = stat_data [5 ],
480+ ref_names = stat_data [6 ] and stat_data [6 ]:sub (3 ) or " " ,
481+ reflog_selector = stat_data [7 ] and stat_data [7 ]:sub (3 ) or " " ,
482+ subject = stat_data [8 ] and stat_data [8 ]:sub (3 ) or " " ,
478483 }
479484
480- local namestat , numstat = structure_stat_data (stat_data , 7 )
485+ local namestat , numstat = structure_stat_data (stat_data , 9 )
481486 ret .namestat = namestat
482487 ret .numstat = numstat
483488
@@ -486,26 +491,21 @@ local function structure_fh_data(stat_data, keep_diff)
486491 end
487492
488493 -- Soft validate the data
489- if (ret .merge_hash and (# namestat == 0 or # numstat == 0 )) or # namestat ~= # numstat then
490- -- Merge commits are likely to be missing stat data depending on the value
491- -- of `--diff-merges`.
492- ret .valid = false
493- else
494- ret .valid = # stat_data >= 6 and pcall (
495- vim .validate ,
496- {
497- left_hash = { ret .left_hash , " string" , true },
498- right_hash = { ret .right_hash , " string" },
499- merge_hash = { ret .merge_hash , " string" , true },
500- author = { ret .author , " string" },
501- time = { ret .time , " number" },
502- time_offset = { ret .time_offset , " string" },
503- rel_date = { ret .rel_date , " string" },
504- ref_names = { ret .ref_names , " string" },
505- subject = { ret .subject , " string" },
506- }
507- )
508- end
494+ ret .valid = # namestat == # numstat and pcall (
495+ vim .validate ,
496+ {
497+ left_hash = { ret .left_hash , " string" , true },
498+ right_hash = { ret .right_hash , " string" },
499+ merge_hash = { ret .merge_hash , " string" , true },
500+ author = { ret .author , " string" },
501+ time = { ret .time , " number" },
502+ time_offset = { ret .time_offset , " string" },
503+ rel_date = { ret .rel_date , " string" },
504+ ref_names = { ret .ref_names , " string" },
505+ reflog_selector = { ret .reflog_selector , " string" },
506+ subject = { ret .subject , " string" },
507+ }
508+ )
509509
510510 return ret
511511end
@@ -569,7 +569,6 @@ function GitAdapter:stream_fh_data(state)
569569 " gc.auto=0" ,
570570 " log" ,
571571 " --pretty=format:%x00%n" .. GitAdapter .COMMIT_PRETTY_FMT ,
572- " --date=raw" ,
573572 " --numstat" ,
574573 " --raw" ,
575574 state .prepared_log_opts .flags ,
@@ -649,7 +648,6 @@ function GitAdapter:stream_line_trace_data(state)
649648 " --color=never" ,
650649 " --no-ext-diff" ,
651650 " --pretty=format:%x00%n" .. GitAdapter .COMMIT_PRETTY_FMT ,
652- " --date=raw" ,
653651 state .prepared_log_opts .flags ,
654652 state .prepared_log_opts .rev_range ,
655653 " --"
@@ -772,6 +770,7 @@ function GitAdapter:file_history_options(range, paths, argo)
772770 { " first-parent" },
773771 { " show-pulls" },
774772 { " reflog" },
773+ { " walk-reflogs" , " g" },
775774 { " all" },
776775 { " merges" },
777776 { " no-merges" },
@@ -985,6 +984,7 @@ GitAdapter.file_history_worker = async.void(function(self, out_stream, opt)
985984 time_offset = new_data .time_offset ,
986985 rel_date = new_data .rel_date ,
987986 ref_names = new_data .ref_names ,
987+ reflog_selector = new_data .reflog_selector ,
988988 subject = new_data .subject ,
989989 diff = new_data .diff ,
990990 })
@@ -1028,10 +1028,9 @@ GitAdapter.fh_retry_commit = async.wrap(function(self, rev_arg, state, opt, call
10281028 " gc.auto=0" ,
10291029 " show" ,
10301030 " --pretty=format:" .. GitAdapter .COMMIT_PRETTY_FMT ,
1031- " --date=raw" ,
10321031 " --numstat" ,
10331032 " --raw" ,
1034- " --diff-merges=" .. ( opt . is_merge and " first-parent " or state .log_options .diff_merges ) ,
1033+ " --diff-merges=" .. state .log_options .diff_merges ,
10351034 (state .single_file and state .log_options .follow ) and " --follow" or nil ,
10361035 rev_arg ,
10371036 " --" ,
@@ -1849,6 +1848,7 @@ GitAdapter.flags = {
18491848 FlagOption (" -p" , " --first-parent" , " Follow only the first parent upon seeing a merge commit" ),
18501849 FlagOption (" -s" , " --show-pulls" , " Show merge commits the first introduced a change to a branch" ),
18511850 FlagOption (" -R" , " --reflog" , " Include all reachable objects mentioned by reflogs" ),
1851+ FlagOption (" -g" , " --walk-reflogs" , " Walk reflogs instead of the commit ancestry chain" ),
18521852 FlagOption (" -a" , " --all" , " Include all refs" ),
18531853 FlagOption (" -m" , " --merges" , " List only merge commits" ),
18541854 FlagOption (" -n" , " --no-merges" , " List no merge commits" ),
@@ -2055,6 +2055,7 @@ function GitAdapter:init_completion()
20552055 self .comp .file_history :put ({ " --first-parent" })
20562056 self .comp .file_history :put ({ " --show-pulls" })
20572057 self .comp .file_history :put ({ " --reflog" })
2058+ self .comp .file_history :put ({ " --walk-reflogs" , " -g" })
20582059 self .comp .file_history :put ({ " --all" })
20592060 self .comp .file_history :put ({ " --merges" })
20602061 self .comp .file_history :put ({ " --no-merges" })
0 commit comments