summaryrefslogtreecommitdiff
path: root/builtin/check-attr.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-08-04 06:36:32 +0200
committerJunio C Hamano <gitster@pobox.com>2011-08-04 15:53:20 -0700
commitca64d061e0ddf7fa1496a15c75eb5e730c4360e0 (patch)
tree4689979dd59781cad786e105c6ae71bf688e6542 /builtin/check-attr.c
parentc9d8f0ac3b9029d825c7d1c049953aacbc489e1c (diff)
downloadgit-ca64d061e0ddf7fa1496a15c75eb5e730c4360e0.tar.gz
git-check-attr: Fix command-line handling to match docs
According to the git-check-attr synopsis, if the '--stdin' option is used then no pathnames are expected on the command line. Change the behavior to match this description; namely, if '--stdin' is used but not '--', then treat all command-line arguments as attribute names. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/check-attr.c')
-rw-r--r--builtin/check-attr.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index b0d2ebc3dc..f20772ad6e 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -111,15 +111,18 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
} else if (doubledash == 0) {
error_with_usage("No attribute specified");
} else if (doubledash < 0) {
- /*
- * There is no double dash; treat the first
- * argument as an attribute.
- */
if (!argc)
error_with_usage("No attribute specified");
- cnt = 1;
- filei = 1;
+ if (stdin_paths) {
+ /* Treat all arguments as attribute names. */
+ cnt = argc;
+ filei = argc;
+ } else {
+ /* Treat exactly one argument as an attribute name. */
+ cnt = 1;
+ filei = 1;
+ }
} else {
cnt = doubledash;
filei = doubledash + 1;