"Your local changes ... would be overwritten" bug

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

"Your local changes ... would be overwritten" bug

From: Hannu Koivisto <hidden>
Date: 2016-06-15 22:51:58

Greetings,

I have a problem where "git checkout origin/another-branch" in master
should remove a set of files but instead I get:

error: Your local changes to the following files would be overwritten by checkout:
        file1
        file2
        ...
Please, commit your changes or stash them before you can switch branches.
Aborting

(where the files listed are those that should be removed)

The problem occurs only if the checkout is not run in the top level
directory of the repository and the files in question have execute
bit set.  Before checkout, git status says

# On branch master
nothing to commit (working directory clean)

The following script can be used to reproduce the problem:

-------------------------------------------
mkdir temp
cd temp
git init
echo foo > testfile
git add testfile
git commit -m "test1"
echo foo > testfile2
chmod +x testfile2
git add testfile2
git commit -m "test2"
mkdir foo
cd foo
git co master~1
--------------------------------------------

The problem disappears if one removes either the "chmod +x
testfile2" line or the "cd foo" line.

I'm running Cygwin git 1.7.5.1 in Windows XP.

-- 
Hannu

Re: "Your local changes ... would be overwritten" bug

From: Clemens Buchacher <hidden>
Date: 2016-06-15 22:51:59

Hi,

On Mon, Sep 05, 2011 at 07:25:53PM +0300, Hannu Koivisto wrote:
I have a problem where "git checkout origin/another-branch" in master
should remove a set of files but instead I get:

error: Your local changes to the following files would be overwritten by checkout:
        file1
        file2
        ...
Please, commit your changes or stash them before you can switch branches.
Aborting
Could you set a breakpoint in add_rejected_path and send us the
backtrace? Like this:

$ gdb --args git checkout origin/another-branch
quoted
break add_rejected_path
r
... wait for break ...
quoted
bt
Thanks,
Clemens

Re: "Your local changes ... would be overwritten" bug

From: Hannu Koivisto <hidden>
Date: 2016-06-15 22:51:59

Clemens Buchacher [off-list ref] writes:
Could you set a breakpoint in add_rejected_path and send us the
backtrace? Like this:
Since the binary from the package doesn't come with debug
information, I built the latest git master (1.7.7.rc0.72.g4b5ea)
and it turns out the problem cannot be reproduced with this version
anymore.  I guess I should have tried that right away.  Sorry for
the noise.

-- 
Hannu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help