Re: Possible regression: overwriting untracked files in a fresh repo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 24, 2009 at 06:31:21PM +0200, Johannes Schindelin wrote:

> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]