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

Use bare clones for git cloner #421

Merged
merged 1 commit into from
Aug 13, 2021
Merged

Use bare clones for git cloner #421

merged 1 commit into from
Aug 13, 2021

Conversation

bufdev
Copy link
Member

@bufdev bufdev commented Aug 13, 2021

Fixes #419. The issue was caused when a user's default git branch name that would get checked out during init would be the same branch as they attempt to fetch with branch=, because git would refuse to update the checked out HEAD. By switching to a bare init, we don't have any ref checked out during fetch and this issue isnt possible. As a side effect of switching to a bare init, we can't checkout in the same dir as we fetch so use a separate worktree dir.

Verified that the flags work going back to with git 2.10 (Sept 2016)

@bufdev bufdev merged commit 503f631 into main Aug 13, 2021
@bufdev bufdev deleted the bare-clone branch August 13, 2021 17:41
robbertvanginkel added a commit that referenced this pull request Sep 23, 2021
This should fix #584.

Apparently the submodule subcommand does not support the --worktree argument, and needs to be run from a checked out worktree. By changing the first checkout to use git worktree (https://git-scm.com/docs/git-worktree, available since git 2.6.7) and the later submodules command to run in the new worktree, git submodules seems to be ok.

Verified this locally with git 2.10 (Sept 2016), similar to #421.
Monirul1 pushed a commit to Monirul1/buf that referenced this pull request Apr 30, 2023
Monirul1 pushed a commit to Monirul1/buf that referenced this pull request Apr 30, 2023
This should fix bufbuild#584.

Apparently the submodule subcommand does not support the --worktree argument, and needs to be run from a checked out worktree. By changing the first checkout to use git worktree (https://git-scm.com/docs/git-worktree, available since git 2.6.7) and the later submodules command to run in the new worktree, git submodules seems to be ok.

Verified this locally with git 2.10 (Sept 2016), similar to bufbuild#421.
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.

Error when checking breaking change against previous ref of current branch
1 participant