Skip to content

gitdir overwrites files without confirmation #33

Description

@alichtman

Thanks for this tool! I accidentally overwrote some of my files earlier, and I think this is a preventable mistake.

https://github.com/sdushantha/gitdir/blob/0c071cca295907df216c93251803f5076cd82165/gitdir/gitdir.py#L103C17-L103C43

You can reproduce the problem with:

$ cd /tmp

$ gitdir https://github.com/sdushantha/gitdir/tree/master/gitdir
Downloaded: __init__.py
Downloaded: __main__.py
Downloaded: gitdir.py
✔ Download complete

$ echo "will be deleted" > gitdir/__main__.py

$ gitdir https://github.com/sdushantha/gitdir/tree/master/gitdir
Downloaded: __init__.py
Downloaded: __main__.py
Downloaded: gitdir.py
✔ Download complete

$ head gitdir/__main__.py
from .gitdir import main

main()

I'd propose adding a prompt to confirm, and a --force,-f flag

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions