This commit fixes how gittuf rsl log loads RSL entries to print.
Earlier, all entries were loaded into memory first and then printed.
This commit switches over to a buffered write approach, meaning the user
starts seeing output right away.
Signed-off-by: Aditya Sirish <aditya@saky.in>
Co-authored-by: Hao Tran <haoanhtran7@gmail.com>
The RSL entry creation flow checks to see if the latest entry for the
reference being pushed has the same target ID as the proposed new entry.
This check should be optional, depending on how the entry is created.
When created using the "gittuf rsl record" command, the check should be
performed by default. But when created using the git-remote-gittuf
transport, the check is superfluous: the push is happening and an extra
entry recording the push happened is better. This also speeds up the RSL
entry creation for a new branch via the transport, as looking for an
existing RSL entry for the branch in question is expensive (the entire
RSL history must be checked).
Signed-off-by: Aditya Sirish <aditya@saky.in>
This commit adds ReconcileLocalRSLWithRemote, which checks the local RSL
against the specified remote and reconciles the local RSL if needed. If
the local RSL doesn't exist or is strictly behind the remote RSL, then
the local RSL is updated to match the remote RSL. If the local RSL is
ahead of the remote RSL, nothing is updated. Finally, if the local and
remote RSLs have diverged, then the local only RSL entries are reapplied
over the latest entries in the remote if the local only RSL entries and
remote only entries are for different Git references.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This commit has gittuf check if signing using the user's
signing key (specified in the git configuration) is possible
for commands that require this. This is done by way of a
function in cmd/common/common.go, called in commands' PreRunE.
Signed-off-by: Pat Zielinski <70954403+patzielinski@users.noreply.github.com>
The CLI package checks if gittuf is in eval mode before invoking
functions that are not meant for regular use. This commit also adds the
gated invocation for the first eval function, the ability to record an
RSL entry for non-latest commits in a ref.
Signed-off-by: Aditya Sirish <aditya@saky.in>