git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joshua Jensen <jjensen@workspacewhiz.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Michael J Gruber <git@drmicha.warpmail.net>
Subject: Re: [PATCH v2 1/2] sparse checkout: show error messages when worktree shaping fails
Date: Thu, 22 Sep 2011 13:57:19 -0600	[thread overview]
Message-ID: <4E7B931F.5010600@workspacewhiz.com> (raw)
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
> 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

  reply	other threads:[~2011-09-22 19:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1316602259-22576-1-git-send-email-pclouds@gmail.com>
2011-09-21 19:15 ` [PATCH 1/2] sparse checkout: show error messages when worktree shaping fails Joshua Jensen
2011-09-21 20:50 ` Junio C Hamano
2011-09-22 11:24   ` [PATCH v2 " Nguyễn Thái Ngọc Duy
2011-09-22 19:57     ` Joshua Jensen [this message]
2011-09-22 11:24   ` [PATCH v2 2/2] Add explanation why we do not allow to sparse checkout to empty working tree Nguyễn Thái Ngọc Duy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E7B931F.5010600@workspacewhiz.com \
    --to=jjensen@workspacewhiz.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).