summaryrefslogtreecommitdiff
path: root/t/helper/test-dir-iterator.c
diff options
context:
space:
mode:
authorJiang Xin <worldhello.net@gmail.com>2019-08-10 20:11:17 +0800
committerJiang Xin <worldhello.net@gmail.com>2019-08-10 20:11:17 +0800
commitd6d5cbfe87e2eb025ba316afe74b74d009cfd330 (patch)
tree45035c13b4ea6696000788dcf10c54b588f0bc9b /t/helper/test-dir-iterator.c
parent5532a55b340f0f1ce5f7519f3fd359e3f84326ad (diff)
parent2e27de94d485a6da0c8e264c165e55100f1a13a8 (diff)
Merge tag 'v2.23.0-rc2' of git://git.kernel.org/pub/scm/git/git
Git 2.23-rc2 * tag 'v2.23.0-rc2' of git://git.kernel.org/pub/scm/git/git: (63 commits) Git 2.23-rc2 t0000: reword comments for "local" test t: decrease nesting in test_oid_to_path sha1-file: release strbuf after use test-dir-iterator: use path argument directly dir-iterator: release strbuf after use commit-graph: release strbufs after use l10n: reformat some localized strings for v2.23.0 merge-recursive: avoid directory rename detection in recursive case commit-graph: fix bug around octopus merges restore: fix typo in docs doc: typo: s/can not/cannot/ and s/is does/does/ Git 2.23-rc1 log: really flip the --mailmap default RelNotes/2.23.0: fix a few typos and other minor issues RelNotes/2.21.1: typofix log: flip the --mailmap default unconditionally config: work around bug with includeif:onbranch and early config A few more last-minute fixes repack: simplify handling of auto-bitmaps and .keep files ...
Diffstat (limited to 't/helper/test-dir-iterator.c')
-rw-r--r--t/helper/test-dir-iterator.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c
index a5b96cb0dc..659b6bfa81 100644
--- a/t/helper/test-dir-iterator.c
+++ b/t/helper/test-dir-iterator.c
@@ -4,13 +4,21 @@
#include "iterator.h"
#include "dir-iterator.h"
+static const char *error_name(int error_number)
+{
+ switch (error_number) {
+ case ENOENT: return "ENOENT";
+ case ENOTDIR: return "ENOTDIR";
+ default: return "ESOMETHINGELSE";
+ }
+}
+
/*
* usage:
* tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
*/
int cmd__dir_iterator(int argc, const char **argv)
{
- struct strbuf path = STRBUF_INIT;
struct dir_iterator *diter;
unsigned int flags = 0;
int iter_status;
@@ -27,11 +35,10 @@ int cmd__dir_iterator(int argc, const char **argv)
if (!*argv || argc != 1)
die("dir-iterator needs exactly one non-option argument");
- strbuf_add(&path, *argv, strlen(*argv));
- diter = dir_iterator_begin(path.buf, flags);
+ diter = dir_iterator_begin(*argv, flags);
if (!diter) {
- printf("dir_iterator_begin failure: %d\n", errno);
+ printf("dir_iterator_begin failure: %s\n", error_name(errno));
exit(EXIT_FAILURE);
}