remove implicit entry update from got_fileindex_entry_alloc(); just alloc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
diff --git a/lib/fileindex.c b/lib/fileindex.c
index 40c3a03..61af7dd 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -125,8 +125,7 @@ got_fileindex_entry_mark_deleted_from_disk(struct got_fileindex_entry *ie)
const struct got_error *
got_fileindex_entry_alloc(struct got_fileindex_entry **ie,
- const char *ondisk_path, const char *relpath, uint8_t *blob_sha1,
- uint8_t *commit_sha1)
+ const char *relpath)
{
size_t len;
@@ -147,8 +146,7 @@ got_fileindex_entry_alloc(struct got_fileindex_entry **ie,
len = GOT_FILEIDX_F_PATH_LEN;
(*ie)->flags |= len;
- return got_fileindex_entry_update(*ie, ondisk_path, blob_sha1,
- commit_sha1, 1);
+ return NULL;
}
void
diff --git a/lib/got_lib_fileindex.h b/lib/got_lib_fileindex.h
index 1291a03..88f07ec 100644
--- a/lib/got_lib_fileindex.h
+++ b/lib/got_lib_fileindex.h
@@ -105,7 +105,7 @@ mode_t got_fileindex_perms_to_st(struct got_fileindex_entry *);
const struct got_error *got_fileindex_entry_update(struct got_fileindex_entry *,
const char *, uint8_t *, uint8_t *, int);
const struct got_error *got_fileindex_entry_alloc(struct got_fileindex_entry **,
- const char *, const char *, uint8_t *, uint8_t *);
+ const char *);
void got_fileindex_entry_free(struct got_fileindex_entry *);
struct got_fileindex *got_fileindex_alloc(void);
diff --git a/lib/worktree.c b/lib/worktree.c
index 9f99172..34717c9 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -910,10 +910,18 @@ update_blob_fileindex_entry(struct got_worktree *worktree,
update_timestamps);
else {
struct got_fileindex_entry *new_ie;
- err = got_fileindex_entry_alloc(&new_ie, ondisk_path,
- path, blob->id.sha1, worktree->base_commit_id->sha1);
- if (!err)
- err = got_fileindex_entry_add(fileindex, new_ie);
+ err = got_fileindex_entry_alloc(&new_ie, path);
+ if (err)
+ return err;
+ err = got_fileindex_entry_update(new_ie, ondisk_path,
+ blob->id.sha1, worktree->base_commit_id->sha1, 1);
+ if (err) {
+ got_fileindex_entry_free(new_ie);
+ return err;
+ }
+ err = got_fileindex_entry_add(fileindex, new_ie);
+ if (err)
+ got_fileindex_entry_free(new_ie);
}
return err;
}
@@ -2198,10 +2206,15 @@ merge_file_cb(void *arg, struct got_blob_object *blob1,
a->progress_cb, a->progress_arg);
if (err)
goto done;
- err = got_fileindex_entry_alloc(&ie,
- ondisk_path, path2, NULL, NULL);
+ err = got_fileindex_entry_alloc(&ie, path2);
if (err)
goto done;
+ err = got_fileindex_entry_update(ie, ondisk_path,
+ NULL, NULL, 1);
+ if (err) {
+ got_fileindex_entry_free(ie);
+ goto done;
+ }
err = got_fileindex_entry_add(a->fileindex, ie);
if (err) {
got_fileindex_entry_free(ie);
@@ -2909,10 +2922,14 @@ schedule_addition(void *arg, unsigned char status, unsigned char staged_status,
goto done;
}
- err = got_fileindex_entry_alloc(&ie, ondisk_path, relpath, NULL, NULL);
+ err = got_fileindex_entry_alloc(&ie, relpath);
if (err)
goto done;
-
+ err = got_fileindex_entry_update(ie, ondisk_path, NULL, NULL, 1);
+ if (err) {
+ got_fileindex_entry_free(ie);
+ goto done;
+ }
err = got_fileindex_entry_add(a->fileindex, ie);
if (err) {
got_fileindex_entry_free(ie);
@@ -4291,14 +4308,20 @@ update_fileindex_after_commit(struct got_pathlist_head *commitable_paths,
new_base_commit_id->sha1,
!have_staged_files);
} else {
- err = got_fileindex_entry_alloc(&ie,
- ct->ondisk_path, pe->path, ct->blob_id->sha1,
- new_base_commit_id->sha1);
+ err = got_fileindex_entry_alloc(&ie, pe->path);
if (err)
break;
+ err = got_fileindex_entry_update(ie, ct->ondisk_path,
+ ct->blob_id->sha1, new_base_commit_id->sha1, 1);
+ if (err) {
+ got_fileindex_entry_free(ie);
+ break;
+ }
err = got_fileindex_entry_add(fileindex, ie);
- if (err)
+ if (err) {
+ got_fileindex_entry_free(ie);
break;
+ }
}
}
return err;
diff --git a/regress/cmdline/histedit.sh b/regress/cmdline/histedit.sh
old mode 100744
new mode 100755
diff --git a/regress/cmdline/ref.sh b/regress/cmdline/ref.sh
old mode 100744
new mode 100755