summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-29 20:29:52 -0600
committermo khan <mo@mokhan.ca>2025-07-29 20:29:55 -0600
commit16c41b7f56dabd97b8eb68f9d3b424e837f3f6ef (patch)
tree22ab35b647a9a970d709383b4330bdc76ec114c2
parentf2b1fd047991a8e5fb1ef22755884eb9546f6fd2 (diff)
fix: use --git-dir
-rw-r--r--internal/storage/git_cmd_adapter.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/storage/git_cmd_adapter.go b/internal/storage/git_cmd_adapter.go
index cec730f..e27fa5f 100644
--- a/internal/storage/git_cmd_adapter.go
+++ b/internal/storage/git_cmd_adapter.go
@@ -44,18 +44,18 @@ func (g *GitCmdAdapter) GetObject(ctx context.Context, repo, objectID string) ([
}
// Get object type first
- typeCmd := exec.CommandContext(ctx, "git", "-C", repoPath, "cat-file", "-t", objectID)
+ typeCmd := exec.CommandContext(ctx, "git", "--git-dir", repoPath, "cat-file", "-t", objectID)
typeOutput, err := typeCmd.Output()
if err != nil {
return nil, fmt.Errorf("git cat-file -t failed for %s: %w", objectID, err)
}
objType := strings.TrimSpace(string(typeOutput))
- // Get object content using -p (pretty-print) which gives the content as stored
- contentCmd := exec.CommandContext(ctx, "git", "-C", repoPath, "cat-file", "-p", objectID)
+ // Get raw object content using type and objectID
+ contentCmd := exec.CommandContext(ctx, "git", "--git-dir", repoPath, "cat-file", objType, objectID)
content, err := contentCmd.Output()
if err != nil {
- return nil, fmt.Errorf("git cat-file -p failed for %s: %w", objectID, err)
+ return nil, fmt.Errorf("git cat-file failed for %s: %w", objectID, err)
}
// Format as Git object: "type size\0content"
@@ -71,7 +71,7 @@ func (g *GitCmdAdapter) GetReachableObjects(ctx context.Context, repo string, wa
}
// Use git rev-list to get all reachable objects
- args := []string{"-C", repoPath, "rev-list", "--objects"}
+ args := []string{"--git-dir", repoPath, "rev-list", "--objects"}
args = append(args, wants...)
// Exclude objects reachable from haves
@@ -120,7 +120,7 @@ func (g *GitCmdAdapter) ensureRepository(ctx context.Context, repo string) (stri
}
// Download all repository files from S3 with timeout
- downloadCtx, cancel := context.WithTimeout(ctx, 60*time.Second)
+ downloadCtx, cancel := context.WithTimeout(ctx, 300*time.Second)
defer cancel()
err = g.downloadRepositoryFromS3(downloadCtx, repo, repoPath)