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

Temp clone of git remote branches are not in a repository #109

Closed
andrew-fennell opened this issue Dec 19, 2023 · 1 comment
Closed

Temp clone of git remote branches are not in a repository #109

andrew-fennell opened this issue Dec 19, 2023 · 1 comment
Labels
type:bug Something isn't working

Comments

@andrew-fennell
Copy link

There is an issue where remote branch configs cannot be loaded. After digging deeper into this issue, I found that there was a git command being ran, but it threw an error saying it was not in a git repository. This was in the /tmp/... directory created.

The issue seems to be that remote branches in git.py are created using the function copy_tree(gitroot, src, dst, reference, sourcepath="."), which creates the git repository shown in the following code:

with tempfile.SpooledTemporaryFile() as fp:
        cmd = (
            "git",
            "archive",
            "--format",
            "tar",
            reference.commit,
            "--",
            sourcepath,
        )
        subprocess.check_call(cmd, cwd=gitroot, stdout=fp)
        fp.seek(0)
        with tarfile.TarFile(fileobj=fp) as tarfp:
            tarfp.extractall(dst)

This ultimately causes this error to be thrown in main.py (line 245):

                   "Failed load config for %s from %s",
                   gitref.refname,
                   confpath,
               )

A simple fix would be to add git init right after the first code snippet in git.py.

cmd = (
        "git",
        "init"
    )
    subprocess.check_call(cmd, cwd=dst)
@BurningEnlightenment
Copy link
Member

Duplicate of #17

@BurningEnlightenment BurningEnlightenment marked this as a duplicate of #17 Oct 8, 2024
@BurningEnlightenment BurningEnlightenment closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
@github-project-automation github-project-automation bot moved this from Ready to Done in multiversion worklog Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants