All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Jensen <jjensen@workspacewhiz.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git checkout under 1.7.6 does not properly list untracked files and aborts
Date: Mon, 19 Sep 2011 13:44:36 -0600	[thread overview]
Message-ID: <4E779BA4.8070109@workspacewhiz.com> (raw)
In-Reply-To: <4E6A7167.6070408@workspacewhiz.com>

----- Original Message -----
From: Joshua Jensen
Date: 9/9/2011 2:04 PM
> This may be an msysGit 1.7.6 issue, as that is what I am using.  It 
> also occurs in msysGit 1.7.5, but I am almost certain it did not 
> happen in msysGit 1.7.2.
>
> Given an untracked file in the working directory that has been added 
> to an alternate branch, when switching to that alternate branch, 'git 
> checkout' exits with an error code but does not print anything to the 
> console.  It should print an untracked file error.
>
> I have been trying to track this down in code.  The point where the 
> error messages are printed, display_error_msgs, is never hit.
Okay, so I've tracked this down, but I am unsure what the correct fix is.

In unpack-trees.c's unpack_trees() function, there are some lines that read:

     if (ce->ce_flags & CE_ADDED &&
         verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN, o))
             return -1;

If the 'return -1' is changed to 'goto return_failed', then a proper 
error message appears:

     error: The following untracked working tree files would be 
overwritten by checkout:
         one/file/listed/here.txt
     Please move or remove them before you can switch branches.
     Aborting

The thing is, there are multiple files that would be overwritten by 
checkout, and I believe an older version of Git showed me the entire 
list before aborting.

What would be the proper fix here?  What am I doing wrong?

Thanks.

Josh

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

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-09 20:04 git checkout under 1.7.6 does not properly list untracked files and aborts Joshua Jensen
2011-09-19 19:44 ` Joshua Jensen [this message]
2011-09-19 20:06   ` Joshua Jensen
2011-09-20 15:10   ` Michael J Gruber
2011-09-20 18:26     ` Joshua Jensen
2011-09-21  7:47       ` Michael J Gruber
2011-09-21  7:48         ` [PATCH 0/3] read-tree cleanups Michael J Gruber
2011-09-21  7:48           ` [PATCH 1/3] unpack-trees: print "Aborting" to stderr Michael J Gruber
2011-09-21 22:02             ` Junio C Hamano
2011-09-21 22:40               ` Junio C Hamano
2011-09-22  5:58                 ` Michael J Gruber
2011-09-21  7:48           ` [PATCH 2/3] git-read-tree.txt: language and typography fixes Michael J Gruber
2011-09-21  7:48           ` [PATCH 3/3] git-read-tree.txt: correct sparse-checkout and skip-worktree description Michael J Gruber
2011-09-21  9:26             ` Nguyen Thai Ngoc Duy
2011-09-21  9:33               ` Michael J Gruber
2011-09-21  9:39                 ` Nguyen Thai Ngoc Duy
2011-09-21  7:51           ` [PATCH 0/3] read-tree cleanups Michael J Gruber
2011-09-21 12:14             ` Junio C Hamano
2011-09-21  8:28         ` git checkout under 1.7.6 does not properly list untracked files and aborts Michael J Gruber
2011-09-21  8:58           ` Nguyen Thai Ngoc Duy
2011-09-21  9:16             ` Michael J Gruber
2011-09-21 10:28               ` Nguyen Thai Ngoc Duy
2011-09-21 10:31                 ` Nguyen Thai Ngoc 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=4E779BA4.8070109@workspacewhiz.com \
    --to=jjensen@workspacewhiz.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.