| 3886 | }; |
| 3887 | |
| 3888 | static int fix_unmerged_status(struct diff_filepair *p, |
| 3889 | struct update_callback_data *data) |
| 3890 | { |
| 3891 | if (p->status != DIFF_STATUS_UNMERGED) |
| 3892 | return p->status; |
| 3893 | if (!(data->flags & ADD_CACHE_IGNORE_REMOVAL) && !p->two->mode) |
| 3894 | /* |
| 3895 | * This is not an explicit add request, and the |
| 3896 | * path is missing from the working tree (deleted) |
| 3897 | */ |
| 3898 | return DIFF_STATUS_DELETED; |
| 3899 | else |
| 3900 | /* |
| 3901 | * Either an explicit add request, or path exists |
| 3902 | * in the working tree. An attempt to explicitly |
| 3903 | * add a path that does not exist in the working tree |
| 3904 | * will be caught as an error by the caller immediately. |
| 3905 | */ |
| 3906 | return DIFF_STATUS_MODIFIED; |
| 3907 | } |
| 3908 | |
| 3909 | static int skip_submodule(const char *path, |
| 3910 | struct repository *repo, |