From efda495e2951f60a73f696e8ed2c50211e2cde51 Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Tue, 25 Apr 2017 11:36:37 -0400 Subject: [PATCH] .git/safe is opt-in The idea behind the .git/safe is that I run it manually and explicitly after I trust the directoy and the team behind the project. Creating it as part of the setup script defeats the point of that. Doing so without explcitly telling the user comes across as sneaky, perhaps. (I do expect all devs to read setup scripts before running them -- but I also know that they do not!) Switch this script to inform the user that they have no `.git/safe` directory but might like to make one. The warning output looks like this: ``` ~/thoughtbot/suspenders/foo% ./bin/setup The Gemfile's dependencies are satisfied Database 'foo_development' already exists Database 'foo_test' already exists W, [2017-04-28T10:29:08.973415 #29958] WARN -- : [SKYLIGHT] [1.2.1] Running Skylight in development mode. No data will be reported until you deploy your app. (To disable this message for all local apps, run `skylight disable_dev_warning`.) fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]' -- enable_extension("plpgsql") -> 0.0081s -- create_table("delayed_jobs", {:force=>:cascade}) -> 0.0618s -- initialize_schema_migrations_table() -> 0.0019s -- enable_extension("plpgsql") -> 0.0208s -- create_table("delayed_jobs", {:force=>:cascade}) -> 0.0328s -- initialize_schema_migrations_table() -> 0.0008s ----------------------------------------------------------------------- -> When you trust this repo, remember to run: mkdir -p .git/safe ~/thoughtbot/suspenders/foo% ``` --- NEWS.md | 1 + templates/bin_setup | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 158cb6562..644c7f040 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ `master` +* No longer generate `mkdir -p .git/safe` as part of `bin/setup` * Update Bitters to 1.7 * Update Neat to 2.1 * Update Bourbon to 5.0.0.beta.8 diff --git a/templates/bin_setup b/templates/bin_setup index 6f1eb65fe..7610df89e 100644 --- a/templates/bin_setup +++ b/templates/bin_setup @@ -13,8 +13,12 @@ bundle check || bundle install # Set up database and add any development seed data bin/rails dev:prime -# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv -mkdir -p .git/safe +if [ ! -d .git/safe ] && echo $PATH | grep .git/safe > /dev/null; then + echo "-----------------------------------------------------------------------" + echo + echo "-> When you trust this repo, remember to run: mkdir -p .git/safe" + echo +fi # Only if this isn't CI # if [ -z "$CI" ]; then