Thread (71 messages) flat view 71 messages, 7 authors, 2019-02-09

Re: [PATCH 3/8] entry: support CE_WT_REMOVE flag in checkout_entry

From: Duy Nguyen <hidden>
Date: 2018-12-10 15:58:38

On Sun, Dec 9, 2018 at 9:05 PM Thomas Gummerer [off-list ref] wrote:
quoted hunk ↗ jump to hunk
'checkout_entry()' currently only supports creating new entries in the
working tree, but not deleting them.  Add the ability to remove
entries at the same time if the entry is marked with the CE_WT_REMOVE
flag.

Currently this doesn't have any effect, as the CE_WT_REMOVE flag is
only used in unpack-tree, however we will make use of this in a
subsequent step in the series.

Signed-off-by: Thomas Gummerer <redacted>
---
 entry.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/entry.c b/entry.c
index 3ec148ceee..cd1c6601b6 100644
--- a/entry.c
+++ b/entry.c
@@ -441,6 +441,13 @@ int checkout_entry(struct cache_entry *ce,
        static struct strbuf path = STRBUF_INIT;
        struct stat st;

+       if (ce->ce_flags & CE_WT_REMOVE) {
+               if (topath)
+                       BUG("Can't remove entry to a path");
+               unlink_entry(ce);
+               return 0;
+       }
This makes the path counting in nd/checkout-noisy less accurate. But
it's not your fault of course.

Junio, do you still want to merge that series down to 'next' or drop
it? If it will be merged down, I'll keep a note and fix it once this
one lands too.
+
        if (topath)
                return write_entry(ce, topath, state, 1);

--
2.20.0.405.gbc1bbc6f85

-- 
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