summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-07-20 20:48:49 +0100
committerGitHub <noreply@github.com>2019-07-20 20:48:49 +0100
commit2376cd26226771dcf8ef5dfd04c83a50c50bf3d4 (patch)
tree32a720db4e5fde9adc5ed75930441b09ac386b8e
parent1f44079cae42864cb51d98ca57f5d1f4d8296693 (diff)
parent6be5ac2351d7ff2589e3a9c7ee3fefc99da48500 (diff)
downloadlibgit2-2376cd26226771dcf8ef5dfd04c83a50c50bf3d4.tar.gz
Merge pull request #5151 from pks-t/pks/w32-unlink-symlink
w32: fix unlinking of directory symlinks
-rw-r--r--fuzzers/standalone_driver.c2
-rw-r--r--src/apply.c2
-rw-r--r--src/attr_file.h2
-rw-r--r--src/blob.h2
-rw-r--r--src/checkout.c13
-rw-r--r--src/clone.c2
-rw-r--r--src/config_cache.c2
-rw-r--r--src/config_parse.h2
-rw-r--r--src/crlf.c2
-rw-r--r--src/diff_file.c2
-rw-r--r--src/diff_generate.c2
-rw-r--r--src/diff_print.c2
-rw-r--r--src/diff_tform.c2
-rw-r--r--src/fetchhead.c2
-rw-r--r--src/filebuf.c2
-rw-r--r--src/filebuf.h2
-rw-r--r--src/filter.c2
-rw-r--r--src/futils.c (renamed from src/fileops.c)2
-rw-r--r--src/futils.h (renamed from src/fileops.h)4
-rw-r--r--src/hashsig.c2
-rw-r--r--src/index.h2
-rw-r--r--src/merge_file.c2
-rw-r--r--src/mwindow.c2
-rw-r--r--src/odb.c2
-rw-r--r--src/odb_loose.c2
-rw-r--r--src/odb_mempack.c2
-rw-r--r--src/odb_pack.c2
-rw-r--r--src/pack.c2
-rw-r--r--src/patch_generate.c2
-rw-r--r--src/path.c22
-rw-r--r--src/path.h2
-rw-r--r--src/reader.c2
-rw-r--r--src/refdb_fs.c2
-rw-r--r--src/refs.c2
-rw-r--r--src/repository.c16
-rw-r--r--src/sortedcache.h2
-rw-r--r--src/status.c2
-rw-r--r--src/submodule.h2
-rw-r--r--src/tree.c2
-rw-r--r--src/win32/posix_w32.c43
-rw-r--r--tests/attr/repo.c2
-rw-r--r--tests/checkout/binaryunicode.c2
-rw-r--r--tests/checkout/checkout_helpers.c2
-rw-r--r--tests/checkout/conflict.c2
-rw-r--r--tests/checkout/crlf.c2
-rw-r--r--tests/checkout/head.c2
-rw-r--r--tests/checkout/index.c10
-rw-r--r--tests/checkout/nasty.c2
-rw-r--r--tests/checkout/tree.c2
-rw-r--r--tests/checkout/typechange.c2
-rw-r--r--tests/cherrypick/bare.c2
-rw-r--r--tests/cherrypick/workdir.c2
-rw-r--r--tests/clone/local.c2
-rw-r--r--tests/clone/nonetwork.c2
-rw-r--r--tests/clone/transport.c2
-rw-r--r--tests/config/conditionals.c2
-rw-r--r--tests/config/global.c2
-rw-r--r--tests/config/include.c2
-rw-r--r--tests/config/new.c2
-rw-r--r--tests/config/stress.c2
-rw-r--r--tests/config/write.c2
-rw-r--r--tests/core/buffer.c2
-rw-r--r--tests/core/copy.c2
-rw-r--r--tests/core/dirent.c2
-rw-r--r--tests/core/env.c2
-rw-r--r--tests/core/filebuf.c15
-rw-r--r--tests/core/futils.c23
-rw-r--r--tests/core/mkdir.c2
-rw-r--r--tests/core/path.c2
-rw-r--r--tests/core/posix.c56
-rw-r--r--tests/core/rmdir.c2
-rw-r--r--tests/core/stat.c2
-rw-r--r--tests/diff/diff_helpers.h2
-rw-r--r--tests/fetchhead/nonetwork.c2
-rw-r--r--tests/ignore/path.c2
-rw-r--r--tests/ignore/status.c2
-rw-r--r--tests/index/addall.c2
-rw-r--r--tests/iterator/index.c2
-rw-r--r--tests/iterator/iterator_helpers.c2
-rw-r--r--tests/iterator/tree.c2
-rw-r--r--tests/iterator/workdir.c2
-rw-r--r--tests/merge/files.c2
-rw-r--r--tests/merge/merge_helpers.c2
-rw-r--r--tests/merge/trees/automerge.c2
-rw-r--r--tests/merge/trees/modeconflict.c2
-rw-r--r--tests/merge/trees/renames.c2
-rw-r--r--tests/merge/trees/trivial.c2
-rw-r--r--tests/merge/trees/whitespace.c2
-rw-r--r--tests/merge/workdir/renames.c2
-rw-r--r--tests/merge/workdir/setup.c2
-rw-r--r--tests/merge/workdir/simple.c2
-rw-r--r--tests/merge/workdir/trivial.c2
-rw-r--r--tests/object/blob/fromstream.c2
-rw-r--r--tests/object/blob/write.c2
-rw-r--r--tests/object/raw/write.c2
-rw-r--r--tests/online/clone.c2
-rw-r--r--tests/online/fetchhead.c2
-rw-r--r--tests/pack/indexer.c2
-rw-r--r--tests/pack/packbuilder.c2
-rw-r--r--tests/refs/branches/delete.c2
-rw-r--r--tests/refs/delete.c2
-rw-r--r--tests/refs/pack.c2
-rw-r--r--tests/refs/reflog/messages.c2
-rw-r--r--tests/refs/reflog/reflog.c2
-rw-r--r--tests/refs/rename.c2
-rw-r--r--tests/repo/config.c2
-rw-r--r--tests/repo/discover.c2
-rw-r--r--tests/repo/env.c2
-rw-r--r--tests/repo/init.c6
-rw-r--r--tests/repo/open.c2
-rw-r--r--tests/repo/repo_helpers.c15
-rw-r--r--tests/repo/repo_helpers.h1
-rw-r--r--tests/repo/setters.c2
-rw-r--r--tests/repo/shallow.c2
-rw-r--r--tests/repo/state.c2
-rw-r--r--tests/repo/template.c2
-rw-r--r--tests/reset/hard.c2
-rw-r--r--tests/revert/bare.c2
-rw-r--r--tests/revert/workdir.c2
-rw-r--r--tests/stash/apply.c2
-rw-r--r--tests/stash/drop.c2
-rw-r--r--tests/stash/foreach.c2
-rw-r--r--tests/stash/save.c2
-rw-r--r--tests/stash/stash_helpers.c2
-rw-r--r--tests/status/submodules.c2
-rw-r--r--tests/status/worktree.c2
-rw-r--r--tests/status/worktree_init.c2
-rw-r--r--tests/submodule/add.c2
-rw-r--r--tests/submodule/escape.c2
-rw-r--r--tests/submodule/init.c2
-rw-r--r--tests/submodule/inject_option.c2
-rw-r--r--tests/submodule/lookup.c2
-rw-r--r--tests/submodule/nosubs.c2
-rw-r--r--tests/submodule/repository_init.c2
-rw-r--r--tests/submodule/status.c2
-rw-r--r--tests/submodule/update.c2
-rw-r--r--tests/win32/longpath.c2
137 files changed, 288 insertions, 186 deletions
diff --git a/fuzzers/standalone_driver.c b/fuzzers/standalone_driver.c
index c66197039..90e701333 100644
--- a/fuzzers/standalone_driver.c
+++ b/fuzzers/standalone_driver.c
@@ -8,7 +8,7 @@
#include <stdio.h>
#include "git2.h"
-#include "fileops.h"
+#include "futils.h"
#include "path.h"
extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
diff --git a/src/apply.c b/src/apply.c
index 9d607dd50..55b1a397f 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -18,7 +18,7 @@
#include "git2/repository.h"
#include "array.h"
#include "patch.h"
-#include "fileops.h"
+#include "futils.h"
#include "delta.h"
#include "zstream.h"
#include "reader.h"
diff --git a/src/attr_file.h b/src/attr_file.h
index 9538f478d..f4f9a097a 100644
--- a/src/attr_file.h
+++ b/src/attr_file.h
@@ -14,7 +14,7 @@
#include "vector.h"
#include "pool.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#define GIT_ATTR_FILE ".gitattributes"
#define GIT_ATTR_FILE_INREPO "attributes"
diff --git a/src/blob.h b/src/blob.h
index b9aa33004..0d743ec2c 100644
--- a/src/blob.h
+++ b/src/blob.h
@@ -12,7 +12,7 @@
#include "git2/blob.h"
#include "repository.h"
#include "odb.h"
-#include "fileops.h"
+#include "futils.h"
struct git_blob {
git_object object;
diff --git a/src/checkout.c b/src/checkout.c
index 730ec626e..d618e3dfa 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1893,11 +1893,18 @@ static int checkout_create_the_new(
return error;
}
- if (actions[i] & CHECKOUT_ACTION__UPDATE_BLOB) {
- error = checkout_blob(data, &delta->new_file);
- if (error < 0)
+ if (actions[i] & CHECKOUT_ACTION__UPDATE_BLOB && !S_ISLNK(delta->new_file.mode)) {
+ if ((error = checkout_blob(data, &delta->new_file)) < 0)
return error;
+ data->completed_steps++;
+ report_progress(data, delta->new_file.path);
+ }
+ }
+ git_vector_foreach(&data->diff->deltas, i, delta) {
+ if (actions[i] & CHECKOUT_ACTION__UPDATE_BLOB && S_ISLNK(delta->new_file.mode)) {
+ if ((error = checkout_blob(data, &delta->new_file)) < 0)
+ return error;
data->completed_steps++;
report_progress(data, delta->new_file.path);
}
diff --git a/src/clone.c b/src/clone.c
index 4e2dd50c7..e0b43f149 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -19,7 +19,7 @@
#include "git2/tree.h"
#include "remote.h"
-#include "fileops.h"
+#include "futils.h"
#include "refs.h"
#include "path.h"
#include "repository.h"
diff --git a/src/config_cache.c b/src/config_cache.c
index dbc463bcf..e4e071b54 100644
--- a/src/config_cache.c
+++ b/src/config_cache.c
@@ -7,7 +7,7 @@
#include "common.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
#include "config.h"
#include "git2/config.h"
diff --git a/src/config_parse.h b/src/config_parse.h
index 0129ee309..b791d3245 100644
--- a/src/config_parse.h
+++ b/src/config_parse.h
@@ -10,7 +10,7 @@
#include "common.h"
#include "array.h"
-#include "fileops.h"
+#include "futils.h"
#include "oid.h"
#include "parse.h"
diff --git a/src/crlf.c b/src/crlf.c
index 22989c16e..edccc0a42 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -12,7 +12,7 @@
#include "git2/index.h"
#include "git2/sys/filter.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "filter.h"
#include "buf_text.h"
diff --git a/src/diff_file.c b/src/diff_file.c
index 48e95eb00..978d7eaba 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -12,7 +12,7 @@
#include "diff.h"
#include "diff_generate.h"
#include "odb.h"
-#include "fileops.h"
+#include "futils.h"
#include "filter.h"
#define DIFF_MAX_FILESIZE 0x20000000
diff --git a/src/diff_generate.c b/src/diff_generate.c
index dad3c0c41..7ec317b4a 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -9,7 +9,7 @@
#include "diff.h"
#include "patch_generate.h"
-#include "fileops.h"
+#include "futils.h"
#include "config.h"
#include "attr_file.h"
#include "filter.h"
diff --git a/src/diff_print.c b/src/diff_print.c
index 664336e21..f1aac5eb0 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -10,7 +10,7 @@
#include "diff.h"
#include "diff_file.h"
#include "patch_generate.h"
-#include "fileops.h"
+#include "futils.h"
#include "zstream.h"
#include "blob.h"
#include "delta.h"
diff --git a/src/diff_tform.c b/src/diff_tform.c
index a87661eae..fc6012126 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -14,7 +14,7 @@
#include "diff.h"
#include "diff_generate.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
#include "config.h"
git_diff_delta *git_diff__delta_dup(
diff --git a/src/fetchhead.c b/src/fetchhead.c
index bdded029a..a3f6fbc7a 100644
--- a/src/fetchhead.c
+++ b/src/fetchhead.c
@@ -11,7 +11,7 @@
#include "git2/oid.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#include "filebuf.h"
#include "refs.h"
#include "repository.h"
diff --git a/src/filebuf.c b/src/filebuf.c
index 8a70bcd66..aaebf82ec 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -7,7 +7,7 @@
#include "filebuf.h"
-#include "fileops.h"
+#include "futils.h"
static const size_t WRITE_BUFFER_SIZE = (4096 * 2);
diff --git a/src/filebuf.h b/src/filebuf.h
index f51ff230f..b5002ecb2 100644
--- a/src/filebuf.h
+++ b/src/filebuf.h
@@ -9,7 +9,7 @@
#include "common.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include <zlib.h>
diff --git a/src/filter.c b/src/filter.c
index 34e2dfa17..6c929c030 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -8,7 +8,7 @@
#include "filter.h"
#include "common.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "repository.h"
#include "global.h"
diff --git a/src/fileops.c b/src/futils.c
index 648ffbe5d..e15c8017f 100644
--- a/src/fileops.c
+++ b/src/futils.c
@@ -5,7 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "fileops.h"
+#include "futils.h"
#include "global.h"
#include "strmap.h"
diff --git a/src/fileops.h b/src/futils.h
index 85131f834..1e2d3f9d9 100644
--- a/src/fileops.h
+++ b/src/futils.h
@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_fileops_h__
-#define INCLUDE_fileops_h__
+#ifndef INCLUDE_futils_h__
+#define INCLUDE_futils_h__
#include "common.h"
diff --git a/src/hashsig.c b/src/hashsig.c
index abebd7a54..14ec34b2f 100644
--- a/src/hashsig.c
+++ b/src/hashsig.c
@@ -8,7 +8,7 @@
#include "common.h"
#include "git2/sys/hashsig.h"
-#include "fileops.h"
+#include "futils.h"
#include "util.h"
typedef uint32_t hashsig_t;
diff --git a/src/index.h b/src/index.h
index 982afed3a..54402f563 100644
--- a/src/index.h
+++ b/src/index.h
@@ -9,7 +9,7 @@
#include "common.h"
-#include "fileops.h"
+#include "futils.h"
#include "filebuf.h"
#include "vector.h"
#include "idxmap.h"
diff --git a/src/merge_file.c b/src/merge_file.c
index 0647a5df6..23daa84c4 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -9,7 +9,7 @@
#include "repository.h"
#include "posix.h"
-#include "fileops.h"
+#include "futils.h"
#include "index.h"
#include "diff_xdiff.h"
#include "merge.h"
diff --git a/src/mwindow.c b/src/mwindow.c
index 949e5fa46..e834f7621 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -8,7 +8,7 @@
#include "mwindow.h"
#include "vector.h"
-#include "fileops.h"
+#include "futils.h"
#include "map.h"
#include "global.h"
#include "strmap.h"
diff --git a/src/odb.c b/src/odb.c
index 24befad18..06e4930b0 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -10,7 +10,7 @@
#include <zlib.h>
#include "git2/object.h"
#include "git2/sys/odb_backend.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "delta.h"
#include "filter.h"
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 4b249b6b6..04b81653b 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -10,7 +10,7 @@
#include <zlib.h>
#include "git2/object.h"
#include "git2/sys/odb_backend.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "odb.h"
#include "delta.h"
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index fc2302301..6728c6c42 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -10,7 +10,7 @@
#include "git2/object.h"
#include "git2/sys/odb_backend.h"
#include "git2/sys/mempack.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "odb.h"
#include "array.h"
diff --git a/src/odb_pack.c b/src/odb_pack.c
index bd760dbe1..c93d07c46 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -11,7 +11,7 @@
#include "git2/repository.h"
#include "git2/indexer.h"
#include "git2/sys/odb_backend.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "odb.h"
#include "delta.h"
diff --git a/src/pack.c b/src/pack.c
index c9d5602cd..68eeb7b0d 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -11,7 +11,7 @@
#include "delta.h"
#include "sha1_lookup.h"
#include "mwindow.h"
-#include "fileops.h"
+#include "futils.h"
#include "oid.h"
#include <zlib.h>
diff --git a/src/patch_generate.c b/src/patch_generate.c
index 5023bfe28..18256d076 100644
--- a/src/patch_generate.c
+++ b/src/patch_generate.c
@@ -15,7 +15,7 @@
#include "diff_xdiff.h"
#include "delta.h"
#include "zstream.h"
-#include "fileops.h"
+#include "futils.h"
static void diff_output_init(
git_patch_generated_output *, const git_diff_options *, git_diff_file_cb,
diff --git a/src/path.c b/src/path.c
index df6b6233b..41232c2f6 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1924,3 +1924,25 @@ extern int git_path_is_gitfile(const char *path, size_t pathlen, git_path_gitfil
return -1;
}
}
+
+bool git_path_supports_symlinks(const char *dir)
+{
+ git_buf path = GIT_BUF_INIT;
+ bool supported = false;
+ struct stat st;
+ int fd;
+
+ if ((fd = git_futils_mktmp(&path, dir, 0666)) < 0 ||
+ p_close(fd) < 0 ||
+ p_unlink(path.ptr) < 0 ||
+ p_symlink("testing", path.ptr) < 0 ||
+ p_lstat(path.ptr, &st) < 0)
+ goto done;
+
+ supported = (S_ISLNK(st.st_mode) != 0);
+done:
+ if (path.size)
+ (void)p_unlink(path.ptr);
+ git_buf_dispose(&path);
+ return supported;
+}
diff --git a/src/path.h b/src/path.h
index e29a7f6b3..624ca03aa 100644
--- a/src/path.h
+++ b/src/path.h
@@ -647,4 +647,6 @@ extern bool git_path_isvalid(
*/
int git_path_normalize_slashes(git_buf *out, const char *path);
+bool git_path_supports_symlinks(const char *dir);
+
#endif
diff --git a/src/reader.c b/src/reader.c
index 1a4844698..2d87251ee 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -7,7 +7,7 @@
#include "reader.h"
-#include "fileops.h"
+#include "futils.h"
#include "blob.h"
#include "git2/tree.h"
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 09ec7192f..a20f1ebcc 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -10,7 +10,7 @@
#include "refs.h"
#include "hash.h"
#include "repository.h"
-#include "fileops.h"
+#include "futils.h"
#include "filebuf.h"
#include "pack.h"
#include "reflog.h"
diff --git a/src/refs.c b/src/refs.c
index fd407b34b..07784302b 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -9,7 +9,7 @@
#include "hash.h"
#include "repository.h"
-#include "fileops.h"
+#include "futils.h"
#include "filebuf.h"
#include "pack.h"
#include "reflog.h"
diff --git a/src/repository.c b/src/repository.c
index 002e84f91..f9c4ef42a 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -16,7 +16,7 @@
#include "commit.h"
#include "tag.h"
#include "blob.h"
-#include "fileops.h"
+#include "futils.h"
#include "sysdir.h"
#include "filebuf.h"
#include "index.h"
@@ -1419,9 +1419,6 @@ static bool are_symlinks_supported(const char *wd_path)
git_buf xdg_buf = GIT_BUF_INIT;
git_buf system_buf = GIT_BUF_INIT;
git_buf programdata_buf = GIT_BUF_INIT;
- git_buf path = GIT_BUF_INIT;
- int fd;
- struct stat st;
int symlinks = 0;
/*
@@ -1448,23 +1445,14 @@ static bool are_symlinks_supported(const char *wd_path)
goto done;
#endif
- if ((fd = git_futils_mktmp(&path, wd_path, 0666)) < 0 ||
- p_close(fd) < 0 ||
- p_unlink(path.ptr) < 0 ||
- p_symlink("testing", path.ptr) < 0 ||
- p_lstat(path.ptr, &st) < 0)
+ if (!(symlinks = git_path_supports_symlinks(wd_path)))
goto done;
- symlinks = (S_ISLNK(st.st_mode) != 0);
-
- (void)p_unlink(path.ptr);
-
done:
git_buf_dispose(&global_buf);
git_buf_dispose(&xdg_buf);
git_buf_dispose(&system_buf);
git_buf_dispose(&programdata_buf);
- git_buf_dispose(&path);
git_config_free(config);
return symlinks != 0;
}
diff --git a/src/sortedcache.h b/src/sortedcache.h
index a53ff48a3..e553d01dd 100644
--- a/src/sortedcache.h
+++ b/src/sortedcache.h
@@ -10,7 +10,7 @@
#include "common.h"
#include "util.h"
-#include "fileops.h"
+#include "futils.h"
#include "vector.h"
#include "thread-utils.h"
#include "pool.h"
diff --git a/src/status.c b/src/status.c
index 754fe084e..42c98f60e 100644
--- a/src/status.c
+++ b/src/status.c
@@ -8,7 +8,7 @@
#include "status.h"
#include "git2.h"
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "vector.h"
#include "tree.h"
diff --git a/src/submodule.h b/src/submodule.h
index 91a4e1223..57d95c3fc 100644
--- a/src/submodule.h
+++ b/src/submodule.h
@@ -11,7 +11,7 @@
#include "git2/submodule.h"
#include "git2/repository.h"
-#include "fileops.h"
+#include "futils.h"
/* Notes:
*
diff --git a/src/tree.c b/src/tree.c
index 3799cabca..cd6ab9b2f 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -10,7 +10,7 @@
#include "commit.h"
#include "git2/repository.h"
#include "git2/object.h"
-#include "fileops.h"
+#include "futils.h"
#include "tree-cache.h"
#include "index.h"
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 91e164348..078b50952 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -8,7 +8,7 @@
#include "common.h"
#include "../posix.h"
-#include "../fileops.h"
+#include "../futils.h"
#include "path.h"
#include "path_w32.h"
#include "utf-conv.h"
@@ -251,9 +251,25 @@ int p_link(const char *old, const char *new)
GIT_INLINE(int) unlink_once(const wchar_t *path)
{
+ DWORD error;
+
if (DeleteFileW(path))
return 0;
+ if ((error = GetLastError()) == ERROR_ACCESS_DENIED) {
+ WIN32_FILE_ATTRIBUTE_DATA fdata;
+ if (!GetFileAttributesExW(path, GetFileExInfoStandard, &fdata) ||
+ !(fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) ||
+ !(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ goto out;
+
+ if (RemoveDirectoryW(path))
+ return 0;
+ }
+
+out:
+ SetLastError(error);
+
if (last_error_retryable())
return GIT_RETRY;
@@ -398,18 +414,37 @@ int p_readlink(const char *path, char *buf, size_t bufsiz)
return (int)bufsiz;
}
+static bool target_is_dir(const char *target, const char *path)
+{
+ git_buf resolved = GIT_BUF_INIT;
+ git_win32_path resolved_w;
+ bool isdir = true;
+
+ if (git_path_is_absolute(target))
+ git_win32_path_from_utf8(resolved_w, target);
+ else if (git_path_dirname_r(&resolved, path) < 0 ||
+ git_path_apply_relative(&resolved, target) < 0 ||
+ git_win32_path_from_utf8(resolved_w, resolved.ptr) < 0)
+ goto out;
+
+ isdir = GetFileAttributesW(resolved_w) & FILE_ATTRIBUTE_DIRECTORY;
+
+out:
+ git_buf_dispose(&resolved);
+ return isdir;
+}
+
int p_symlink(const char *target, const char *path)
{
git_win32_path target_w, path_w;
DWORD dwFlags;
if (git_win32_path_from_utf8(path_w, path) < 0 ||
- git__utf8_to_16(target_w, MAX_PATH, target) < 0)
+ git__utf8_to_16(target_w, MAX_PATH, target) < 0)
return -1;
dwFlags = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
-
- if (GetFileAttributesW(target_w) & FILE_ATTRIBUTE_DIRECTORY)
+ if (target_is_dir(target, path))
dwFlags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
if (!CreateSymbolicLinkW(path_w, target_w, dwFlags))
diff --git a/tests/attr/repo.c b/tests/attr/repo.c
index 93d61b158..36beeb095 100644
--- a/tests/attr/repo.c
+++ b/tests/attr/repo.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/attr.h"
#include "attr.h"
#include "sysdir.h"
diff --git a/tests/checkout/binaryunicode.c b/tests/checkout/binaryunicode.c
index 5ba79213a..edb5cfaf5 100644
--- a/tests/checkout/binaryunicode.c
+++ b/tests/checkout/binaryunicode.c
@@ -2,7 +2,7 @@
#include "refs.h"
#include "repo/repo_helpers.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo;
diff --git a/tests/checkout/checkout_helpers.c b/tests/checkout/checkout_helpers.c
index 8256644db..95af5d396 100644
--- a/tests/checkout/checkout_helpers.c
+++ b/tests/checkout/checkout_helpers.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "checkout_helpers.h"
#include "refs.h"
-#include "fileops.h"
+#include "futils.h"
#include "index.h"
void assert_on_branch(git_repository *repo, const char *branch)
diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c
index 3ad830f28..dae3f295e 100644
--- a/tests/checkout/conflict.c
+++ b/tests/checkout/conflict.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "git2/repository.h"
#include "git2/sys/index.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
static git_repository *g_repo;
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c
index ff3a2dc64..65e13a6fd 100644
--- a/tests/checkout/crlf.c
+++ b/tests/checkout/crlf.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "checkout_helpers.h"
#include "../filter/crlf.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/checkout.h"
#include "repository.h"
diff --git a/tests/checkout/head.c b/tests/checkout/head.c
index 99061466f..799123086 100644
--- a/tests/checkout/head.c
+++ b/tests/checkout/head.c
@@ -2,7 +2,7 @@
#include "refs.h"
#include "repo/repo_helpers.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo;
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index 9aa41cc81..a76c471e8 100644
--- a/tests/checkout/index.c
+++ b/tests/checkout/index.c
@@ -2,7 +2,7 @@
#include "checkout_helpers.h"
#include "git2/checkout.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
#include "remote.h"
#include "repo/repo_helpers.h"
@@ -181,7 +181,7 @@ void test_checkout_index__honor_coresymlinks_default_true(void)
cl_must_pass(p_mkdir("symlink", 0777));
- if (!filesystem_supports_symlinks("symlink/test"))
+ if (!git_path_supports_symlinks("symlink/test"))
cl_skip();
#ifdef GIT_WIN32
@@ -214,7 +214,7 @@ void test_checkout_index__honor_coresymlinks_default_false(void)
* supports symlinks. Bail entirely on POSIX platforms that
* do support symlinks.
*/
- if (filesystem_supports_symlinks("symlink/test"))
+ if (git_path_supports_symlinks("symlink/test"))
cl_skip();
#endif
@@ -226,7 +226,7 @@ void test_checkout_index__coresymlinks_set_to_true_fails_when_unsupported(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- if (filesystem_supports_symlinks("testrepo/test")) {
+ if (git_path_supports_symlinks("testrepo/test")) {
cl_skip();
}
@@ -242,7 +242,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
char link_data[GIT_PATH_MAX];
size_t link_size = GIT_PATH_MAX;
- if (!filesystem_supports_symlinks("testrepo/test")) {
+ if (!git_path_supports_symlinks("testrepo/test")) {
cl_skip();
}
diff --git a/tests/checkout/nasty.c b/tests/checkout/nasty.c
index 042fbba37..3897878ce 100644
--- a/tests/checkout/nasty.c
+++ b/tests/checkout/nasty.c
@@ -4,7 +4,7 @@
#include "git2/checkout.h"
#include "repository.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
static const char *repo_name = "nasty";
static git_repository *repo;
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index 47ded0f7c..380d25101 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -4,7 +4,7 @@
#include "git2/checkout.h"
#include "repository.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo;
static git_checkout_options g_opts;
diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c
index 708af5956..db3f02a5c 100644
--- a/tests/checkout/typechange.c
+++ b/tests/checkout/typechange.c
@@ -3,7 +3,7 @@
#include "git2/checkout.h"
#include "path.h"
#include "posix.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo = NULL;
diff --git a/tests/cherrypick/bare.c b/tests/cherrypick/bare.c
index 135336507..50e8d8600 100644
--- a/tests/cherrypick/bare.c
+++ b/tests/cherrypick/bare.c
@@ -2,7 +2,7 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/cherrypick.h"
#include "../merge/merge_helpers.h"
diff --git a/tests/cherrypick/workdir.c b/tests/cherrypick/workdir.c
index 8f6644996..10e8c2d8b 100644
--- a/tests/cherrypick/workdir.c
+++ b/tests/cherrypick/workdir.c
@@ -2,7 +2,7 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/cherrypick.h"
#include "../merge/merge_helpers.h"
diff --git a/tests/clone/local.c b/tests/clone/local.c
index 941691814..b90ff3107 100644
--- a/tests/clone/local.c
+++ b/tests/clone/local.c
@@ -5,7 +5,7 @@
#include "buffer.h"
#include "path.h"
#include "posix.h"
-#include "fileops.h"
+#include "futils.h"
static int file_url(git_buf *buf, const char *host, const char *path)
{
diff --git a/tests/clone/nonetwork.c b/tests/clone/nonetwork.c
index 73528e578..2b8081f8a 100644
--- a/tests/clone/nonetwork.c
+++ b/tests/clone/nonetwork.c
@@ -4,7 +4,7 @@
#include "git2/sys/commit.h"
#include "../submodule/submodule_helpers.h"
#include "remote.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
#define LIVE_REPO_URL "git://github.com/libgit2/TestGitRepository"
diff --git a/tests/clone/transport.c b/tests/clone/transport.c
index cccaae219..fa4f65357 100644
--- a/tests/clone/transport.c
+++ b/tests/clone/transport.c
@@ -3,7 +3,7 @@
#include "git2/clone.h"
#include "git2/transport.h"
#include "git2/sys/transport.h"
-#include "fileops.h"
+#include "futils.h"
static int custom_transport(
git_transport **out,
diff --git a/tests/config/conditionals.c b/tests/config/conditionals.c
index 8b9c0e6df..0e629e48f 100644
--- a/tests/config/conditionals.c
+++ b/tests/config/conditionals.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#ifdef GIT_WIN32
# define ROOT_PREFIX "C:"
diff --git a/tests/config/global.c b/tests/config/global.c
index 4517caeb1..b64b71677 100644
--- a/tests/config/global.c
+++ b/tests/config/global.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
void test_config_global__initialize(void)
{
diff --git a/tests/config/include.c b/tests/config/include.c
index 44546933b..48261dd92 100644
--- a/tests/config/include.c
+++ b/tests/config/include.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
static git_config *cfg;
static git_buf buf;
diff --git a/tests/config/new.c b/tests/config/new.c
index bb3a2d9a8..2f5d83d52 100644
--- a/tests/config/new.c
+++ b/tests/config/new.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "filebuf.h"
-#include "fileops.h"
+#include "futils.h"
#include "posix.h"
#define TEST_CONFIG "git-new-config"
diff --git a/tests/config/stress.c b/tests/config/stress.c
index ad09c870f..4fb0f3b26 100644
--- a/tests/config/stress.c
+++ b/tests/config/stress.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "filebuf.h"
-#include "fileops.h"
+#include "futils.h"
#include "posix.h"
#define TEST_CONFIG "git-test-config"
diff --git a/tests/config/write.c b/tests/config/write.c
index bd0f5b277..78ed7f15b 100644
--- a/tests/config/write.c
+++ b/tests/config/write.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/sys/config.h"
#include "config.h"
diff --git a/tests/core/buffer.c b/tests/core/buffer.c
index b8a76b39c..58c98cb28 100644
--- a/tests/core/buffer.c
+++ b/tests/core/buffer.c
@@ -2,7 +2,7 @@
#include "buffer.h"
#include "buf_text.h"
#include "git2/sys/hashsig.h"
-#include "fileops.h"
+#include "futils.h"
#define TESTSTR "Have you seen that? Have you seeeen that??"
const char *test_string = TESTSTR;
diff --git a/tests/core/copy.c b/tests/core/copy.c
index 967748cc5..d31274808 100644
--- a/tests/core/copy.c
+++ b/tests/core/copy.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "path.h"
#include "posix.h"
diff --git a/tests/core/dirent.c b/tests/core/dirent.c
index a2448b498..08e0b11cf 100644
--- a/tests/core/dirent.c
+++ b/tests/core/dirent.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
typedef struct name_data {
int count; /* return count */
diff --git a/tests/core/env.c b/tests/core/env.c
index 7e7b3274d..3c34b2c4d 100644
--- a/tests/core/env.c
+++ b/tests/core/env.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "sysdir.h"
#include "path.h"
diff --git a/tests/core/filebuf.c b/tests/core/filebuf.c
index 8d1952f57..e527ce97c 100644
--- a/tests/core/filebuf.c
+++ b/tests/core/filebuf.c
@@ -157,9 +157,8 @@ void test_core_filebuf__symlink_follow(void)
git_filebuf file = GIT_FILEBUF_INIT;
const char *dir = "linkdir", *source = "linkdir/link";
-#ifdef GIT_WIN32
- cl_skip();
-#endif
+ if (!git_path_supports_symlinks(clar_sandbox_path()))
+ cl_skip();
cl_git_pass(p_mkdir(dir, 0777));
cl_git_pass(p_symlink("target", source));
@@ -192,9 +191,8 @@ void test_core_filebuf__symlink_follow_absolute_paths(void)
git_filebuf file = GIT_FILEBUF_INIT;
git_buf source = GIT_BUF_INIT, target = GIT_BUF_INIT;
-#ifdef GIT_WIN32
- cl_skip();
-#endif
+ if (!git_path_supports_symlinks(clar_sandbox_path()))
+ cl_skip();
cl_git_pass(git_buf_joinpath(&source, clar_sandbox_path(), "linkdir/link"));
cl_git_pass(git_buf_joinpath(&target, clar_sandbox_path(), "linkdir/target"));
@@ -221,9 +219,8 @@ void test_core_filebuf__symlink_depth(void)
git_filebuf file = GIT_FILEBUF_INIT;
const char *dir = "linkdir", *source = "linkdir/link";
-#ifdef GIT_WIN32
- cl_skip();
-#endif
+ if (!git_path_supports_symlinks(clar_sandbox_path()))
+ cl_skip();
cl_git_pass(p_mkdir(dir, 0777));
/* Endless loop */
diff --git a/tests/core/futils.c b/tests/core/futils.c
index fce4848f5..2c8294c87 100644
--- a/tests/core/futils.c
+++ b/tests/core/futils.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
/* Fixture setup and teardown */
void test_core_futils__initialize(void)
@@ -66,3 +66,24 @@ void test_core_futils__write_hidden_file(void)
#endif
}
+void test_core_futils__recursive_rmdir_keeps_symlink_targets(void)
+{
+ if (!git_path_supports_symlinks(clar_sandbox_path()))
+ cl_skip();
+
+ cl_git_pass(git_futils_mkdir_r("a/b", 0777));
+ cl_git_pass(git_futils_mkdir_r("dir-target", 0777));
+ cl_git_mkfile("dir-target/file", "Contents");
+ cl_git_mkfile("file-target", "Contents");
+ cl_must_pass(p_symlink("dir-target", "a/symlink"));
+ cl_must_pass(p_symlink("file-target", "a/b/symlink"));
+
+ cl_git_pass(git_futils_rmdir_r("a", NULL, GIT_RMDIR_REMOVE_FILES));
+
+ cl_assert(git_path_exists("dir-target"));
+ cl_assert(git_path_exists("file-target"));
+
+ cl_must_pass(p_unlink("dir-target/file"));
+ cl_must_pass(p_rmdir("dir-target"));
+ cl_must_pass(p_unlink("file-target"));
+}
diff --git a/tests/core/mkdir.c b/tests/core/mkdir.c
index 8e52efb1e..ce11953f0 100644
--- a/tests/core/mkdir.c
+++ b/tests/core/mkdir.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "path.h"
#include "posix.h"
diff --git a/tests/core/path.c b/tests/core/path.c
index 058a710d0..2e5a4ab24 100644
--- a/tests/core/path.c
+++ b/tests/core/path.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
static void
check_dirname(const char *A, const char *B)
diff --git a/tests/core/posix.c b/tests/core/posix.c
index a459b26c6..dcc619f22 100644
--- a/tests/core/posix.c
+++ b/tests/core/posix.c
@@ -12,6 +12,7 @@
#include <locale.h>
#include "clar_libgit2.h"
+#include "futils.h"
#include "posix.h"
#include "userdiff.h"
@@ -122,7 +123,7 @@ void test_core_posix__utimes(void)
cl_git_mkfile("foo", "Dummy file.");
cl_must_pass(p_utimes("foo", times));
- p_stat("foo", &st);
+ cl_must_pass(p_stat("foo", &st));
cl_assert_equal_i(1234567890, st.st_atime);
cl_assert_equal_i(1234567890, st.st_mtime);
@@ -135,9 +136,9 @@ void test_core_posix__utimes(void)
cl_must_pass(fd = p_open("foo", O_RDWR));
cl_must_pass(p_futimes(fd, times));
- p_close(fd);
+ cl_must_pass(p_close(fd));
- p_stat("foo", &st);
+ cl_must_pass(p_stat("foo", &st));
cl_assert_equal_i(1414141414, st.st_atime);
cl_assert_equal_i(1414141414, st.st_mtime);
@@ -148,11 +149,11 @@ void test_core_posix__utimes(void)
cl_must_pass(p_utimes("foo", NULL));
curtime = time(NULL);
- p_stat("foo", &st);
+ cl_must_pass(p_stat("foo", &st));
cl_assert((st.st_atime - curtime) < 5);
cl_assert((st.st_mtime - curtime) < 5);
- p_unlink("foo");
+ cl_must_pass(p_unlink("foo"));
}
static void try_set_locale(int category)
@@ -263,3 +264,48 @@ void test_core_posix__p_regcomp_compile_userdiff_regexps(void)
cl_assert(!error);
}
}
+
+void test_core_posix__unlink_removes_symlink(void)
+{
+ if (!git_path_supports_symlinks(clar_sandbox_path()))
+ clar__skip();
+
+ cl_git_mkfile("file", "Dummy file.");
+ cl_git_pass(git_futils_mkdir("dir", 0777, 0));
+
+ cl_must_pass(p_symlink("file", "file-symlink"));
+ cl_must_pass(p_symlink("dir", "dir-symlink"));
+
+ cl_must_pass(p_unlink("file-symlink"));
+ cl_must_pass(p_unlink("dir-symlink"));
+
+ cl_assert(git_path_exists("file"));
+ cl_assert(git_path_exists("dir"));
+
+ cl_must_pass(p_unlink("file"));
+ cl_must_pass(p_rmdir("dir"));
+}
+
+void test_core_posix__symlink_resolves_to_correct_type(void)
+{
+ git_buf contents = GIT_BUF_INIT;
+
+ if (!git_path_supports_symlinks(clar_sandbox_path()))
+ clar__skip();
+
+ cl_must_pass(git_futils_mkdir("dir", 0777, 0));
+ cl_must_pass(git_futils_mkdir("file", 0777, 0));
+ cl_git_mkfile("dir/file", "symlink target");
+
+ cl_git_pass(p_symlink("file", "dir/link"));
+
+ cl_git_pass(git_futils_readbuffer(&contents, "dir/file"));
+ cl_assert_equal_s(contents.ptr, "symlink target");
+
+ cl_must_pass(p_unlink("dir/link"));
+ cl_must_pass(p_unlink("dir/file"));
+ cl_must_pass(p_rmdir("dir"));
+ cl_must_pass(p_rmdir("file"));
+
+ git_buf_dispose(&contents);
+}
diff --git a/tests/core/rmdir.c b/tests/core/rmdir.c
index e00ec5c72..b436b97e0 100644
--- a/tests/core/rmdir.c
+++ b/tests/core/rmdir.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
static const char *empty_tmp_dir = "test_gitfo_rmdir_recurs_test";
diff --git a/tests/core/stat.c b/tests/core/stat.c
index 59a134649..7f5d66753 100644
--- a/tests/core/stat.c
+++ b/tests/core/stat.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "path.h"
#include "posix.h"
diff --git a/tests/diff/diff_helpers.h b/tests/diff/diff_helpers.h
index 520b654d3..af855ce68 100644
--- a/tests/diff/diff_helpers.h
+++ b/tests/diff/diff_helpers.h
@@ -1,4 +1,4 @@
-#include "fileops.h"
+#include "futils.h"
#include "git2/diff.h"
extern git_tree *resolve_commit_oid_to_tree(
diff --git a/tests/fetchhead/nonetwork.c b/tests/fetchhead/nonetwork.c
index 658943273..c23622392 100644
--- a/tests/fetchhead/nonetwork.c
+++ b/tests/fetchhead/nonetwork.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "fetchhead.h"
#include "fetchhead_data.h"
diff --git a/tests/ignore/path.c b/tests/ignore/path.c
index 5daf32901..864fba41b 100644
--- a/tests/ignore/path.c
+++ b/tests/ignore/path.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "posix.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo = NULL;
diff --git a/tests/ignore/status.c b/tests/ignore/status.c
index 2c32f4486..6082a8118 100644
--- a/tests/ignore/status.c
+++ b/tests/ignore/status.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/attr.h"
#include "ignore.h"
#include "attr.h"
diff --git a/tests/index/addall.c b/tests/index/addall.c
index 992cd8737..c62c3cfe6 100644
--- a/tests/index/addall.c
+++ b/tests/index/addall.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "../status/status_helpers.h"
#include "posix.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo = NULL;
#define TEST_DIR "addall"
diff --git a/tests/iterator/index.c b/tests/iterator/index.c
index 8c7efb253..25d8c2990 100644
--- a/tests/iterator/index.c
+++ b/tests/iterator/index.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "iterator.h"
#include "repository.h"
-#include "fileops.h"
+#include "futils.h"
#include "iterator_helpers.h"
#include "../submodule/submodule_helpers.h"
#include <stdarg.h>
diff --git a/tests/iterator/iterator_helpers.c b/tests/iterator/iterator_helpers.c
index 68d574126..b210dbb0c 100644
--- a/tests/iterator/iterator_helpers.c
+++ b/tests/iterator/iterator_helpers.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "iterator.h"
#include "repository.h"
-#include "fileops.h"
+#include "futils.h"
#include "iterator_helpers.h"
#include <stdarg.h>
diff --git a/tests/iterator/tree.c b/tests/iterator/tree.c
index 08df909a3..f7fb9a7ee 100644
--- a/tests/iterator/tree.c
+++ b/tests/iterator/tree.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "iterator.h"
#include "repository.h"
-#include "fileops.h"
+#include "futils.h"
#include "tree.h"
#include "../submodule/submodule_helpers.h"
#include "../diff/diff_helpers.h"
diff --git a/tests/iterator/workdir.c b/tests/iterator/workdir.c
index 9d3b54390..926cc6af0 100644
--- a/tests/iterator/workdir.c
+++ b/tests/iterator/workdir.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "iterator.h"
#include "repository.h"
-#include "fileops.h"
+#include "futils.h"
#include "../submodule/submodule_helpers.h"
#include "../merge/merge_helpers.h"
#include "iterator_helpers.h"
diff --git a/tests/merge/files.c b/tests/merge/files.c
index 27c96363f..6877f9848 100644
--- a/tests/merge/files.c
+++ b/tests/merge/files.c
@@ -6,7 +6,7 @@
#include "merge_helpers.h"
#include "conflict_data.h"
#include "refs.h"
-#include "fileops.h"
+#include "futils.h"
#include "diff_xdiff.h"
#define TEST_REPO_PATH "merge-resolve"
diff --git a/tests/merge/merge_helpers.c b/tests/merge/merge_helpers.c
index cddb41178..27f355f35 100644
--- a/tests/merge/merge_helpers.c
+++ b/tests/merge/merge_helpers.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "refs.h"
#include "tree.h"
#include "merge_helpers.h"
diff --git a/tests/merge/trees/automerge.c b/tests/merge/trees/automerge.c
index e4efba51c..dd26464fb 100644
--- a/tests/merge/trees/automerge.c
+++ b/tests/merge/trees/automerge.c
@@ -3,7 +3,7 @@
#include "git2/merge.h"
#include "buffer.h"
#include "merge.h"
-#include "fileops.h"
+#include "futils.h"
#include "../merge_helpers.h"
#include "../conflict_data.h"
diff --git a/tests/merge/trees/modeconflict.c b/tests/merge/trees/modeconflict.c
index e85e340b9..32866ea6d 100644
--- a/tests/merge/trees/modeconflict.c
+++ b/tests/merge/trees/modeconflict.c
@@ -4,7 +4,7 @@
#include "buffer.h"
#include "merge.h"
#include "../merge_helpers.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
diff --git a/tests/merge/trees/renames.c b/tests/merge/trees/renames.c
index fbcfd2d3b..e0b12af3d 100644
--- a/tests/merge/trees/renames.c
+++ b/tests/merge/trees/renames.c
@@ -4,7 +4,7 @@
#include "buffer.h"
#include "merge.h"
#include "../merge_helpers.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
diff --git a/tests/merge/trees/trivial.c b/tests/merge/trees/trivial.c
index 4a8255624..ac4f09f80 100644
--- a/tests/merge/trees/trivial.c
+++ b/tests/merge/trees/trivial.c
@@ -4,7 +4,7 @@
#include "merge.h"
#include "../merge_helpers.h"
#include "refs.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/sys/index.h"
static git_repository *repo;
diff --git a/tests/merge/trees/whitespace.c b/tests/merge/trees/whitespace.c
index fdb11253b..ce7703496 100644
--- a/tests/merge/trees/whitespace.c
+++ b/tests/merge/trees/whitespace.c
@@ -4,7 +4,7 @@
#include "buffer.h"
#include "merge.h"
#include "../merge_helpers.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
diff --git a/tests/merge/workdir/renames.c b/tests/merge/workdir/renames.c
index a8ee59a44..e8cd333af 100644
--- a/tests/merge/workdir/renames.c
+++ b/tests/merge/workdir/renames.c
@@ -4,7 +4,7 @@
#include "buffer.h"
#include "merge.h"
#include "../merge_helpers.h"
-#include "fileops.h"
+#include "futils.h"
#include "refs.h"
static git_repository *repo;
diff --git a/tests/merge/workdir/setup.c b/tests/merge/workdir/setup.c
index 3a8f9d987..ad29fcd94 100644
--- a/tests/merge/workdir/setup.c
+++ b/tests/merge/workdir/setup.c
@@ -3,7 +3,7 @@
#include "git2/merge.h"
#include "merge.h"
#include "refs.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
static git_index *repo_index;
diff --git a/tests/merge/workdir/simple.c b/tests/merge/workdir/simple.c
index a8d5d0be0..6b4e17492 100644
--- a/tests/merge/workdir/simple.c
+++ b/tests/merge/workdir/simple.c
@@ -6,7 +6,7 @@
#include "../merge_helpers.h"
#include "../conflict_data.h"
#include "refs.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
static git_index *repo_index;
diff --git a/tests/merge/workdir/trivial.c b/tests/merge/workdir/trivial.c
index 39d1ddc9b..c5bb7030e 100644
--- a/tests/merge/workdir/trivial.c
+++ b/tests/merge/workdir/trivial.c
@@ -5,7 +5,7 @@
#include "merge.h"
#include "../merge_helpers.h"
#include "refs.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
static git_index *repo_index;
diff --git a/tests/object/blob/fromstream.c b/tests/object/blob/fromstream.c
index 416b452c2..df229f98f 100644
--- a/tests/object/blob/fromstream.c
+++ b/tests/object/blob/fromstream.c
@@ -2,7 +2,7 @@
#include "buffer.h"
#include "posix.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
static char textual_content[] = "libgit2\n\r\n\0";
diff --git a/tests/object/blob/write.c b/tests/object/blob/write.c
index e6b67fb71..9a18d7cd4 100644
--- a/tests/object/blob/write.c
+++ b/tests/object/blob/write.c
@@ -2,7 +2,7 @@
#include "buffer.h"
#include "posix.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
diff --git a/tests/object/raw/write.c b/tests/object/raw/write.c
index a360f04c5..9bc127680 100644
--- a/tests/object/raw/write.c
+++ b/tests/object/raw/write.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "git2/odb_backend.h"
-#include "fileops.h"
+#include "futils.h"
#include "odb.h"
typedef struct object_data {
diff --git a/tests/online/clone.c b/tests/online/clone.c
index b7042f3d6..60aaeeb0f 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -3,7 +3,7 @@
#include "git2/clone.h"
#include "git2/cred_helpers.h"
#include "remote.h"
-#include "fileops.h"
+#include "futils.h"
#include "refs.h"
#define LIVE_REPO_URL "http://github.com/libgit2/TestGitRepository"
diff --git a/tests/online/fetchhead.c b/tests/online/fetchhead.c
index 7e9ca7e34..4f7be7e38 100644
--- a/tests/online/fetchhead.c
+++ b/tests/online/fetchhead.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "fetchhead.h"
#include "../fetchhead/fetchhead_data.h"
#include "git2/clone.h"
diff --git a/tests/pack/indexer.c b/tests/pack/indexer.c
index 08247ae46..422c3def4 100644
--- a/tests/pack/indexer.c
+++ b/tests/pack/indexer.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
#include <git2.h>
-#include "fileops.h"
+#include "futils.h"
#include "hash.h"
#include "iterator.h"
#include "vector.h"
diff --git a/tests/pack/packbuilder.c b/tests/pack/packbuilder.c
index 397d32e92..59eb3da61 100644
--- a/tests/pack/packbuilder.c
+++ b/tests/pack/packbuilder.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "pack.h"
#include "hash.h"
#include "iterator.h"
diff --git a/tests/refs/branches/delete.c b/tests/refs/branches/delete.c
index 553d80033..6093c7886 100644
--- a/tests/refs/branches/delete.c
+++ b/tests/refs/branches/delete.c
@@ -2,7 +2,7 @@
#include "refs.h"
#include "repo/repo_helpers.h"
#include "config/config_helpers.h"
-#include "fileops.h"
+#include "futils.h"
#include "reflog.h"
static git_repository *repo;
diff --git a/tests/refs/delete.c b/tests/refs/delete.c
index 4cc78aa9c..a33449641 100644
--- a/tests/refs/delete.c
+++ b/tests/refs/delete.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/reflog.h"
#include "git2/refdb.h"
#include "reflog.h"
diff --git a/tests/refs/pack.c b/tests/refs/pack.c
index 92312e26d..676fb1759 100644
--- a/tests/refs/pack.c
+++ b/tests/refs/pack.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/reflog.h"
#include "git2/refdb.h"
#include "reflog.h"
diff --git a/tests/refs/reflog/messages.c b/tests/refs/reflog/messages.c
index 5ca9ab31b..f8acd23d2 100644
--- a/tests/refs/reflog/messages.c
+++ b/tests/refs/reflog/messages.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/reflog.h"
#include "reflog.h"
#include "refs.h"
diff --git a/tests/refs/reflog/reflog.c b/tests/refs/reflog/reflog.c
index cf8c5c2d3..7e4b1ef4a 100644
--- a/tests/refs/reflog/reflog.c
+++ b/tests/refs/reflog/reflog.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/reflog.h"
#include "reflog.h"
diff --git a/tests/refs/rename.c b/tests/refs/rename.c
index 9933bee1d..b1b75cd64 100644
--- a/tests/refs/rename.c
+++ b/tests/refs/rename.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/reflog.h"
#include "reflog.h"
#include "refs.h"
diff --git a/tests/repo/config.c b/tests/repo/config.c
index a397ee525..6ca31f550 100644
--- a/tests/repo/config.c
+++ b/tests/repo/config.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
#include "sysdir.h"
-#include "fileops.h"
+#include "futils.h"
#include <ctype.h>
static git_buf path = GIT_BUF_INIT;
diff --git a/tests/repo/discover.c b/tests/repo/discover.c
index cc61c7125..c026eefc3 100644
--- a/tests/repo/discover.c
+++ b/tests/repo/discover.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "odb.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
#define TEMP_REPO_FOLDER "temprepo/"
diff --git a/tests/repo/env.c b/tests/repo/env.c
index 9dafda198..024661692 100644
--- a/tests/repo/env.c
+++ b/tests/repo/env.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "sysdir.h"
#include <ctype.h>
diff --git a/tests/repo/init.c b/tests/repo/init.c
index 9879ef1f7..5a95229e6 100644
--- a/tests/repo/init.c
+++ b/tests/repo/init.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
#include "config.h"
#include "path.h"
@@ -253,7 +253,7 @@ void test_repo_init__symlinks_win32_enabled_by_global_config(void)
git_config *config, *repo_config;
int val;
- if (!filesystem_supports_symlinks("link"))
+ if (!git_path_supports_symlinks("link"))
cl_skip();
create_tmp_global_config("tmp_global_config", "core.symlinks", "true");
@@ -296,7 +296,7 @@ void test_repo_init__symlinks_posix_detected(void)
cl_skip();
#else
assert_config_entry_on_init(
- "core.symlinks", filesystem_supports_symlinks("link") ? GIT_ENOTFOUND : false);
+ "core.symlinks", git_path_supports_symlinks("link") ? GIT_ENOTFOUND : false);
#endif
}
diff --git a/tests/repo/open.c b/tests/repo/open.c
index 5c08a388c..edcf93fe1 100644
--- a/tests/repo/open.c
+++ b/tests/repo/open.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "sysdir.h"
#include <ctype.h>
diff --git a/tests/repo/repo_helpers.c b/tests/repo/repo_helpers.c
index 4256314f1..b22f3f6ba 100644
--- a/tests/repo/repo_helpers.c
+++ b/tests/repo/repo_helpers.c
@@ -21,21 +21,6 @@ void delete_head(git_repository* repo)
git_buf_dispose(&head_path);
}
-int filesystem_supports_symlinks(const char *path)
-{
- struct stat st;
- bool support = 0;
-
- if (p_symlink("target", path) == 0) {
- if (p_lstat(path, &st) == 0 && S_ISLNK(st.st_mode))
- support = 1;
-
- p_unlink(path);
- }
-
- return support;
-}
-
void create_tmp_global_config(const char *dirname, const char *key, const char *val)
{
git_buf path = GIT_BUF_INIT;
diff --git a/tests/repo/repo_helpers.h b/tests/repo/repo_helpers.h
index 2c9aeabee..a93bf36ae 100644
--- a/tests/repo/repo_helpers.h
+++ b/tests/repo/repo_helpers.h
@@ -4,5 +4,4 @@
extern void make_head_unborn(git_repository* repo, const char *target);
extern void delete_head(git_repository* repo);
-extern int filesystem_supports_symlinks(const char *path);
extern void create_tmp_global_config(const char *path, const char *key, const char *val);
diff --git a/tests/repo/setters.c b/tests/repo/setters.c
index ea6ef12b1..1fac627f6 100644
--- a/tests/repo/setters.c
+++ b/tests/repo/setters.c
@@ -5,7 +5,7 @@
#include "posix.h"
#include "util.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
diff --git a/tests/repo/shallow.c b/tests/repo/shallow.c
index b9a7b810b..adb7a9e44 100644
--- a/tests/repo/shallow.c
+++ b/tests/repo/shallow.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo;
diff --git a/tests/repo/state.c b/tests/repo/state.c
index fb8949775..afb361787 100644
--- a/tests/repo/state.c
+++ b/tests/repo/state.c
@@ -2,7 +2,7 @@
#include "buffer.h"
#include "refs.h"
#include "posix.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *_repo;
static git_buf _path;
diff --git a/tests/repo/template.c b/tests/repo/template.c
index 7ccd93521..3513190ac 100644
--- a/tests/repo/template.c
+++ b/tests/repo/template.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "repo/repo_helpers.h"
#define CLEAR_FOR_CORE_FILEMODE(M) ((M) &= ~0177)
diff --git a/tests/reset/hard.c b/tests/reset/hard.c
index b6e91395b..1ea1d13fb 100644
--- a/tests/reset/hard.c
+++ b/tests/reset/hard.c
@@ -2,7 +2,7 @@
#include "posix.h"
#include "reset_helpers.h"
#include "path.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *repo;
static git_object *target;
diff --git a/tests/revert/bare.c b/tests/revert/bare.c
index fc7d03065..03cffbf3e 100644
--- a/tests/revert/bare.c
+++ b/tests/revert/bare.c
@@ -2,7 +2,7 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/revert.h"
#include "../merge/merge_helpers.h"
diff --git a/tests/revert/workdir.c b/tests/revert/workdir.c
index 9acf20d6f..2ad059d99 100644
--- a/tests/revert/workdir.c
+++ b/tests/revert/workdir.c
@@ -2,7 +2,7 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
#include "git2/revert.h"
#include "../merge/merge_helpers.h"
diff --git a/tests/stash/apply.c b/tests/stash/apply.c
index 063223ae6..5eb59545e 100644
--- a/tests/stash/apply.c
+++ b/tests/stash/apply.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "stash_helpers.h"
static git_signature *signature;
diff --git a/tests/stash/drop.c b/tests/stash/drop.c
index 89a0ade72..6b0895ba8 100644
--- a/tests/stash/drop.c
+++ b/tests/stash/drop.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "stash_helpers.h"
#include "refs.h"
diff --git a/tests/stash/foreach.c b/tests/stash/foreach.c
index 57dc8eeb4..fa3a9c906 100644
--- a/tests/stash/foreach.c
+++ b/tests/stash/foreach.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "stash_helpers.h"
struct callback_data
diff --git a/tests/stash/save.c b/tests/stash/save.c
index c38ef8274..362c704ea 100644
--- a/tests/stash/save.c
+++ b/tests/stash/save.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "stash_helpers.h"
static git_repository *repo;
diff --git a/tests/stash/stash_helpers.c b/tests/stash/stash_helpers.c
index 0398757c2..cd0cfbd0f 100644
--- a/tests/stash/stash_helpers.c
+++ b/tests/stash/stash_helpers.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "stash_helpers.h"
void setup_stash(git_repository *repo, git_signature *signature)
diff --git a/tests/status/submodules.c b/tests/status/submodules.c
index 33c9e5ab4..12edce2b2 100644
--- a/tests/status/submodules.c
+++ b/tests/status/submodules.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "status_helpers.h"
#include "../submodule/submodule_helpers.h"
diff --git a/tests/status/worktree.c b/tests/status/worktree.c
index 4c37a337c..7711b2da4 100644
--- a/tests/status/worktree.c
+++ b/tests/status/worktree.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "fileops.h"
+#include "futils.h"
#include "ignore.h"
#include "status_data.h"
#include "posix.h"
diff --git a/tests/status/worktree_init.c b/tests/status/worktree_init.c
index 9d5cfa5a3..40f1b2a31 100644
--- a/tests/status/worktree_init.c
+++ b/tests/status/worktree_init.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "git2/sys/repository.h"
-#include "fileops.h"
+#include "futils.h"
#include "ignore.h"
#include "status_helpers.h"
#include "posix.h"
diff --git a/tests/submodule/add.c b/tests/submodule/add.c
index d5886776d..b251b331e 100644
--- a/tests/submodule/add.c
+++ b/tests/submodule/add.c
@@ -3,7 +3,7 @@
#include "path.h"
#include "submodule_helpers.h"
#include "config/config_helpers.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
static git_repository *g_repo = NULL;
diff --git a/tests/submodule/escape.c b/tests/submodule/escape.c
index c36874296..08eb76809 100644
--- a/tests/submodule/escape.c
+++ b/tests/submodule/escape.c
@@ -2,7 +2,7 @@
#include "posix.h"
#include "path.h"
#include "submodule_helpers.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
static git_repository *g_repo = NULL;
diff --git a/tests/submodule/init.c b/tests/submodule/init.c
index 84143e18f..a1d870b9e 100644
--- a/tests/submodule/init.c
+++ b/tests/submodule/init.c
@@ -2,7 +2,7 @@
#include "posix.h"
#include "path.h"
#include "submodule_helpers.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo = NULL;
diff --git a/tests/submodule/inject_option.c b/tests/submodule/inject_option.c
index 182f088be..cfc02acff 100644
--- a/tests/submodule/inject_option.c
+++ b/tests/submodule/inject_option.c
@@ -2,7 +2,7 @@
#include "posix.h"
#include "path.h"
#include "submodule_helpers.h"
-#include "fileops.h"
+#include "futils.h"
#include "repository.h"
static git_repository *g_repo = NULL;
diff --git a/tests/submodule/lookup.c b/tests/submodule/lookup.c
index 8bab1b93a..6f7506d2c 100644
--- a/tests/submodule/lookup.c
+++ b/tests/submodule/lookup.c
@@ -2,7 +2,7 @@
#include "submodule_helpers.h"
#include "git2/sys/repository.h"
#include "repository.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo = NULL;
diff --git a/tests/submodule/nosubs.c b/tests/submodule/nosubs.c
index ca2d1d693..e47ee3983 100644
--- a/tests/submodule/nosubs.c
+++ b/tests/submodule/nosubs.c
@@ -2,7 +2,7 @@
#include "clar_libgit2.h"
#include "posix.h"
-#include "fileops.h"
+#include "futils.h"
void test_submodule_nosubs__cleanup(void)
{
diff --git a/tests/submodule/repository_init.c b/tests/submodule/repository_init.c
index 7dd97bac0..9962af311 100644
--- a/tests/submodule/repository_init.c
+++ b/tests/submodule/repository_init.c
@@ -3,7 +3,7 @@
#include "path.h"
#include "submodule_helpers.h"
#include "config/config_helpers.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo = NULL;
diff --git a/tests/submodule/status.c b/tests/submodule/status.c
index 41fc17387..06595cc9a 100644
--- a/tests/submodule/status.c
+++ b/tests/submodule/status.c
@@ -2,7 +2,7 @@
#include "posix.h"
#include "path.h"
#include "submodule_helpers.h"
-#include "fileops.h"
+#include "futils.h"
#include "iterator.h"
static git_repository *g_repo = NULL;
diff --git a/tests/submodule/update.c b/tests/submodule/update.c
index 08a279a48..79353e575 100644
--- a/tests/submodule/update.c
+++ b/tests/submodule/update.c
@@ -2,7 +2,7 @@
#include "posix.h"
#include "path.h"
#include "submodule_helpers.h"
-#include "fileops.h"
+#include "futils.h"
static git_repository *g_repo = NULL;
diff --git a/tests/win32/longpath.c b/tests/win32/longpath.c
index bf5aac724..80ae08d8b 100644
--- a/tests/win32/longpath.c
+++ b/tests/win32/longpath.c
@@ -3,7 +3,7 @@
#include "git2/clone.h"
#include "clone.h"
#include "buffer.h"
-#include "fileops.h"
+#include "futils.h"
static git_buf path = GIT_BUF_INIT;