diff options
| -rw-r--r-- | lib/dependabot/cli/scan.rb | 2 | ||||
| -rw-r--r-- | lib/dependabot/git.rb | 7 |
2 files changed, 3 insertions, 6 deletions
diff --git a/lib/dependabot/cli/scan.rb b/lib/dependabot/cli/scan.rb index 6f5c3d5..e112014 100644 --- a/lib/dependabot/cli/scan.rb +++ b/lib/dependabot/cli/scan.rb @@ -45,10 +45,12 @@ module Dependabot def git_for(dependency, branch_name: branch_name_for(dependency)) git = ::Dependabot::Git.new(dependency.path.parent) + default_branch = git.repo.head.name git.checkout(branch: branch_name) yield git ensure git.repo.checkout_head(strategy: :force) + git.repo.checkout(default_branch) end end end diff --git a/lib/dependabot/git.rb b/lib/dependabot/git.rb index fc1a9d9..1885480 100644 --- a/lib/dependabot/git.rb +++ b/lib/dependabot/git.rb @@ -34,12 +34,7 @@ module Dependabot private def stage(path) - repo.index.read_tree(repo.head.target.tree) - repo.index.add( - path: path, - oid: repo.write(File.binread(path), :blob), - mode: File.stat(path).mode - ) + repo.index.add(path) end end end |
