git-check-attr: Extract a function output_attr()
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
46f96a6d8ed70ecac7c1532d7f9775320409917b
1 file changed
+9
-3
builtin/check-attr.c
+9
-3
@@ -20,12 +20,10 @@ static const struct option check_attr_options[] = {
20
OPT_END()
21
};
22
23
-static void check_attr(int cnt, struct git_attr_check *check,
23
+static void output_attr(int cnt, struct git_attr_check *check,
24
const char *file)
25
{
26
int j;
27
- if (git_checkattr(file, cnt, check))
28
- die("git_checkattr died");
27
for (j = 0; j < cnt; j++) {
28
const char *value = check[j].value;
29
@@ -41,6 +39,14 @@ static void check_attr(int cnt, struct git_attr_check *check,
39
}
40
}
41
42
+static void check_attr(int cnt, struct git_attr_check *check,
43
+ const char *file)
44
+{
45
+ if (git_checkattr(file, cnt, check))
46
+ die("git_checkattr died");
47
+ output_attr(cnt, check, file);
48
+}
49
+
50
static void check_attr_stdin_paths(int cnt, struct git_attr_check *check)
51
{
52
struct strbuf buf, nbuf;