diff

package
v0.0.0-...-1bb7c6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package diff implements the diff function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(ctx context.Context, original, updated *models.Signature) (*models.Delta, error)

Compare compares the original and updated signatures and returns a Delta struct containing the differences between the two.

1. Creates a new Delta struct and initializes its fields with empty slices and a map. 2. Compares the number of chunks in the original and updated signatures. If they are not the same, it assumes that the entire file has been modified and sets the Modified field of the Delta struct to the Chunks field of the updated signature. 3. If the number of chunks is the same, it compares the rolling hash values of each chunk using a for loop. If the hash values are different, it assumes that the chunk has been modified and adds it to the Modified field of the Delta struct. 4. Returns the Delta pointer and a nil error value if successful, or returns a nil pointer and an error value if there was an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL