summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-11-01 09:34:32 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-11-09 15:17:17 +0000
commit63e36c53caa8c3f1581471de64bbef3ca87f3921 (patch)
treec8784f96bd2f608231fe807bb7f5629394f90f32 /src
parent434a46107bbb1c4d90832c92d4d0f5c89cb82ead (diff)
downloadlibgit2-63e36c53caa8c3f1581471de64bbef3ca87f3921.tar.gz
path: `validate` -> `is_valid`
Since we're returning a boolean about validation, the name is more properly "is valid".
Diffstat (limited to 'src')
-rw-r--r--src/checkout.c4
-rw-r--r--src/index.c2
-rw-r--r--src/path.c2
-rw-r--r--src/path.h2
-rw-r--r--src/refdb_fs.c4
-rw-r--r--src/submodule.c2
-rw-r--r--src/tree.c2
7 files changed, 9 insertions, 9 deletions
diff --git a/src/checkout.c b/src/checkout.c
index 96ba4da38..ad4edddd3 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1281,14 +1281,14 @@ static int checkout_verify_paths(
unsigned int flags = GIT_PATH_REJECT_WORKDIR_DEFAULTS;
if (action & CHECKOUT_ACTION__REMOVE) {
- if (!git_path_validate(repo, delta->old_file.path, delta->old_file.mode, flags)) {
+ if (!git_path_is_valid(repo, delta->old_file.path, delta->old_file.mode, flags)) {
git_error_set(GIT_ERROR_CHECKOUT, "cannot remove invalid path '%s'", delta->old_file.path);
return -1;
}
}
if (action & ~CHECKOUT_ACTION__REMOVE) {
- if (!git_path_validate(repo, delta->new_file.path, delta->new_file.mode, flags)) {
+ if (!git_path_is_valid(repo, delta->new_file.path, delta->new_file.mode, flags)) {
git_error_set(GIT_ERROR_CHECKOUT, "cannot checkout to invalid path '%s'", delta->new_file.path);
return -1;
}
diff --git a/src/index.c b/src/index.c
index 448852f29..bd6ea8f03 100644
--- a/src/index.c
+++ b/src/index.c
@@ -945,7 +945,7 @@ static int index_entry_create(
if (st)
mode = st->st_mode;
- if (!git_path_validate(repo, path, mode, path_valid_flags)) {
+ if (!git_path_is_valid(repo, path, mode, path_valid_flags)) {
git_error_set(GIT_ERROR_INDEX, "invalid path: '%s'", path);
return -1;
}
diff --git a/src/path.c b/src/path.c
index 063009fa1..d54bc5bfe 100644
--- a/src/path.c
+++ b/src/path.c
@@ -285,7 +285,7 @@ GIT_INLINE(unsigned int) dotgit_flags(
return flags;
}
-bool git_path_validate(
+bool git_path_is_valid(
git_repository *repo,
const char *path,
uint16_t file_mode,
diff --git a/src/path.h b/src/path.h
index ca220d121..f874a16be 100644
--- a/src/path.h
+++ b/src/path.h
@@ -25,7 +25,7 @@
#define GIT_PATH_REJECT_INDEX_DEFAULTS \
GIT_FS_PATH_REJECT_TRAVERSAL | GIT_PATH_REJECT_DOT_GIT
-extern bool git_path_validate(
+extern bool git_path_is_valid(
git_repository *repo,
const char *path,
uint16_t file_mode,
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 39dc16e9d..acd627091 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -818,7 +818,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
GIT_ASSERT_ARG(backend);
GIT_ASSERT_ARG(name);
- if (!git_path_validate(backend->repo, name, 0, GIT_FS_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
+ if (!git_path_is_valid(backend->repo, name, 0, GIT_FS_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", name);
return GIT_EINVALIDSPEC;
}
@@ -1857,7 +1857,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
repo = backend->repo;
- if (!git_path_validate(backend->repo, refname, 0, GIT_FS_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
+ if (!git_path_is_valid(backend->repo, refname, 0, GIT_FS_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", refname);
return GIT_EINVALIDSPEC;
}
diff --git a/src/submodule.c b/src/submodule.c
index 727b6c6e4..ffe29ccfb 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -423,7 +423,7 @@ int git_submodule_name_is_valid(git_repository *repo, const char *name, int flag
git_str_attach_notowned(&buf, name, strlen(name));
}
- isvalid = git_path_validate(repo, buf.ptr, 0, flags);
+ isvalid = git_path_is_valid(repo, buf.ptr, 0, flags);
git_str_dispose(&buf);
return isvalid;
diff --git a/src/tree.c b/src/tree.c
index 256e72080..b8e82d485 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -55,7 +55,7 @@ GIT_INLINE(git_filemode_t) normalize_filemode(git_filemode_t filemode)
static int valid_entry_name(git_repository *repo, const char *filename)
{
return *filename != '\0' &&
- git_path_validate(repo, filename, 0,
+ git_path_is_valid(repo, filename, 0,
GIT_FS_PATH_REJECT_TRAVERSAL | GIT_PATH_REJECT_DOT_GIT | GIT_FS_PATH_REJECT_SLASH);
}