Skip to content
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

[content-init] Don't fail when origin is an empty repository #4337

Merged
merged 1 commit into from
May 28, 2021

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented May 28, 2021

Fixes #4335

Note: This is similar to the 'git stash -u' error when repositories are empty, so the fix is mostly a copy of:

out, err := p.Git.GitWithOutput(ctx, "stash", "push", "-u")
if err != nil {
var giterr git.OpFailedError
if errors.As(err, &giterr) && strings.Contains(giterr.Output, "You do not have the initial commit yet") {
// git stash push returns a non-zero exit code if the repository does not have a single commit.
// In this case that's not an error though, hence we don't want to fail here.

@jankeromnes jankeromnes marked this pull request as ready for review May 28, 2021 14:46
Copy link
Contributor

@csweichel csweichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jankeromnes jankeromnes merged commit 360176f into main May 28, 2021
@jankeromnes jankeromnes deleted the jx/fix-empty-repo-init branch May 28, 2021 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workspace fails initializing
2 participants