summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c9d8f0a)
raw | patch | inline | side by side (parent: c9d8f0a)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Thu, 4 Aug 2011 04:36:32 +0000 (06:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Aug 2011 22:53:20 +0000 (15:53 -0700) |
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>
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>
Documentation/git-check-attr.txt | patch | blob | history | |
builtin/check-attr.c | patch | blob | history | |
t/t0003-attributes.sh | patch | blob | history |
index 798e5d5b4f740bf7d579f37df787b315164bffb6..1f7312a1895ae66901e5472132406d01303da1f8 100644 (file)
\--::
Interpret all preceding arguments as attributes and all following
- arguments as path names. If not supplied, only the first argument will
- be treated as an attribute.
+ arguments as path names.
+
+If none of `--stdin`, `--all`, or `--` is used, the first argument
+will be treated as an attribute and the rest of the arguments as
+pathnames.
OUTPUT
------
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index b0d2ebc3dcff91024eed22255d6b707ad8676a79..f20772ad6e3feee8643867520d1f37eca35efad2 100644 (file)
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
} 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;
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index a49f8a9813b81a1db41f22a2843e03abbc2aa61c..5acb2d5bbd308a741179c09ebe923a4bb16fb032 100755 (executable)
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
echo "f" | test_must_fail git check-attr --stdin &&
echo "f" | test_must_fail git check-attr --stdin -- f &&
echo "f" | test_must_fail git check-attr --stdin test -- f &&
- echo "f" | test_must_fail git check-attr --stdin test f &&
test_must_fail git check-attr "" -- f
'