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

Junio C Hamano [off-list ref] writes:
Tobias Preuss [off-list ref] writes:
quoted
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".
...
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.
Addendum 1.

    If *.o files are not treated expendable, you would be forced to
    "make clean" every time you switch between these two branches,
    which is unacceptable.

Addendum 2.

    There was an old wishlist item to introduce another class of
    paths (in addition to the "tracked", "untracked" and "ignored")
    that are "ignored-but-precious".  Then "*.o" would still be
    expendable while a directory that must become a regular file
    with "ignored-but-precious" files in it would prevent switching
    from branch 'side' to 'master' in the illustration in the
    previous message in order to keep that "ignored-but-precious"
    file.

    But nobody needed such a feature badly enough to step up and
    implement it.

    cf. http://article.gmane.org/gmane.comp.version-control.git/185746
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help