Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-08-04 08:36:26 +0400
committerJunio C Hamano <gitster@pobox.com>2011-08-05 02:53:18 +0400
commit9e37a7e126c98513789ce60c4bec67d7940dbf4b (patch)
treefaf66fb73d199314ece1a7556ba30489a5eef4dd
parentd6541bb1ac753a3cc0b92021cf82b07cf459cb28 (diff)
git-check-attr: Extract a function error_with_usage()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/check-attr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index c5270786d4..d0042227c2 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -68,6 +68,12 @@ static void check_attr_stdin_paths(int cnt, struct git_attr_check *check)
strbuf_release(&nbuf);
}
+static NORETURN void error_with_usage(const char *msg)
+{
+ error("%s", msg);
+ usage_with_options(check_attr_usage, check_attr_options);
+}
+
int cmd_check_attr(int argc, const char **argv, const char *prefix)
{
struct git_attr_check *check;
@@ -103,8 +109,7 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
else if (stdin_paths && filei < argc)
errstr = "Can't specify files with --stdin";
if (errstr) {
- error("%s", errstr);
- usage_with_options(check_attr_usage, check_attr_options);
+ error_with_usage(errstr);
}
check = xcalloc(cnt, sizeof(*check));