* Chmod an index entry with either +x or -x. * * Returns -1 if the chmod for the particular cache entry failed (if it's * not a regular file), -2 if an invalid flip argument is passed in, 0 * otherwise. */
| 905 | * otherwise. |
| 906 | */ |
| 907 | int chmod_index_entry(struct index_state *istate, struct cache_entry *ce, |
| 908 | char flip) |
| 909 | { |
| 910 | if (!S_ISREG(ce->ce_mode)) |
| 911 | return -1; |
| 912 | switch (flip) { |
| 913 | case '+': |
| 914 | ce->ce_mode |= 0111; |
| 915 | break; |
| 916 | case '-': |
| 917 | ce->ce_mode &= ~0111; |
| 918 | break; |
| 919 | default: |
| 920 | return -2; |
| 921 | } |
| 922 | cache_tree_invalidate_path(istate, ce->name); |
| 923 | ce->ce_flags |= CE_UPDATE_IN_BASE; |
| 924 | mark_fsmonitor_invalid(istate, ce); |
| 925 | istate->cache_changed |= CE_ENTRY_CHANGED; |
| 926 | |
| 927 | return 0; |
| 928 | } |
| 929 | |
| 930 | int ce_same_name(const struct cache_entry *a, const struct cache_entry *b) |
| 931 | { |
no test coverage detected