SpatiumPortae / portal

Portal is a quick and easy command-line file transfer utility from any computer to another 🌌 ✨
https://portal.spatiumportae.com
MIT License
1.42k stars 37 forks source link

feat: Add support for ignoring files using gitignore #99

Closed mellonnen closed 1 year ago

mellonnen commented 1 year ago

If the --gitignore flag is supplied the behavior is:

Example:

.
├── dir
│   └── file.txt
└── gitrepository
    ├── .gitignore
    ├── .git
    │   ├── HEAD
    │   ├── config
    │   ├── description
    │   ├── hooks
    │   ├── info
    │   ├── objects
    │   └── refs
    ├── main.go
    └── somedir
        └── file.go

# .gitignore
somedir/

The feature is implemented by issuing git shell commands, which reduces the complexity of writing a gitignore parser instead relying on the actual git ignore implementation. However, if we are to use this approach we would make sure to test it in other shells (other than bash and zsh) like (powershell and cmd etc).

solves #97

codecov[bot] commented 1 year ago

Codecov Report

Merging #99 (0bbd57f) into develop (0958899) will increase coverage by 8.81%. The diff coverage is n/a.

Additional details and impacted files [![Impacted file tree graph](https://codecov.io/gh/SpatiumPortae/portal/pull/99/graphs/tree.svg?width=650&height=150&src=pr&token=FH5GXKW890&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SpatiumPortae)](https://codecov.io/gh/SpatiumPortae/portal/pull/99?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SpatiumPortae) ```diff @@ Coverage Diff @@ ## develop #99 +/- ## =========================================== + Coverage 31.71% 40.52% +8.81% =========================================== Files 6 6 Lines 227 227 =========================================== + Hits 72 92 +20 + Misses 135 109 -26 - Partials 20 26 +6 ``` [see 2 files with indirect coverage changes](https://codecov.io/gh/SpatiumPortae/portal/pull/99/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SpatiumPortae) [![Impacted file tree graph](https://codecov.io/gh/SpatiumPortae/portal/pull/99/graphs/tree.svg?width=650&height=150&src=pr&token=FH5GXKW890&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SpatiumPortae)](https://codecov.io/gh/SpatiumPortae/portal/pull/99?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SpatiumPortae)
ZinoKader commented 1 year ago

Nice stuff. I think using the git client makes a lot of sense, but I do think we should double check that git is installed and reachable/usable in the system quite early when the flag is passed. One might be working on a git-folder in a remote computer/container that does not have git installed, and the error should be clear in that case.