git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Horst von Brand <vonbrand@inf.utfsm.cl>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Return error when not checking out an entry due to dirtiness.
Date: Tue, 04 Oct 2005 15:52:01 -0400	[thread overview]
Message-ID: <200510041952.j94Jq1Hs016453@laptop11.inf.utfsm.cl> (raw)
In-Reply-To: Message from Junio C Hamano <junkio@cox.net>  of "Mon, 03 Oct 2005 22:11:03 MST." <7vu0fxhno8.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> Without -f flag, 'git-checkout-index foo.c' issued an error message
> when foo.c already existed in the working tree and did not match index.
> However it did not return an error from the underlying checkout_entry()
> function and resulted in a successful exit(0).
> 
> Signed-off-by: Junio C Hamano <junkio@cox.net>
> 
> ---
> 
>  * I've made sure that the existing scripts do not use
>    checkout-index without -f in a way that could be affected by
>    this change.  However, third-party scripts may be affected by
>    this.  Cogito and StGIT should be OK -- they either run
>    checkout with -f, do not check the error return when it does
>    not use -f, or runs checkout without -f in an empty working
>    tree.
> 
>  checkout-index.c |   11 ++++++++---
>  entry.c          |    2 +-
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> 5a166f6a9d1b7ca2de673139fbfc4112b1b2e308
> diff --git a/checkout-index.c b/checkout-index.c
> --- a/checkout-index.c
> +++ b/checkout-index.c
> @@ -63,15 +63,20 @@ static int checkout_file(const char *nam
>  
>  static int checkout_all(void)
>  {
> -	int i;
> +	int i, errs;
>  
> -	for (i = 0; i < active_nr ; i++) {
> +	for (errs = i = 0; i < active_nr ; i++) {

This is ugly. Why not just:

        errs = 0;
        for (i = 0; i < active_nr ; i++) {    

(errs is in no way the variable controlled by the for).
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

      reply	other threads:[~2005-10-04 19:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-04  5:11 [PATCH] Return error when not checking out an entry due to dirtiness Junio C Hamano
2005-10-04 19:52 ` Horst von Brand [this message]

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=200510041952.j94Jq1Hs016453@laptop11.inf.utfsm.cl \
    --to=vonbrand@inf.utfsm.cl \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).