| 2006 | } |
| 2007 | |
| 2008 | static int run_add_p_common(struct add_p_state *state, |
| 2009 | const struct pathspec *ps, |
| 2010 | unsigned flags) |
| 2011 | { |
| 2012 | size_t binary_count = 0; |
| 2013 | size_t i; |
| 2014 | |
| 2015 | if (parse_diff(state, ps) < 0) |
| 2016 | return -1; |
| 2017 | |
| 2018 | for (i = 0; i < state->file_diff_nr;) { |
| 2019 | if (state->file_diff[i].binary && !state->file_diff[i].hunk_nr) { |
| 2020 | binary_count++; |
| 2021 | i++; |
| 2022 | continue; |
| 2023 | } |
| 2024 | if ((i = patch_update_file(state, i, flags)) == state->file_diff_nr) |
| 2025 | break; |
| 2026 | } |
| 2027 | |
| 2028 | if (!state->cfg.auto_advance) |
| 2029 | for (i = 0; i < state->file_diff_nr; i++) |
| 2030 | apply_patch(state, state->file_diff + i); |
| 2031 | |
| 2032 | if (state->file_diff_nr == 0) |
| 2033 | err(state, _("No changes.")); |
| 2034 | else if (binary_count == state->file_diff_nr) |
| 2035 | err(state, _("Only binary files changed.")); |
| 2036 | |
| 2037 | return 0; |
| 2038 | } |
| 2039 | |
| 2040 | int run_add_p(struct repository *r, enum add_p_mode mode, |
| 2041 | struct interactive_options *opts, const char *revision, |
no test coverage detected