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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor how working, repository, and index directories are initialized #544

Merged
merged 1 commit into from Dec 20, 2021

Conversation

jcouball
Copy link
Member

@jcouball jcouball commented Dec 20, 2021

Signed-off-by: James Couball jcouball@yahoo.com

Your checklist for this pull request

馃毃Please review the guidelines for contributing to this repository.

  • Ensure all commits include DCO sign-off.
  • Ensure that your contributions pass unit testing.
  • Ensure that your contributions contain documentation if applicable.

Description

When opening a submodule or secondary working tree which exist in a directory different than the current directory, the command would fail. Fixes #541.

The logic for how to set working tree, repository, and index directories is scattered all over the place. This PR tries to centralize that logic.

The PR also fixes a bug where a new Git.init was creating a new bare repository in the .git directory of the given directory rather than directly in the given directory. That is the reason the tests needed to be changed.

Signed-off-by: James Couball <jcouball@yahoo.com>
@@ -45,8 +45,7 @@ def test_git_init
def test_git_init_bare
in_temp_dir do |path|
repo = Git.init(path, :bare => true)
assert(File.directory?(File.join(path, '.git')))
assert(File.exist?(File.join(path, '.git', 'config')))
assert(File.exist?(File.join(path, 'config')))
Copy link
Member Author

@jcouball jcouball Dec 20, 2021

Choose a reason for hiding this comment

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

Git.init should create the new, bare repository in the directory given by path and not in the .git subdirectory of path. This was a bug.

@@ -24,7 +24,7 @@ def test_git_init_bare
threads.each(&:join)

dirs.each do |dir|
Git.bare("#{dir}/.git").ls_files
Git.bare(dir).ls_files
Copy link
Member Author

Choose a reason for hiding this comment

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

Git.init should create the new, bare repository in the directory given by dir and not in the .git subdirectory of dir. This was a bug.

@jcouball jcouball merged commit 8feb4ff into master Dec 20, 2021
@jcouball jcouball deleted the refactor_initialization branch December 20, 2021 01:00
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.

Git open can't open a worktree checkout
1 participant