Skip to content

Checking out branches containing slashes broken since 1.15.0? #647

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

Closed
alexjfisher opened this issue Mar 6, 2023 · 5 comments · Fixed by #651
Closed

Checking out branches containing slashes broken since 1.15.0? #647

alexjfisher opened this issue Mar 6, 2023 · 5 comments · Fixed by #651

Comments

@alexjfisher
Copy link

Checking out branches containing slashes broken since 1.15.0?

I'm using a project called pdksync and today have found that I need to pin the git dependency to 1.14.0 or my pipelines fail.
Looks like its failing when trying to create a commit in a new branch because the branch name contains a slash?

Your environment

  • Tested with git 2.36.4 and ruby-git 1.15.0 and 1.17.0
  • ruby 2.7

Steps to reproduce

require 'test_helper'
class TestRegression < Test::Unit::TestCase
  test 'this still works' do
    in_temp_dir do
      git = Git.init('.', initial_branch: 'master')
      File.write('file1.txt', 'file1')
      git.add('file1.txt')
      git.commit('commit1')
      assert_nothing_raised { git.branch('a_new_branch').checkout }
    end
  end

  test 'this does not work since 1.15.0' do
    in_temp_dir do
      git = Git.init('.', initial_branch: 'master')
      File.write('file1.txt', 'file1')
      git.add('file1.txt')
      git.commit('commit1')
      assert_nothing_raised { git.branch('foo/a_new_branch').checkout }
    end
  end
end

Expected behaviour

Both tests to pass.

Actual behaviour

The second test fails.

@alexjfisher
Copy link
Author

My guess is that this is related to the fix for #600

@jcouball
Copy link
Member

jcouball commented Mar 6, 2023

Thank you @alexjfisher, I will fix asap.

@jcouball
Copy link
Member

jcouball commented Mar 6, 2023

The failing test is a big help! Thanks for that!

@jcouball
Copy link
Member

jcouball commented Mar 7, 2023

@alexjfisher I just pushed git-1.17.2 with this fix to rubygems.org.

@alexjfisher
Copy link
Author

@jcouball Thanks! I've tested this, and confirm that it fixes the issue I was having with pdksync.

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 a pull request may close this issue.

2 participants