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

Empty artifacts after the libgit2 upgrade to 1.3.0 #588

Closed
stefanprodan opened this issue Feb 22, 2022 · 2 comments · Fixed by #589
Closed

Empty artifacts after the libgit2 upgrade to 1.3.0 #588

stefanprodan opened this issue Feb 22, 2022 · 2 comments · Fixed by #589
Labels
area/git Git related issues and pull requests bug Something isn't working

Comments

@stefanprodan
Copy link
Member

After upgrading my cluster to the latest build from main ghcr.io/fluxcd/source-controller:rc-b65cf9d5, using gitImplementation: libgit2 with both https and ssh result in empty artifacts. I think this bug was introduced in #573

@stefanprodan stefanprodan added bug Something isn't working area/git Git related issues and pull requests labels Feb 22, 2022
@hiddeco
Copy link
Member

hiddeco commented Feb 22, 2022

Above issue is just for branches, and also the single test scenario in which we lacked a confirmation on Artifact size.

@hiddeco
Copy link
Member

hiddeco commented Feb 22, 2022

After cloning and checking out the Git repository, something seems to alter the state of the folder on the FS, making Git itself think that files have been removed:

$ cd /tmp/test3946352686
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        deleted:    branch

If you explicitly check out the resolved HEAD reference using checkoutDetachedHEAD (as used by others) in CheckoutBranch#Checkout, this seems to revert the changes:

...
	cc, err := repo.LookupCommit(head.Target())
	if err != nil {
		return nil, fmt.Errorf("could not find commit '%s' in branch '%s': %w", head.Target(), c.Branch, err)
	}
	defer cc.Free()
	ccc, err := checkoutDetachedHEAD(repo, cc.Id())
	if err != nil {
		return nil, fmt.Errorf("failed to checkout head")
	}
	return buildCommit(ccc, "refs/heads/"+c.Branch), nil

This gives me gut feeling that the the CheckoutBranch flag from CloneOptions either broke, or changed behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/git Git related issues and pull requests bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants