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

Doesn't support unsetting export-ignore #44

Closed legoktm closed 6 years ago

legoktm commented 6 years ago

Hi, we're looking to use this to replace our homegrown release script for MediaWiki, and it nearly has all the functionality we need. The one thing I noticed is that it doesn't appear to support unsetting the export-ignore attribute (as documented in https://www.git-scm.com/docs/gitattributes).

We want to ignore all dot files except for .htaccess, so I have the following in our .gitattributes:

.* export-ignore
*.htaccess -export-ignore

A standard git archive ... will include the .htaccess files, but it doesn't include the submodules that we want.

Would it be possible to have git-archive-all support unsetting the export-ignore property?

I wonder whether it would make more sense in the long term to rely on git's attribute parsing, e.g.:

$ git check-attr -a -- .eslintrc.json 
.eslintrc.json: export-ignore: set
$ git check-attr -a -- cache/.htaccess 
cache/.htaccess: export-ignore: unset
Kentzo commented 6 years ago

Didn't know of this feature.

Do you happen to recall when it was added to Git?

legoktm commented 6 years ago

It was introduced in https://github.com/git/git/commit/e4aee10a2eaf0937d86d046f85ee569a75cae9ac (11 years ago).

Kentzo commented 6 years ago

Perhaps the simplest fix is to check for "-export-ignore" before "export-ignore".

check-attr is a better alternative, but requires more work.

legoktm commented 6 years ago

I tried to just implement checking for -export-ignore but it ended up being more complicated than I expected, so I went ahead with the check-attr implementation and then I realized I could delete a ton of code.

Kentzo commented 6 years ago

I like it 👍