aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2012-08-01 15:56:52 -0400
committerMax Howell2012-08-01 15:59:30 -0400
commitb51fe2241383130324ebc291e8d48855b14737cc (patch)
treec84ae857a9ee5e050e15ff0be8a055fa44242671
parent148617bc1164c919eda86403ce2df197b913cdde (diff)
downloadbrew-b51fe2241383130324ebc291e8d48855b14737cc.tar.bz2
Warn user not to edit before first update
Because, if you do, your changes will be lost.
-rw-r--r--Library/Homebrew/cmd/edit.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/edit.rb b/Library/Homebrew/cmd/edit.rb
index 06be636dc..3fd3bfe09 100644
--- a/Library/Homebrew/cmd/edit.rb
+++ b/Library/Homebrew/cmd/edit.rb
@@ -2,6 +2,14 @@ require 'formula'
module Homebrew extend self
def edit
+ unless (HOMEBREW_PREFIX/'.git').directory?
+ raise <<-EOS.undent
+ Changes will be lost!
+ The first time you `brew update', all local changes will be lost, you should
+ thus `brew update' before you `brew edit'!
+ EOS
+ end
+
# If no brews are listed, open the project root in an editor.
if ARGV.named.empty?
editor = File.basename which_editor