From 031ad9c3b5ab6b7a58c87ea6edbf9b4b87a498bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
Date: Wed, 18 Mar 2020 11:50:36 +0100
Subject: [PATCH] Use the legacy Gemfile/Gemfile.lock names in
 tooling/overcommit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is because when multiple versions of Bundler are installed (e.g.
1.17.3 and 2.1.4), Bundler will choose the 2.x version based on the
`gems.rb` / `gems.locked` file names but it chooses the 1.17.x version
if the we use the legacy `Gemfile` / `Gemfile.lock` file names.

For now, we'll use the legacy file names to be consistent with the main
`gitlab`'s `Gemfile.lock` and to avoid unexpected changes in the
working tree.

Signed-off-by: Rémy Coutable <remy@rymai.me>
---
 .overcommit.yml.example                          | 4 ++--
 doc/development/contributing/style_guides.md     | 2 +-
 tooling/overcommit/{gems.rb => Gemfile}          | 2 +-
 tooling/overcommit/{gems.locked => Gemfile.lock} | 0
 4 files changed, 4 insertions(+), 4 deletions(-)
 rename tooling/overcommit/{gems.rb => Gemfile} (68%)
 rename tooling/overcommit/{gems.locked => Gemfile.lock} (100%)

diff --git a/.overcommit.yml.example b/.overcommit.yml.example
index b957a8bbd2a7..4e6d084a95d4 100644
--- a/.overcommit.yml.example
+++ b/.overcommit.yml.example
@@ -15,8 +15,8 @@
 #
 # Uncomment the following lines to make the configuration take effect.
 
-# Make sure to run `cd tooling/overcommit && make && cd -`
-gemfile: 'tooling/overcommit/gems.rb'
+# Make sure to run `make -C tooling/overcommit`
+gemfile: 'tooling/overcommit/Gemfile'
 
 PostCheckout:
   BundleInstall:
diff --git a/doc/development/contributing/style_guides.md b/doc/development/contributing/style_guides.md
index 770726f45639..9a0b654f47fa 100644
--- a/doc/development/contributing/style_guides.md
+++ b/doc/development/contributing/style_guides.md
@@ -17,7 +17,7 @@ static analysis offenses before committing locally.
 In your GitLab source directory run:
 
 ```shell
-cd tooling/overcommit && make && cd -
+make -C tooling/overcommit
 ```
 
 Then before a commit is created, Overcommit will automatically check for
diff --git a/tooling/overcommit/gems.rb b/tooling/overcommit/Gemfile
similarity index 68%
rename from tooling/overcommit/gems.rb
rename to tooling/overcommit/Gemfile
index c563a23275a9..5525662e43e1 100644
--- a/tooling/overcommit/gems.rb
+++ b/tooling/overcommit/Gemfile
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-# Make sure to run `bundle install --gemfile=tooling/overcommit/gems.rb` when you update this file.
+# Make sure to run `make` (in this directory) when you update this file.
 source 'https://rubygems.org'
 
 gem 'overcommit'
diff --git a/tooling/overcommit/gems.locked b/tooling/overcommit/Gemfile.lock
similarity index 100%
rename from tooling/overcommit/gems.locked
rename to tooling/overcommit/Gemfile.lock
-- 
GitLab