@matheusbsbs / matheus-bagliano / commits / 1ac83f42da
Fork 0

unpack-trees: rename ERROR_* fields meant for warnings to WARNING_*

We want to treat issues with setting the SKIP_WORKTREE bit as a warning rather than an error; rename the enum values to reflect this intent as a simple step towards that goal. Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Mar 27, 2020 at 00:48 UTC 1ac83f42da6437d74098f162fcfa37474c94e223
2 files changed +11 -9
unpack-trees.c
+6 -6
@@ -46,10 +46,10 @@ static const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
46 /* ERROR_WOULD_LOSE_SUBMODULE */
47 "Submodule '%s' cannot checkout new HEAD.",
48
49 - /* ERROR_SPARSE_NOT_UPTODATE_FILE */
49 + /* WARNING_SPARSE_NOT_UPTODATE_FILE */
50 "Entry '%s' not uptodate. Cannot update sparse checkout.",
51
52 - /* ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN */
52 + /* WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN */
53 "Working tree file '%s' would be overwritten by sparse checkout update.",
54 };
55
@@ -168,9 +168,9 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
168 msgs[ERROR_WOULD_LOSE_SUBMODULE] =
169 _("Cannot update submodule:\n%s");
170
171 - msgs[ERROR_SPARSE_NOT_UPTODATE_FILE] =
171 + msgs[WARNING_SPARSE_NOT_UPTODATE_FILE] =
172 _("Cannot update sparse checkout: the following entries are not up to date:\n%s");
173 - msgs[ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN] =
173 + msgs[WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN] =
174 _("The following working tree files would be overwritten by sparse checkout update:\n%s");
175
176 opts->show_all_errors = 1;
@@ -509,7 +509,7 @@ static int apply_sparse_checkout(struct index_state *istate,
509 ce->ce_flags &= ~CE_UPDATE;
510 }
511 if (was_skip_worktree && !ce_skip_worktree(ce)) {
512 - if (verify_absent_sparse(ce, ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN, o))
512 + if (verify_absent_sparse(ce, WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN, o))
513 return -1;
514 ce->ce_flags |= CE_UPDATE;
515 }
@@ -1875,7 +1875,7 @@ int verify_uptodate(const struct cache_entry *ce,
1875 static int verify_uptodate_sparse(const struct cache_entry *ce,
1876 struct unpack_trees_options *o)
1877 {
1878 - return verify_uptodate_1(ce, o, ERROR_SPARSE_NOT_UPTODATE_FILE);
1878 + return verify_uptodate_1(ce, o, WARNING_SPARSE_NOT_UPTODATE_FILE);
1879 }
1880
1881 /*
unpack-trees.h
+5 -3
@@ -23,9 +23,11 @@ enum unpack_trees_error_types {
23 ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
24 ERROR_BIND_OVERLAP,
25 ERROR_WOULD_LOSE_SUBMODULE,
26 - ERROR_SPARSE_NOT_UPTODATE_FILE,
27 - ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
28 - NB_UNPACK_TREES_ERROR_TYPES
26 +
27 + WARNING_SPARSE_NOT_UPTODATE_FILE,
28 + WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN,
29 +
30 + NB_UNPACK_TREES_ERROR_TYPES,
31 };
32
33 /*