Kentzo / git-archive-all

A python script wrapper for git-archive that archives a git superproject and its submodules, if it has any. Takes into account .gitattributes
MIT License
372 stars 81 forks source link

Optionally specify the main git repository #73

Closed lbonn closed 4 years ago

lbonn commented 5 years ago

Follows git's convention for option naming.

The use case was to add extra files to the archive from an external directory, in cases where the main directory is not user-writeable.

codecov[bot] commented 5 years ago

Codecov Report

Merging #73 into master will increase coverage by 8.29%. The diff coverage is 57.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   52.94%   61.24%   +8.29%     
==========================================
  Files           1        1              
  Lines         255      258       +3     
  Branches       48       49       +1     
==========================================
+ Hits          135      158      +23     
+ Misses        100       77      -23     
- Partials       20       23       +3
Impacted Files Coverage Δ
git_archive_all.py 61.24% <57.14%> (+8.29%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0d1806d...53042d3. Read the comment docs.

Kentzo commented 5 years ago

Thank you for the PR!

Could you add a test?

lbonn commented 4 years ago

Sure!

I think I would need a bit of guidance on your part though. This PR doesn't make change in the core logic but just exposes some parameter on the command line. In fact, tests currently rely on the main_repo_abspath parameter to Repo.

So, were you thinking about a test for the command line handling, that shells out to the executable directly? I don't think those exist right now, do you have a specific opinion on the best way to add that to the suite now?

Kentzo commented 4 years ago

Check out https://github.com/Kentzo/git-archive-all/blob/master/test_git_archive_all.py: most of the tests rely on shell to set up the git environment. You can add new test function there, just make sure it sets up and cleans a temporary directory for its doing.

lbonn commented 4 years ago

Ok I tried to write a test that actually goes through optparse.

Kentzo commented 4 years ago

Thank you!