Skip to content

Commit 05fe98e

Browse files
committed
init: exit if bare repo clone fails
If 'GitHelper.CloneBareRepo()' fails, it returns an error. However, the 'init' command ignores this error and attempts to create a base bundle then fail. Update 'init' to instead exit with the error it receives from 'CloneBareRepo()'. Signed-off-by: Victoria Dye <[email protected]>
1 parent 5911f5d commit 05fe98e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/git-bundle-server/init.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ func (i *initCmd) Run(ctx context.Context, args []string) error {
5959
}
6060

6161
fmt.Printf("Cloning repository from %s\n", *url)
62-
gitHelper.CloneBareRepo(ctx, *url, repo.RepoDir)
62+
err = gitHelper.CloneBareRepo(ctx, *url, repo.RepoDir)
63+
if err != nil {
64+
return i.logger.Errorf(ctx, "failed to clone repository: %w", err)
65+
}
6366

6467
bundle := bundleProvider.CreateInitialBundle(ctx, repo)
6568
fmt.Printf("Constructing base bundle file at %s\n", bundle.Filename)

0 commit comments

Comments
 (0)