Skip to content

Cloning repo has unexpected packfile permissions #588

@EbonJaeger

Description

@EbonJaeger

I am trying to use this to fetch sources to use in building packages for a Linux distribution, meaning that the cloned sources need to be copied, generally within a chroot with fakeroot.

Cloning a repo sets the pack file permissions in .git/objects/pack to -rw-------. When the packaging tool then tries to copy the cloned source to the work directory, it cannot because of missing permissions. Doing the same operation with git yields packfiles with read set for everyone.

Is this an issue with go-git, or am I doing something wrong?

cloneOpts := git.CloneOptions{
    URL:               uri,
    Depth:             1,
    RecurseSubmodules: git.DefaultSubmoduleRecursionDepth,
    Progress:          os.Stdout,
}

git.PlainClone(clonePath, false, &cloneOpts)

This holds true in a simple test program that clones into /tmp without any elevated permissions. I am using version 5.4.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingno-autocloseIssues/PRs to be ignored by stale bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions