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>
Michael Haggerty committed
Aug 4, 2011 at 06:36 UTC
9e37a7e126c98513789ce60c4bec67d7940dbf4b
1 file changed
+7
-2
builtin/check-attr.c
+7
-2
@@ -68,6 +68,12 @@ static void check_attr_stdin_paths(int cnt, struct git_attr_check *check)
68
strbuf_release(&nbuf);
69
}
70
71
+static NORETURN void error_with_usage(const char *msg)
72
+{
73
+ error("%s", msg);
74
+ usage_with_options(check_attr_usage, check_attr_options);
75
+}
76
+
77
int cmd_check_attr(int argc, const char **argv, const char *prefix)
78
{
79
struct git_attr_check *check;
@@ -103,8 +109,7 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
109
else if (stdin_paths && filei < argc)
110
errstr = "Can't specify files with --stdin";
111
if (errstr) {
106
- error("%s", errstr);
107
- usage_with_options(check_attr_usage, check_attr_options);
112
+ error_with_usage(errstr);
113
}
114
115
check = xcalloc(cnt, sizeof(*check));