rubymem / bundler-leak

Known-leaky gems verification for bundler: `bundle leak` to check your app and find leaky gems in your Gemfile :gem::droplet:
https://www.rubymem.com
GNU General Public License v3.0
288 stars 11 forks source link

[BUG] Running bundle leak update produces warnings from git #52

Closed unikitty37 closed 1 year ago

unikitty37 commented 1 year ago

Before we start...:

Branch/Commit:

Release 0.3.0

Expected behaviour:

When I type bundle leak update, it should update without git warnings.

Actual behaviour:

I get the following output:

$ bundle leak update
Updating ruby-advisory-db ...
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
From https://github.com/rubysec/ruby-advisory-db
 * branch            master     -> FETCH_HEAD
Already up to date.

Could bundler-leak pass the appropriate flag? The update! method appears to be calling git fetch --all, and that doesn't accept --rebase — which make's git's output a bit baffling.

I'm running in Docker, so setting the git global config on the host machine won't help, and setting the local config would presumably have to be done on bundler-leak's internal copy, rather than the host project. I think it would be better for bundler-leak to be explicit here in any case.

(I suspect that most people not using Docker will have already set a global preference, and so won't have run into this…)

Steps to reproduce:

  1. Do not have a git configuration set for pull.rebase or pull.ff, either globally or on the project you're working on.
  2. Have a bundler-leak database that is out of date.
  3. Type bundle leak update

Context and environment:

Screenshots and Videos

n/a

Logs

n/a

ingemar commented 1 year ago

It works fine for me.

❯ bundle leak update

Updating ruby-mem-advisory-db ...
HEAD is now at 2248f54 Merge pull request #36 from rubymem/dependabot/bundler/nokogiri-1.13.9
Updated ruby-mem-advisory-db
ruby-mem-advisory-db: 14 advisories
unikitty37 commented 1 year ago

Hm — that's odd. I've tried to reproduce like this:

$ docker run -it --rm ruby:3.1.3-bullseye bash
# gem install -v 6.1.7 rails
…
# git config -l
# rails new --api testapp
…
# cd testapp
# bundle add -g development bundler-leak
# bundle leak update

…and I can't reproduce it there either. I'm guessing that something had happened to my local database that was causing git to throw the warnings, but a successful pull means the issue won't happen again.

Thanks for taking a look.