All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	david@lang.hm, Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] reset --hard/read-tree --reset -u: remove unmerged new paths
Date: Thu, 16 Oct 2008 09:20:10 +0200	[thread overview]
Message-ID: <20081016072010.GA19188@elte.hu> (raw)
In-Reply-To: <7vy70ppiq1.fsf_-_@gitster.siamese.dyndns.org>


* Junio C Hamano <gitster@pobox.com> wrote:

> When aborting a failed merge that has brought in a new path using "git 
> reset --hard" or "git read-tree --reset -u", we used to first forget 
> about the new path (via read_cache_unmerged) and then matched the 
> working tree to what is recorded in the index, thus ending up leaving 
> the new path in the work tree.

i've met this problem in various variants in the past few months, and i 
always assumed that it's "as designed" - as Git's policy is to never 
lose information unless forced to do so. (which i find very nice in 
general, and which saved modification from getting lost a couple of 
times in the past)

the situations where i end up with a messed up working tree [using 
git-c427559 right now]:

 - doing a conflicted Octopus merge will leave the tree in some weird 
   half-merged state, with lots of untracked working tree files that not 
   even a hard reset will recover from. The routine thing i do to clean 
   up is:

      git reset --hard HEAD
      git checkout HEAD .
      git ls-files --others | xargs rm              # DANGEROUS

   doing git checkout -f alone is not enough, as there might be various 
   dangling files left around.

 - git auto-gc thinking that it needs to do another pass in the middle 
   of a random git operation, but i dont have 10 minutes to wait so i 
   decide to Ctrl-C it.

 - doing the wrong "git checkout" and then Ctlr-C-ing it can leave the
   working tree in limbo as well, needing fixups. If i'm stuck between
   two branches that rename/remove files it might need the full fixup
   sequence above.

 - if a testbox has a corrupted system clock, its git repo and the 
   kernel build can get confused. This is to be expected i think - but
   the full sequence above will recover the corrupted tree. Not much Git
   can do about this i guess.

Does your fix mean that all i have to do in the future is a hard reset 
back to HEAD, and that dangling files are not supposed to stay around?

	Ingo

  parent reply	other threads:[~2008-10-16  7:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 18:56 Untracked working tree files Andrew Morton
2008-10-15 19:09 ` david
2008-10-15 19:14   ` david
2008-10-15 19:24     ` Andrew Morton
2008-10-15 19:26     ` Andrew Morton
2008-10-15 19:32       ` Nicolas Pitre
2008-10-15 19:34         ` Nicolas Pitre
2008-10-15 19:31     ` Linus Torvalds
2008-10-15 19:42       ` david
2008-10-15 19:56         ` Linus Torvalds
2008-10-15 20:17           ` david
2008-10-15 19:49       ` Andrew Morton
2008-10-15 20:08         ` Linus Torvalds
2008-10-15 20:23           ` Andrew Morton
2008-10-16  8:42             ` Paolo Ciarrocchi
2008-10-16  9:32               ` Andrew Morton
2008-10-15 20:23           ` Linus Torvalds
2008-10-15 20:30             ` Andrew Morton
2008-10-15 22:06             ` Junio C Hamano
2008-10-15 23:00               ` [PATCH] reset --hard/read-tree --reset -u: remove unmerged new paths Junio C Hamano
2008-10-15 23:16                 ` Linus Torvalds
2008-10-16  6:27                   ` Junio C Hamano
2008-10-16  7:20                 ` Ingo Molnar [this message]
2008-10-16 14:49                   ` Junio C Hamano

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=20081016072010.GA19188@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=david@lang.hm \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=torvalds@linux-foundation.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.