Class WorkingSetResolver

java.lang.Object
network.ike.workspace.WorkingSetResolver

public final class WorkingSetResolver extends Object
Resolves the WorkingSet a working-tree workspace operation acts on, from a starting directory (IKE-Network/ike-issues#609, under #601).

Searches upward from the start directory for a workspace.yaml. When one is found, the working set is that workspace — its declared subprojects plus the workspace root. When none is found, the working set is the single repository at the start directory: a working set of one.

This is the single home for the "am I in a workspace, or a lone repo?" decision that working-tree goals otherwise each make for themselves — the scattered isWorkspaceMode() + bare-mode branches the migration in ike-issues#611 retires.

  • Field Details

    • MANIFEST_FILE

      public static final String MANIFEST_FILE
      The manifest file name searched for when walking up from a directory.
      See Also:
  • Method Details

    • resolve

      public static WorkingSet resolve(Path startDir)
      Resolve the working set from a starting directory.
      Parameters:
      startDir - the directory to resolve from (typically the CWD)
      Returns:
      a workspace working set when a workspace.yaml is found at or above startDir; otherwise the single-repository working set rooted at startDir
    • singleRepo

      public static WorkingSet singleRepo(Path dir)
      Build a single-repository working set rooted at dir, without searching for a manifest — a working set of one.
      Parameters:
      dir - the repository directory
      Returns:
      the single-repository working set