diff options
| author | mo khan <mo@mokhan.ca> | 2021-12-19 20:50:59 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2021-12-19 20:50:59 -0700 |
| commit | 7747c95e17682ba54e3dbeda1c48b779b1115f0e (patch) | |
| tree | aabfa003bdde3540aba3b02defe8463f98e7a530 | |
| parent | bdd00a99e2ced95277b112e45de57d9a17c4e363 (diff) | |
fix: checkout default branchv0.1.5
| -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 |
