Skip to content

git_manager.rb:64: warning: conflicting chdir during another chdir block #10

@paulie4

Description

@paulie4

I was getting many of those chdir warnings. To stop them, I removed the surrounding Dir.chdir @git_path do so this:

      Dir.chdir @git_path do
        # This is fast, but only works on locally checked out branches
        `git show-ref --verify --quiet 'refs/heads/#{branch}'`
        return true if $?.exitstatus == 0

        # This is slow and will only get called for remote branches.
        result = `git ls-remote --heads origin 'refs/heads/#{branch}'`
        return result.strip.length != 0
      end

becomes this:

      # This is fast, but only works on locally checked out branches
      `git --git-dir #{@git_path}/.git show-ref --verify --quiet 'refs/heads/#{branch}'`
      return true if $?.exitstatus == 0

      # This is slow and will only get called for remote branches.
      result = `git --git-dir #{@git_path}/.git ls-remote --heads origin 'refs/heads/#{branch}'`
      return result.strip.length != 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions