commit - 466d3b326f73598d70e55b9cf69805cb3026be55
commit + d6c87207755e1465c12ad4f1620f634b5b1848c0
blob - 77e03da75c1d7aebde0f64917c66b39d8286e4d5
blob + d12affdac074ff5191c64ab279d7a440c809fa0d
--- lib/fileindex.c
+++ lib/fileindex.c
}
struct got_fileindex_entry *
-got_fileindex_entry_get(struct got_fileindex *fileindex, const char *path)
+got_fileindex_entry_get(struct got_fileindex *fileindex, const char *path,
+ size_t path_len)
{
struct got_fileindex_entry key;
memset(&key, 0, sizeof(key));
key.path = (char *)path;
- key.path_len = strlen(path);
+ key.path_len = path_len;
return RB_FIND(got_fileindex_tree, &fileindex->entries, &key);
}
blob - 41f2dcdaa4e970012cbda6aefd5199f0c86fa2a2
blob + f1d45067cc2bc9cfaae5350605b91b06a58f738f
--- lib/got_lib_fileindex.h
+++ lib/got_lib_fileindex.h
void got_fileindex_entry_remove(struct got_fileindex *,
struct got_fileindex_entry *);
struct got_fileindex_entry *got_fileindex_entry_get(struct got_fileindex *,
- const char *);
+ const char *, size_t);
const struct got_error *got_fileindex_read(struct got_fileindex *, FILE *);
typedef const struct got_error *(*got_fileindex_cb)(void *,
struct got_fileindex_entry *);
blob - fe6944aad53fa888590f9943509e0d7a8e3dd644
blob + 64ad2d2a33f73b97091df2ca65912cf37e9305e0
--- lib/worktree.c
+++ lib/worktree.c
const struct got_error *err = NULL;
if (ie == NULL)
- ie = got_fileindex_entry_get(fileindex, path);
+ ie = got_fileindex_entry_get(fileindex, path, strlen(path));
if (ie)
err = got_fileindex_entry_update(ie, ondisk_path,
blob->id.sha1, worktree->base_commit_id->sha1,
int local_changes_subsumed;
if (blob1 && blob2) {
- ie = got_fileindex_entry_get(a->fileindex, path2);
+ ie = got_fileindex_entry_get(a->fileindex, path2,
+ strlen(path2));
if (ie == NULL)
return (*a->progress_cb)(a->progress_arg,
GOT_STATUS_MISSING, path2);
ondisk_path, path2, sb.st_mode, blob2, a->commit_id2, repo,
a->progress_cb, a->progress_arg);
} else if (blob1) {
- ie = got_fileindex_entry_get(a->fileindex, path1);
+ ie = got_fileindex_entry_get(a->fileindex, path1,
+ strlen(path1));
if (ie == NULL)
return (*a->progress_cb)(a->progress_arg,
GOT_STATUS_MISSING, path2);
if (asprintf(&ondisk_path, "%s/%s", a->worktree->root_path,
path2) == -1)
return got_error_from_errno("asprintf");
- ie = got_fileindex_entry_get(a->fileindex, path2);
+ ie = got_fileindex_entry_get(a->fileindex, path2,
+ strlen(path2));
if (ie) {
err = get_file_status(&status, &sb, ie, ondisk_path,
repo);
struct got_fileindex_entry *ie;
struct stat sb;
- ie = got_fileindex_entry_get(fileindex, path);
+ ie = got_fileindex_entry_get(fileindex, path, strlen(path));
if (ie)
return report_file_status(ie, ondisk_path, status_cb,
status_arg, repo);
struct got_fileindex_entry *ie;
/* Re-adding an existing entry is a no-op. */
- if (got_fileindex_entry_get(fileindex, relpath) != NULL)
+ if (got_fileindex_entry_get(fileindex, relpath, strlen(relpath)))
return NULL;
err = got_fileindex_entry_alloc(&ie, ondisk_path, relpath, NULL, NULL);
unsigned char status;
struct stat sb;
- ie = got_fileindex_entry_get(fileindex, relpath);
+ ie = got_fileindex_entry_get(fileindex, relpath, strlen(relpath));
if (ie == NULL)
return got_error(GOT_ERR_BAD_PATH);
if (err)
goto done;
- ie = got_fileindex_entry_get(fileindex, relpath);
+ ie = got_fileindex_entry_get(fileindex, relpath, strlen(relpath));
if (ie == NULL) {
err = got_error(GOT_ERR_BAD_PATH);
goto done;
struct got_fileindex_entry *ie;
struct got_commitable *ct = pe->data;
- ie = got_fileindex_entry_get(fileindex, pe->path);
+ ie = got_fileindex_entry_get(fileindex, pe->path, pe->path_len);
if (ie) {
if (ct->status == GOT_STATUS_DELETE) {
got_fileindex_entry_remove(fileindex, ie);