git/rev_list_scanner: add --date-order
This commit is contained in:
parent
1411026b7b
commit
b1c5fe3547
@ -37,6 +37,9 @@ const (
|
||||
// results as given by git-rev-list(1) without any `--<t>-order`
|
||||
// argument given. By default: reverse chronological order.
|
||||
DefaultRevListOrder RevListOrder = iota
|
||||
// DateRevListOrder gives the revisions such that no parents are shown
|
||||
// before children, and otherwise in commit timestamp order.
|
||||
DateRevListOrder
|
||||
)
|
||||
|
||||
// ScanRefsOptions is an "options" type that is used to configure a scan
|
||||
@ -183,6 +186,11 @@ func revListArgs(l, r string, opt *ScanRefsOptions) (io.Reader, []string, error)
|
||||
var stdin io.Reader
|
||||
args := []string{"rev-list", "--objects"}
|
||||
|
||||
switch opt.Order {
|
||||
case DateRevListOrder:
|
||||
args = append(args, "--date-order")
|
||||
}
|
||||
|
||||
switch opt.Mode {
|
||||
case ScanRefsMode:
|
||||
if opt.SkipDeletedBlobs {
|
||||
|
@ -107,6 +107,13 @@ func TestRevListArgs(t *testing.T) {
|
||||
},
|
||||
ExpectedErr: "unknown scan type: -1",
|
||||
},
|
||||
"scan date order": {
|
||||
Left: "left", Right: "right", Opt: &ScanRefsOptions{
|
||||
Mode: ScanRefsMode,
|
||||
Order: DateRevListOrder,
|
||||
},
|
||||
ExpectedArgs: []string{"rev-list", "--objects", "--date-order", "--do-walk", "left", "right", "--"},
|
||||
},
|
||||
} {
|
||||
t.Run(desc, c.Assert)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user