-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve informational printouts in update-all
and update
#37
Conversation
08d9f47
to
b35e365
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent. Thanks for the fast turnaround here. Nice to see your investment in these interfaces paying off.
cmd/git-bundle-server/update-all.go
Outdated
cmd := exec.Command(exe, subargs...) | ||
cmd.Stderr = os.Stderr | ||
cmd.Stdout = os.Stdout | ||
|
||
err := cmd.Start() | ||
if err != nil { | ||
return u.logger.Errorf(ctx, "git command failed to start: %w", err) | ||
} | ||
|
||
err = cmd.Wait() | ||
exitCode, err := commandExecutor.RunStdout(ctx, exe, subargs...) | ||
if err != nil { | ||
return u.logger.Errorf(ctx, "git command returned a failure: %w", err) | ||
return u.logger.Error(ctx, err) | ||
} else if exitCode != 0 { | ||
return u.logger.Errorf(ctx, "git-bundle-server update exited with status %d", exitCode) | ||
} | ||
fmt.Print("\n") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a bonus, the refactored code is much clearer about what is happening.
Update 'update-all.go' to use 'common.FileSystem' to get the path to the 'git-bundle-server' executable, and use 'cmd.CommandExecutor' to call 'git-bundle-server update'. The use of the common structures eliminate some duplicate code as well as set up the command to be unit testable in the future. Signed-off-by: Victoria Dye <vdye@github.com>
Add and update informational printouts in 'git-bundle-server update' to inform users more accurately of which step is in progress, as well as clearly indicate when the update stops early due to a lack of updates from the remote. Also add a printout to 'update-all' indicating which route is being updated at a given time as it loops through all routes. Signed-off-by: Victoria Dye <vdye@github.com>
b35e365
to
ff93dbc
Compare
Part of #35
This pull request is a fairly light refactor of
update-all.go
(replacing direct usage of theexec
core library withcmd.CommandExecutor
) + some slightly more informative logging in bothupdate-all
andupdate
.