summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/helper/test-path-utils.c13
-rw-r--r--t/test-lib-functions.sh2
2 files changed, 14 insertions, 1 deletions
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 72ac8d1b1b..54d9ba98c0 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -323,6 +323,19 @@ int cmd__path_utils(int argc, const char **argv)
return 0;
}
+ if (argc >= 2 && !strcmp(argv[1], "readlink")) {
+ struct strbuf target = STRBUF_INIT;
+ while (argc > 2) {
+ if (strbuf_readlink(&target, argv[2], 0) < 0)
+ die_errno("cannot read link at '%s'", argv[2]);
+ puts(target.buf);
+ argc--;
+ argv++;
+ }
+ strbuf_release(&target);
+ return 0;
+ }
+
if (argc >= 2 && !strcmp(argv[1], "absolute_path")) {
while (argc > 2) {
puts(absolute_path(argv[2]));
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index c4b4d3a4c7..bff8c4d1b4 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1979,7 +1979,7 @@ test_remote_https_urls() {
# Print the destination of symlink(s) provided as arguments. Basically
# the same as the readlink command, but it's not available everywhere.
test_readlink () {
- perl -le 'print readlink($_) for @ARGV' "$@"
+ test-tool path-utils readlink "$@"
}
# Set mtime to a fixed "magic" timestamp in mid February 2009, before we