Thread (8 messages) flat view 8 messages, 3 authors, 2016-06-15

Re: [PATCH v8 4/4] cache-tree: Write updated cache-tree after commit

From: Duy Nguyen <hidden>
Date: 2016-06-15 23:01:54

On Sat, Jul 12, 2014 at 11:44 AM, David Turner [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -342,6 +342,15 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,

                discard_cache();
                read_cache_from(index_lock.filename);
+               if (update_main_cache_tree(WRITE_TREE_SILENT) == 0) {
+                       fd = open(index_lock.filename, O_WRONLY);
+                       if (fd >= 0)
+                               if (write_cache(fd, active_cache, active_nr) == 0) {
+                                       close_lock_file(&index_lock);
If write_cache() returns a negative value, index.lock is probably
corrupted. Should we die() instead of moving on and returning
index_lock.filename to the caller? The caller may move index.lock to
index later on and officially ruin "index".
+                       }
+               }
+               else
+                       fprintf(stderr, "FAiled to update main cache tree\n");
make the above line something like this for i18n support:

fprintf_ln(stderr, _("Failed to update main cache tree"));
                commit_style = COMMIT_NORMAL;
                return index_lock.filename;
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help