path: rename git_path_validate_filesystem

"filesystem validation" is vague.  These functions validate the length,
name them as such.
This commit is contained in:
Edward Thomson
2021-10-10 08:05:19 -04:00
parent f898d2d587
commit 42bf01860c
4 changed files with 13 additions and 11 deletions

View File

@@ -327,7 +327,7 @@ int git_ignore__for_path(
git_buf_dispose(&local);
} else {
if (!(error = git_buf_joinpath(&ignores->dir, path, "")))
error = git_path_validate_filesystem(ignores->dir.ptr, ignores->dir.size);
error = git_path_validate_length(ignores->dir.ptr, ignores->dir.size);
}
if (error < 0)

View File

@@ -637,7 +637,8 @@ extern int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or
*
* (Note: if you take or construct an on-disk path -- a workdir path,
* a path to a git repository or a reference name that could be a loose
* ref -- you should _also_ validate that with `git_path_validate_workdir`.)
* ref -- you should _also_ validate that with
* `git_repository_validate_workdir_path`.)
*
* `repo` is optional. If specified, it will be used to determine the short
* path name to reject (if `GIT_PATH_REJECT_DOS_SHORTNAME` is specified),
@@ -653,7 +654,7 @@ extern bool git_path_validate(
* Validate an on-disk path, taking into account that it will have a
* suffix appended (eg, `.lock`).
*/
GIT_INLINE(int) git_path_validate_filesystem_with_suffix(
GIT_INLINE(int) git_path_validate_length_with_suffix(
const char *path,
size_t path_len,
size_t suffix_len)
@@ -684,13 +685,14 @@ GIT_INLINE(int) git_path_validate_filesystem_with_suffix(
* Windows.
*
* For paths within the working directory, you should use ensure that
* `core.longpaths` is obeyed. Use `git_path_validate_workdir`.
* `core.longpaths` is obeyed. Use `git_repository_validate_workdir_path`
* instead.
*/
GIT_INLINE(int) git_path_validate_filesystem(
GIT_INLINE(int) git_path_validate_length(
const char *path,
size_t path_len)
{
return git_path_validate_filesystem_with_suffix(path, path_len, 0);
return git_path_validate_length_with_suffix(path, path_len, 0);
}
/**

View File

@@ -76,7 +76,7 @@ GIT_INLINE(int) loose_path(
if (git_buf_joinpath(out, base, refname) < 0)
return -1;
return git_path_validate_filesystem_with_suffix(out->ptr, out->size,
return git_path_validate_length_with_suffix(out->ptr, out->size,
CONST_STRLEN(".lock"));
}
@@ -1361,7 +1361,7 @@ static int refdb_fs_backend__prune_refs(
git_buf_cstr(&relative_path));
if (!error)
error = git_path_validate_filesystem(base_path.ptr, base_path.size);
error = git_path_validate_length(base_path.ptr, base_path.size);
if (error < 0)
goto cleanup;

View File

@@ -239,7 +239,7 @@ GIT_INLINE(int) validate_repo_path(git_buf *path)
CONST_STRLEN("objects/pack/pack-.pack.lock") +
GIT_OID_HEXSZ;
return git_path_validate_filesystem_with_suffix(
return git_path_validate_length_with_suffix(
path->ptr, path->size, suffix_len);
}
@@ -3265,7 +3265,7 @@ int git_repository_validate_workdir_path(
const char *path)
{
if (should_validate_longpaths(repo))
return git_path_validate_filesystem(path, strlen(path));
return git_path_validate_length(path, strlen(path));
return 0;
}
@@ -3276,7 +3276,7 @@ int git_repository_validate_workdir_path_with_len(
size_t path_len)
{
if (should_validate_longpaths(repo))
return git_path_validate_filesystem(path, path_len);
return git_path_validate_length(path, path_len);
return 0;
}