summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
authorYoichi Nakayama <yoichi.nakayama@gmail.com>2021-11-23 10:12:29 +0900
committerYoichi Nakayama <yoichi.nakayama@gmail.com>2021-11-23 10:20:04 +0900
commit7bb206a76dca70b7db236315d348c6c9fc325cab (patch)
treee38bb2d225746de8343db08837840e84aad3ece0 /src/checkout.c
parent540b02f3b97baf2bc1d62210a23d522b5d73e5eb (diff)
parentf9c4dc10d90732cfbe2271dd58b01dd8f4003d15 (diff)
downloadlibgit2-7bb206a76dca70b7db236315d348c6c9fc325cab.tar.gz
Merge branch 'main' into better-compatiblity-for-at-time-notation
Conflicts: src/revparse.c
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/checkout.c b/src/checkout.c
index b31918fc8..11be2e84f 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -27,10 +27,11 @@
#include "diff_generate.h"
#include "pathspec.h"
#include "diff_xdiff.h"
-#include "path.h"
+#include "fs_path.h"
#include "attr.h"
#include "pool.h"
#include "strmap.h"
+#include "path.h"
/* See docs/checkout-internals.md for more information */
@@ -44,7 +45,7 @@ enum {
CHECKOUT_ACTION__UPDATE_CONFLICT = 32,
CHECKOUT_ACTION__MAX = 32,
CHECKOUT_ACTION__REMOVE_AND_UPDATE =
- (CHECKOUT_ACTION__UPDATE_BLOB | CHECKOUT_ACTION__REMOVE),
+ (CHECKOUT_ACTION__UPDATE_BLOB | CHECKOUT_ACTION__REMOVE)
};
typedef struct {
@@ -328,7 +329,7 @@ static int checkout_target_fullpath(
if (path && git_str_puts(&data->target_path, path) < 0)
return -1;
- if (git_path_validate_workdir_buf(data->repo, &data->target_path) < 0)
+ if (git_path_validate_str_length(data->repo, &data->target_path) < 0)
return -1;
*out = &data->target_path;
@@ -347,7 +348,7 @@ static bool wd_item_is_removable(
if (checkout_target_fullpath(&full, data, wd->path) < 0)
return false;
- return !full || !git_path_contains(full, DOT_GIT);
+ return !full || !git_fs_path_contains(full, DOT_GIT);
}
static int checkout_queue_remove(checkout_data *data, const char *path)
@@ -481,7 +482,7 @@ static bool checkout_is_empty_dir(checkout_data *data, const char *path)
if (checkout_target_fullpath(&fullpath, data, path) < 0)
return false;
- return git_path_is_empty_dir(fullpath->ptr);
+ return git_fs_path_is_empty_dir(fullpath->ptr);
}
static int checkout_action_with_wd(
@@ -1201,12 +1202,12 @@ static int checkout_conflicts_mark_directoryfile(
goto done;
}
- prefixed = git_path_equal_or_prefixed(path, entry->path, NULL);
+ prefixed = git_fs_path_equal_or_prefixed(path, entry->path, NULL);
- if (prefixed == GIT_PATH_EQUAL)
+ if (prefixed == GIT_FS_PATH_EQUAL)
continue;
- if (prefixed == GIT_PATH_PREFIX)
+ if (prefixed == GIT_FS_PATH_PREFIX)
conflict->directoryfile = 1;
break;
@@ -1280,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;
}
@@ -1949,7 +1950,7 @@ static int checkout_path_suffixed(git_str *path, const char *suffix)
path_len = git_str_len(path);
- while (git_path_exists(git_str_cstr(path)) && i < INT_MAX) {
+ while (git_fs_path_exists(git_str_cstr(path)) && i < INT_MAX) {
git_str_truncate(path, path_len);
if ((error = git_str_putc(path, '_')) < 0 ||
@@ -2034,7 +2035,7 @@ static int checkout_merge_path(
int error = 0;
if ((error = git_str_joinpath(out, data->opts.target_directory, result->path)) < 0 ||
- (error = git_path_validate_workdir_buf(data->repo, out)) < 0)
+ (error = git_path_validate_str_length(data->repo, out)) < 0)
return error;
/* Most conflicts simply use the filename in the index */
@@ -2337,10 +2338,10 @@ static int validate_target_directory(checkout_data *data)
{
int error;
- if ((error = git_path_validate_workdir(data->repo, data->opts.target_directory)) < 0)
+ if ((error = git_path_validate_length(data->repo, data->opts.target_directory)) < 0)
return error;
- if (git_path_isdir(data->opts.target_directory))
+ if (git_fs_path_isdir(data->opts.target_directory))
return 0;
error = checkout_mkdir(data, data->opts.target_directory, NULL,
@@ -2507,7 +2508,7 @@ static int checkout_data_init(
(error = git_vector_init(&data->remove_conflicts, 0, NULL)) < 0 ||
(error = git_vector_init(&data->update_conflicts, 0, NULL)) < 0 ||
(error = git_str_puts(&data->target_path, data->opts.target_directory)) < 0 ||
- (error = git_path_to_dir(&data->target_path)) < 0 ||
+ (error = git_fs_path_to_dir(&data->target_path)) < 0 ||
(error = git_strmap_new(&data->mkdir_map)) < 0)
goto cleanup;