Skip to content

[gitalisk][repository] Add submodule support in gitalisk

Problem to Solve

The CoreGitaliskRepository needs the ability to detect submodules in a repository and list them.

Proposal

  1. Add get_submodules() method to CoreGitaliskRepository in Rust
  2. Implement submodule detection using git submodule status command
  3. Parse git submodule output to extract submodule path, URL, commit hash, and status information
  4. Handle repositories without submodules gracefully (return empty list)
  5. Expose method through NAPI bindings to Node.js as getSubmodules()
  6. Update TypeScript definitions with GitSubmodule type and method signature

Further Details

Acceptance Criteria:

  • Returns proper GitSubmodule objects with path, URL, commit hash, and status
  • Returns empty array for repositories without submodules
  • Handles invalid or corrupted submodule configurations gracefully
  • TypeScript definitions include proper GitSubmodule type structure
  • Test coverage for repositories with and without submodules

Implementation Notes:

  • Use git submodule status --porcelain for machine-readable output
  • Parse submodule status indicators (initialized, uninitialized, etc.)
  • Use git config -f .gitmodules --list for additional submodule metadata if needed
  • Handle edge cases like missing or corrupted .gitmodules files

Links / References