Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Bug report: Folder and files are deleted by git stash -u

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:03:44

Tobias Preuss [off-list ref] writes:
I noticed some bizarre behaviour when using: git stash -u.
It deletes folders which contain files configured to be ignored.
The files you mark as ignored are expendable and this is not limited
to "stash".

    $ git init
    Initialized empty Git repository in /var/tmp/x/ignore/.git/
    $ echo \*.o >.gitignore
    $ git add .gitignore
    $ git commit -m void
    [master (root-commit) 457b70e] void
     1 file changed, 1 insertion(+)
     create mode 100644 .gitignore
    $ echo a regular file >a
    $ git add a
    $ git commit -m "a regular file"
    [master df839f0] a regular file
     1 file changed, 1 insertion(+)
     create mode 100644 a

We have two regular files, .gitignore and a, on 'master' branch.

    $ git checkout -b side HEAD^
    Switched to a new branch 'side'
    $ mkdir a
    $ >a/file.c
    $ >a/file.o
    $ git add .
    $ git commit -m 'a/file.c'
    [side 3199d63] a/file.c
     1 file changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 a/file.c

We have two regular files, .gitignore and a/file.c, on 'side' branch,
which is checked out.  The object files that would be created by
compiling source files are set to be ignored by .gitignore rule.

Here is what should happen when you go to 'master':

    $ git checkout master
    Switched to branch 'master'
    $ /bin/ls -AF
    a  .git/  .gitignore

That is, a/file.c that is safely stored in 'side' branch is removed,
a/file.o that is expendable is deleted, and the empty directory 'a'
now can be replaced with the regular file 'a' the 'master' branch
wants to have.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help