aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/edit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd/edit.rb')
-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