else
active_cache[pos]->ce_flags &= ~flag;
cache_tree_invalidate_path(active_cache_tree, path);
- active_cache_changed = 1;
+ active_cache_changed = SOMETHING_CHANGED;
return 0;
}
return -1;
goto fail;
}
cache_tree_invalidate_path(active_cache_tree, path);
- active_cache_changed = 1;
+ active_cache_changed = SOMETHING_CHANGED;
report("chmod %cx '%s'", flip, path);
return;
fail:
INDEX_FORMAT_LB, INDEX_FORMAT_UB);
if (the_index.version != preferred_index_format)
- active_cache_changed = 1;
+ active_cache_changed = SOMETHING_CHANGED;
the_index.version = preferred_index_format;
}
#define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1)
+#define SOMETHING_CHANGED (1 << 0) /* unclassified changes go here */
+#define CE_ENTRY_CHANGED (1 << 1)
+#define CE_ENTRY_REMOVED (1 << 2)
+#define CE_ENTRY_ADDED (1 << 3)
+
struct index_state {
struct cache_entry **cache;
unsigned int version;
remove_name_hash(istate, old);
free(old);
set_index_entry(istate, nr, ce);
- istate->cache_changed = 1;
+ istate->cache_changed |= CE_ENTRY_CHANGED;
}
void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
record_resolve_undo(istate, ce);
remove_name_hash(istate, ce);
free(ce);
- istate->cache_changed = 1;
+ istate->cache_changed |= CE_ENTRY_REMOVED;
istate->cache_nr--;
if (pos >= istate->cache_nr)
return 0;
}
if (j == istate->cache_nr)
return;
- istate->cache_changed = 1;
+ istate->cache_changed |= CE_ENTRY_REMOVED;
istate->cache_nr = j;
}
istate->cache + pos,
(istate->cache_nr - pos - 1) * sizeof(ce));
set_index_entry(istate, pos, ce);
- istate->cache_changed = 1;
+ istate->cache_changed |= CE_ENTRY_ADDED;
return 0;
}
!(ce->ce_flags & CE_VALID))
updated->ce_flags &= ~CE_VALID;
+ /* istate->cache_changed is updated in the caller */
return updated;
}
* means the index is not valid anymore.
*/
ce->ce_flags &= ~CE_VALID;
- istate->cache_changed = 1;
+ istate->cache_changed |= CE_ENTRY_CHANGED;
}
if (quiet)
continue;
string_list_clear(resolve_undo, 1);
free(resolve_undo);
istate->resolve_undo = NULL;
- istate->cache_changed = 1;
+ istate->cache_changed = SOMETHING_CHANGED;
}
int unmerge_index_entry_at(struct index_state *istate, int pos)