Skip to content

Feature: Remote Operations (clone, fetch, pull, push) #5

@BishopMowle

Description

@BishopMowle

Overview

Implement remote operations to enable ts-git to interact with remote repositories, matching isomorphic-git feature parity.

Commands to Implement

  • clone - Clone a repository from a remote URL
  • fetch - Fetch commits from a remote repository
  • pull - Fetch and merge commits from a remote
  • push - Push commits to a remote repository
  • addRemote - Add a new remote repository
  • deleteRemote - Remove a remote repository
  • getRemoteInfo - Get information about a remote
  • listRemotes - List all configured remotes

Acceptance Criteria (AC)

  1. AC1: Clone Functionality - Can clone a public repository from GitHub/Bitbucket via HTTPS
  2. AC2: Fetch Functionality - Can fetch refs and objects from a remote without merging
  3. AC3: Push Functionality - Can push local commits to a remote (with auth support for HTTPS)
  4. AC4: Remote Management - Can add, list, and delete remote configurations
  5. AC5: Pull Integration - Pull correctly fetches and merges/fast-forwards changes
  6. AC6: Type Safety - All functions have strict TypeScript types for parameters and return values

Definition of Done (DoD)

  • All commands implemented with error handling
  • Unit tests with >80% coverage
  • Interop tests passing (see below)
  • Documentation in README.md
  • No TypeScript errors or warnings

Interop Test Method

Create interoperability tests that compare ts-git output with canonical git CLI:

// Test clone
await tsGit.clone({ fs, http, dir: '/tmp/test-clone', url: 'https://github.com/octocat/Hello-World.git', depth: 1 });
const tsGitLog = await tsGit.log({ fs, dir: '/tmp/test-clone', depth: 1 });

// Compare with canonical git
execSync('git clone --depth 1 https://github.com/octocat/Hello-World.git /tmp/ref-clone');
const refLog = execSync('git -C /tmp/ref-clone log --oneline -1').toString();

// Assertions: tsGitLog[0].oid should match ref commit hash

Validation Strategy:

  1. Clone same repo with ts-git and canonical git
  2. Compare commit hashes, tree structure, and file contents
  3. Push to test remote and verify with canonical git
  4. Test error cases: auth failures, 404s, network errors

Priority

High - Core functionality for distributed version control

Dependencies

  • Requires HTTP client abstraction (HttpClient interface)
  • May require authentication token support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions