Class GoalAuthoredChanges

java.lang.Object
network.ike.plugin.ws.GoalAuthoredChanges

public final class GoalAuthoredChanges extends Object
Commit only the paths a goal itself authored, safely — the reusable primitive behind the AuthoredCommit.IN_ISOLATION contract (IKE-Network/ike-issues#780). Generalized from PostMutationSync's workspace.yaml self-commit (IKE-Network/ike-issues#774).

Usage: snapshot the paths the goal is about to write, before it writes them; let the goal run; then commitAuthored. Only paths that were unmodified before the goal ran and were modified by it are committed — so a caller's concurrent WIP, a -DstagedOnly subset, work syncing in over Syncthing, or a not-yet-bootstrapped sibling's untracked state is never swept in. The helper never runs git add -A; it commits exact paths via VcsOperations.commitPaths(File, Log, String, String...).

  • Method Details

    • snapshot

      public static GoalAuthoredChanges snapshot(File root, org.apache.maven.api.plugin.Log log, String... paths)
      Snapshot, before the goal runs, which of paths are currently unmodified in the working tree. Only those become eligible to be committed in isolation later — a path that already carries a user or caller edit is excluded, so a later commit can never sweep that edit in.
      Parameters:
      root - the repository root directory
      log - Maven logger
      paths - the paths the goal intends to author, relative to root
      Returns:
      a snapshot to commitAuthored(String) after the goal has run
    • commitAuthored

      public boolean commitAuthored(String message)
      Commit, in isolation, exactly the snapshotted paths that were unmodified before the goal ran and have since been modified by it. A no-op (returns false) when no such path exists. A commit failure is logged at WARN and treated as a no-op rather than aborting the caller.
      Parameters:
      message - the commit message — a <type>: <summary> line plus a Refs: trailer; must not be null or blank
      Returns:
      true if a commit was made