summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a130976)
raw | patch | inline | side by side (parent: a130976)
author | Lars Hjemli <hjemli@gmail.com> | |
Sat, 10 Nov 2007 16:47:54 +0000 (17:47 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 10 Nov 2007 19:04:24 +0000 (11:04 -0800) |
The option value for --sort is already a pointer to a pointer to struct
ref_sort, so just use it.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref_sort, so just use it.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-for-each-ref.c | patch | blob | history | |
t/t6300-for-each-ref.sh | patch | blob | history |
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index da8c7948e63609aeeae20cde87b519933a5a4207..e909e66bedb168b7d10f6f0c3cd806d6ce139a2c 100644 (file)
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
OPT_GROUP(""),
OPT_INTEGER( 0 , "count", &maxcount, "show only <n> matched refs"),
OPT_STRING( 0 , "format", &format, "format", "format to use for the output"),
- OPT_CALLBACK(0 , "sort", &sort_tail, "key",
+ OPT_CALLBACK(0 , "sort", sort_tail, "key",
"field name to sort on", &opt_parse_sort),
OPT_END(),
};
index d0809eb651d3fef4ff6cd342bfeabf62e9ef5d05..c722635050fed8011c04177dc5a8220cae12a843 100755 (executable)
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
git diff expected actual
'
+cat >expected <<\EOF
+refs/heads/master
+refs/tags/testtag
+EOF
+
+test_expect_success 'Verify ascending sort' '
+ git-for-each-ref --format="%(refname)" --sort=refname >actual &&
+ git diff expected actual
+'
+
+
+cat >expected <<\EOF
+refs/tags/testtag
+refs/heads/master
+EOF
+
+test_expect_success 'Verify descending sort' '
+ git-for-each-ref --format="%(refname)" --sort=-refname >actual &&
+ git diff expected actual
+'
+
+
test_done