git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] pathspec: give better message for submodule related pathspec error

From
BWBrandon Williams <bmwill@google.com>
Date
Dec 28, 2016, 18:13 UTC
Message-ID
<20161228181335.GA33595@google.com>
In-Reply-To
<20161228000559.17842-1-sbeller@google.com>
On 12/27, Stefan Beller wrote:
Show 43 quoted lines
> Every once in a while someone complains to the mailing list to have
> run into this weird assertion[1].
> 
> The usual response from the mailing list is link to old discussions[2],
> and acknowledging the problem stating it is known.
> 
> For now just improve the user visible error message.
> 
> [1] https://www.google.com/search?q=item-%3Enowildcard_len
> [2] http://git.661346.n2.nabble.com/assert-failed-in-submodule-edge-case-td7628687.html
>     https://www.spinics.net/lists/git/msg249473.html
> 
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> 
> If you were following the mailing list closely today, you may sense
> that I am cleaning up stalled branches. :)
> 
> I think such a hot fix is warranted given how often we had reports
> on the mailing list.
> 
> Thanks,
> Stefan
> 
>  pathspec.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/pathspec.c b/pathspec.c
> index 22ca74a126..d522f43331 100644
> --- a/pathspec.c
> +++ b/pathspec.c
> @@ -313,8 +313,11 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
>  	}
>  
>  	/* sanity checks, pathspec matchers assume these are sane */
> -	assert(item->nowildcard_len <= item->len &&
> -	       item->prefix         <= item->len);
> +	if (item->nowildcard_len <= item->len &&
> +	    item->prefix         <= item->len)
> +		die (_("Path leads inside submodule '%s', but the submodule "
> +		       "was not recognized, i.e. not initialized or deleted"),
> +		       ce->name);
>  	return magic;

I haven't been following everything on the list these past couple days, but are we sure this is caused by submodules? Also variable 'ce' shouldn't be in scope here.

-- 
Brandon Williams
Previous: Brandon Williams
Message 5 of 5 in “pathspec: give better message for submodule related pathspec error”
  1. pathspec: give better message for submodule related pathspec errorStefan Beller, Dec 28, 2016
  2. Jeff KingDec 28, 2016
  3. [PATCHv2] pathspec: give better message for submodule related pathspec errorStefan Beller, Dec 28, 2016
  4. Brandon WilliamsDec 28, 2016
  5. Brandon WilliamsDec 28, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.