Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New cmd to add file to crypt list (.gitattributes) #125

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

soraxas
Copy link

@soraxas soraxas commented Aug 29, 2021

This PR adds a convenient command that quickly adds file/patterns to .gitattribute. The command is available as git alias too (similar to git ls-crypt)

The command also checks if the given file/pattern already exists in the file, and it will be a no-op if the line already exists.

$ cat .gitattributes
#pattern  filter=crypt diff=crypt merge=crypt
$ git add-crypt foobar
$ cat .gitattributes
#pattern  filter=crypt diff=crypt merge=crypt
foobar  filter=crypt diff=crypt merge=crypt
$ git add-crypt 'configs/*.json'
$ cat .gitattributes
#pattern  filter=crypt diff=crypt merge=crypt
foobar  filter=crypt diff=crypt merge=crypt
configs/*.json  filter=crypt diff=crypt merge=crypt
$ git add-crypt 'foobar'
$ git add-crypt 'foobar'
$ git add-crypt 'foobar'
$ cat .gitattributes
#pattern  filter=crypt diff=crypt merge=crypt
foobar  filter=crypt diff=crypt merge=crypt
configs/*.json  filter=crypt diff=crypt merge=crypt

soraxas and others added 3 commits August 30, 2021 00:55
@jmurty
Copy link
Collaborator

jmurty commented Aug 31, 2021

Hi @soraxas this looks like a great feature!

Thanks also for cleaning up the git-common-dir vs git-dir logic. I have pushed some minor changes to get shellcheck and shfmt linting checks to pass.

@elasticdog What do you think of this approach and transcrypt add / git add-crypt command names?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants