Re: [PATCH 12/15] unpack-trees: check if we can perform the operation for submodules
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 16, 2017, 21:23 UTC
- Message-ID
- <xmqqy3x5vnh1.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170216003811.18273-13-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
> + > + /* ERROR_WOULD_LOSE_UNTRACKED_SUBMODULE */ > + "Submodule '%s' cannot be deleted as it contains untracked files.",
OK.
> + msgs[ERROR_WOULD_LOSE_UNTRACKED_SUBMODULE] =
> + _("Submodule '%s' cannot be deleted as it contains untracked files.");OK again.
Show 10 quoted lines
> @@ -240,12 +246,44 @@ static void display_error_msgs(struct unpack_trees_options *o)
> fprintf(stderr, _("Aborting\n"));
> }
>
> +static int submodule_check_from_to(const struct cache_entry *ce, const char *old_id, const char *new_id, struct unpack_trees_options *o)
> +{
> + if (submodule_go_from_to(ce->name, old_id,
> + new_id, 1, o->reset))
> + return o->gently ? -1 :
> + add_rejected_path(o, ERROR_WOULD_LOSE_UNTRACKED_SUBMODULE, ce->name);Is potential loss of untracked paths the only reason submodule_go_from_to() would fail? I somehow thought that it would not even care about untracked paths but cared deeply about already added changes.