mirror of
https://github.com/zrepl/zrepl.git
synced 2025-02-02 03:29:13 +01:00
zfs: FilesystemDiff: support empty left list = no common ancestor
This commit is contained in:
parent
cd8796aed4
commit
d0c0e2510b
11
zfs/diff.go
11
zfs/diff.go
@ -138,6 +138,17 @@ func ZFSListFilesystemVersions(fs DatasetPath) (res []FilesystemVersion, err err
|
|||||||
// names are unique (bas ZFS_PROP_GUID replacement)
|
// names are unique (bas ZFS_PROP_GUID replacement)
|
||||||
func MakeFilesystemDiff(left, right []FilesystemVersion) (diff FilesystemDiff) {
|
func MakeFilesystemDiff(left, right []FilesystemVersion) (diff FilesystemDiff) {
|
||||||
|
|
||||||
|
if right == nil {
|
||||||
|
panic("right must not be nil")
|
||||||
|
}
|
||||||
|
if left == nil { // treat like no common ancestor
|
||||||
|
diff = FilesystemDiff{
|
||||||
|
IncrementalPath: nil,
|
||||||
|
Diverged: false,
|
||||||
|
MRCAPathRight: right,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Assert both left and right are sorted by createtxg
|
// Assert both left and right are sorted by createtxg
|
||||||
var leftSorted, rightSorted fsbyCreateTXG
|
var leftSorted, rightSorted fsbyCreateTXG
|
||||||
leftSorted = left
|
leftSorted = left
|
||||||
|
Loading…
Reference in New Issue
Block a user