Skip to content

Prevent situations where Git LS files are added but not properly committed or pushed (workflow/committed-vs-pushed) #16

@bwalsh

Description

@bwalsh

Title:

Current: Check to ensure all LFS files are committed and pushed, use drs (indexd) as system-of-record for file info

  • PRO:
    • clean separation of concerns
  • CON:
    • tags and meta data occur in different commit, push cycle than lfs files
    • user training, adapt expectations of git workflow (tagging and meta data happens after file push)

Alternative: Check all git lfs added files are committed, add tags to local, temporary drs directory. Use combination of local drs directory and drs server info for tagging and metadata initialization

  • PRO:
    • tags and meta occur in same git workflow, no user expectation management/training
  • CON:
    • same logic spread across git-drs, add-tag, and meta init/validate

Description:

We should add a safeguard to prevent situations where Git LFS files are added but not properly committed or pushed. This can lead to broken DRS manifests, missing metadata, or confusing behavior for collaborators.


Current Solution:

Implement a script or pre-push CI check that verifies:

  1. All LFS-tracked files that are added (git add) are also committed.

    • Detect staged but uncommitted LFS files using:

      git lfs ls-files --cached
    • If any files are staged but not yet committed, block the [push, add-link, or meta init] and print a clear error.

  2. All LFS-tracked files in commits are pushed to the remote.

    • Use git lfs status to detect LFS objects pending push.
    • If any LFS objects are pending, block the [add-link, or meta init] and print a clear warning.

Optional Enhancements:

  • Integrate this check into:

    • Pre-push Git hook
    • CI workflows (e.g., GitHub Actions)
  • Print helpful instructions if failures are detected (e.g., reminder to run git lfs push).


References:


Acceptance Criteria:

  • Attempting to push with uncommitted LFS files triggers a warning or blocks the push.
  • Attempting to push with LFS objects pending upload triggers a warning or blocks the push.
  • Documentation is added describing the new check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions