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

Re: [PATCH v2 1/2] sparse checkout: show error messages when worktree shaping fails

From
Joshua Jensen <jjensen@workspacewhiz.com>
Date
Sep 22, 2011, 19:57 UTC
Message-ID
<4E7B931F.5010600@workspacewhiz.com>
In-Reply-To
<1316690663-29382-1-git-send-email-pclouds@gmail.com>
----- Original Message -----
From: Nguyễn Thái Ngọc Duy
Date: 9/22/2011 5:24 AM
Show 39 quoted lines
> diff --git a/unpack-trees.c b/unpack-trees.c
> index cc616c3..fcf40a0 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -1089,6 +1089,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
>   		 */
>   		mark_new_skip_worktree(o->el,&o->result, CE_ADDED, CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE);
>
> +		ret = 0;
>   		for (i = 0; i<  o->result.cache_nr; i++) {
>   			struct cache_entry *ce = o->result.cache[i];
>
> @@ -1101,17 +1102,23 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
>   			 * correct CE_NEW_SKIP_WORKTREE
>   			 */
>   			if (ce->ce_flags&  CE_ADDED&&
> -			    verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN, o))
> -					return -1;
> +			    verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN, o)) {
> +				if (!o->show_all_errors)
> +					goto return_failed;
> +				ret = -1;
> +			}
>
>   			if (apply_sparse_checkout(ce, o)) {
> +				if (!o->show_all_errors)
> +					goto return_failed;
>   				ret = -1;
> -				goto done;
>   			}
>   			if (!ce_skip_worktree(ce))
>   				empty_worktree = 0;
>
>   		}
> +		if (ret<  0)
> +			goto return_failed;
>   		if (o->result.cache_nr&&  empty_worktree) {
>   			/* dubious---why should this fail??? */
>   			ret = unpack_failed(o, "Sparse checkout leaves no entry on working directory");

I can confirm that this version of the patch works for me with multiple untracked files in a sparse checkout.

-Josh
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 4 of 5 in “Re: [PATCH 1/2] sparse checkout: show error messages when worktree shaping fails”
  1. Joshua JensenSep 21, 2011
  2. Junio C HamanoSep 21, 2011
  3. 1/2 sparse checkout: show error messages when worktree shaping failsNguyễn Thái Ngọc Duy, Sep 22, 2011
  4. Joshua JensenSep 22, 2011
  5. 2/2 Add explanation why we do not allow to sparse checkout to empty working treeNguyễn Thái Ngọc Duy, Sep 22, 2011

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.