Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-02-16 21:27:14 +0300
committerJunio C Hamano <gitster@pobox.com>2023-02-17 03:21:56 +0300
commite00e56a7df616659c90d107c3d31d362b5dff103 (patch)
tree7631e8a47c5799297c3d4e4de8904ef0a8ff3fe8 /t
parentd9d677b2d8cc5f70499db04e633ba7a400f64cbf (diff)
dir-iterator: drop unused `DIR_ITERATOR_FOLLOW_SYMLINKS`
The `FOLLOW_SYMLINKS` flag was added to the dir-iterator API in fa1da7d2ee (dir-iterator: add flags parameter to dir_iterator_begin, 2019-07-10) in order to follow symbolic links while traversing through a directory. `FOLLOW_SYMLINKS` gained its first caller in ff7ccc8c9a (clone: use dir-iterator to avoid explicit dir traversal, 2019-07-10), but it was subsequently removed in 6f054f9fb3 (builtin/clone.c: disallow `--local` clones with symlinks, 2022-07-28). Since then, we've held on to the code for `DIR_ITERATOR_FOLLOW_SYMLINKS` in the name of making minimally invasive changes during a security embargo. In fact, we even changed the dir-iterator API in bffc762f87 (dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS, 2023-01-24) without having any non-test callers of that flag. Now that we're past those security embargo(s), let's finalize our cleanup of the `DIR_ITERATOR_FOLLOW_SYMLINKS` code and remove its implementation since there are no remaining callers. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/helper/test-dir-iterator.c6
-rwxr-xr-xt/t0066-dir-iterator.sh34
2 files changed, 2 insertions, 38 deletions
diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c
index 659b6bfa81..6b297bd753 100644
--- a/t/helper/test-dir-iterator.c
+++ b/t/helper/test-dir-iterator.c
@@ -15,7 +15,7 @@ static const char *error_name(int error_number)
/*
* usage:
- * tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
+ * tool-test dir-iterator [--pedantic] directory_path
*/
int cmd__dir_iterator(int argc, const char **argv)
{
@@ -24,9 +24,7 @@ int cmd__dir_iterator(int argc, const char **argv)
int iter_status;
for (++argv, --argc; *argv && starts_with(*argv, "--"); ++argv, --argc) {
- if (strcmp(*argv, "--follow-symlinks") == 0)
- flags |= DIR_ITERATOR_FOLLOW_SYMLINKS;
- else if (strcmp(*argv, "--pedantic") == 0)
+ if (strcmp(*argv, "--pedantic") == 0)
flags |= DIR_ITERATOR_PEDANTIC;
else
die("invalid option '%s'", *argv);
diff --git a/t/t0066-dir-iterator.sh b/t/t0066-dir-iterator.sh
index 04b811622b..4ed3136b00 100755
--- a/t/t0066-dir-iterator.sh
+++ b/t/t0066-dir-iterator.sh
@@ -131,44 +131,10 @@ test_expect_success SYMLINKS 'dir-iterator should not follow symlinks by default
test_cmp expected-no-follow-sorted-output actual-no-follow-sorted-output
'
-test_expect_success SYMLINKS 'dir-iterator should follow symlinks w/ follow flag' '
- cat >expected-follow-sorted-output <<-EOF &&
- [d] (a) [a] ./dir4/a
- [d] (a/f) [f] ./dir4/a/f
- [d] (a/f/c) [c] ./dir4/a/f/c
- [d] (b) [b] ./dir4/b
- [d] (b/c) [c] ./dir4/b/c
- [f] (a/d) [d] ./dir4/a/d
- [f] (a/e) [e] ./dir4/a/e
- EOF
-
- test-tool dir-iterator --follow-symlinks ./dir4 >out &&
- sort out >actual-follow-sorted-output &&
-
- test_cmp expected-follow-sorted-output actual-follow-sorted-output
-'
-
test_expect_success SYMLINKS 'dir-iterator does not resolve top-level symlinks' '
test_must_fail test-tool dir-iterator ./dir6 >out &&
grep "ENOTDIR" out
'
-test_expect_success SYMLINKS 'dir-iterator resolves top-level symlinks w/ follow flag' '
- cat >expected-follow-sorted-output <<-EOF &&
- [d] (a) [a] ./dir6/a
- [d] (a/f) [f] ./dir6/a/f
- [d] (a/f/c) [c] ./dir6/a/f/c
- [d] (b) [b] ./dir6/b
- [d] (b/c) [c] ./dir6/b/c
- [f] (a/d) [d] ./dir6/a/d
- [f] (a/e) [e] ./dir6/a/e
- EOF
-
- test-tool dir-iterator --follow-symlinks ./dir6 >out &&
- sort out >actual-follow-sorted-output &&
-
- test_cmp expected-follow-sorted-output actual-follow-sorted-output
-'
-
test_done