summaryrefslogtreecommitdiff
path: root/internal/git/git.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-22 09:42:18 +0200
committerPaul Buetow <paul@buetow.org>2026-02-22 09:42:18 +0200
commitaa557d16f24a0a1fd8751ac702ea6bff7b5fa4aa (patch)
treedda9551537f088464694a213181cfc1d8ccb8004 /internal/git/git.go
parent830b314656b0353e6a52652b650b686edfefa97a (diff)
Implement git package with full test coverage incl Sync (task 355)
Diffstat (limited to 'internal/git/git.go')
-rw-r--r--internal/git/git.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/git/git.go b/internal/git/git.go
index 1680561..af4a394 100644
--- a/internal/git/git.go
+++ b/internal/git/git.go
@@ -72,6 +72,12 @@ func (g *Git) Sync(ctx context.Context, syncRepos []string) error {
// run executes a git command in the given directory, printing each line of
// combined stdout+stderr with a "> " prefix so the user can follow progress.
// It returns an error if the command exits with a non-zero status.
+//
+// Output is intentionally buffered: all output is captured into a bytes.Buffer
+// and printed only after the subprocess exits. This matches the Ruby reference
+// implementation (which uses backtick capture) and keeps the "> " prefix logic
+// simple. For long-running operations like git pull the user sees no output
+// until the command completes — an acceptable tradeoff for a personal tool.
func run(ctx context.Context, dir string, args ...string) error {
cmd := exec.CommandContext(ctx, args[0], args[1:]...)
cmd.Dir = dir