Skip to content

--set always sets lastmodified, even when no change made #939

@scalen

Description

@scalen

Context

I am trying to make automated changes to a large YAML file encrypted with SOPS stored in Git. Often, these changes are essentially No-Ops, i.e. the data I am setting is the same as the data already present. In order to prevent the file changing on every write due to rotating data keys, I am using --set to update the values in place.

Problem

Even when none of the raw keys has been changed, the sops->lastmodified field is updated to the time at which sops --set was called. This means there is always a delta for this file, albeit much smaller than it would be if I were writing it fresh each time. However, any delta will cause Git to store a new copy of the whole file, still leading to a massively bloated repository.

Proposed Solution

The behaviour of --set should be the same as that of interactive editing: If no material change has been made, do not re-encrypt or write the file. This will implicitly prevent the updating of the lastmodified field.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions