From 16c4a827c0693c3a65b355eb4a15c77f13c88c68 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Fri, 12 Sep 2014 19:55:19 -0700 Subject: [PATCH] Error message if you try to lock repository that's not locked --- commands.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/commands.cpp b/commands.cpp index f7ab302..da6df44 100644 --- a/commands.cpp +++ b/commands.cpp @@ -914,6 +914,15 @@ int lock (int argc, const char** argv) } } else { // just handle the given key + if (access(get_internal_key_path(key_name).c_str(), F_OK) == -1 && errno == ENOENT) { + std::clog << "Error: this repository is not currently locked"; + if (key_name) { + std::clog << " with key '" << key_name << "'"; + } + std::clog << "." << std::endl; + return 1; + } + unlink_internal_key(key_name); unconfigure_git_filters(key_name); }