Re: Possible regression: overwriting untracked files in a fresh repo
- From
Jeff King <peff@peff.net>
- Date
- Aug 24, 2009, 19:07 UTC
- Message-ID
- <20090824190710.GB25168@coredump.intra.peff.net>
- In-Reply-To
- <alpine.DEB.1.00.0908241829510.11375@intel-tinevez-2-302>
On Mon, Aug 24, 2009 at 06:31:21PM +0200, Johannes Schindelin wrote:
Show 8 quoted lines
> I _think_ that this used to complain about untracked files being > overwritten: > > $ git init > $ git remote add -f origin <url> > $ git checkout -b blub origin/master > > It does not do that here (any longer, IIAC). Intended?
I agree that it probably _should_ complain, but I don't think it ever did. I tried a handful of released versions as far back as v1.4.4, and all of them overwrite local files without complaining. My test was:
-- >8 -- #!/bin/sh
rm -rf parent child
mkdir parent && ( cd parent && git init-db && echo content >file && git add file && git commit -m add ) && mkdir child && ( cd child && git init-db && git fetch ../parent master:origin && echo precious >file && ! git checkout -b foo origin ) -- >8 --
However, if I then do this:
(cd parent && echo content >another && git add . && git commit -m more) (cd child && git fetch ../parent && git checkout -b new FETCH_HEAD)
then it does complain. I'm guessing there is a different code path for the case that we have no index at all, and that it is not properly checking for overwrites.
But now I have a small child waking up so I can't look into it further. :)
-Peff