Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Conversation

@jmurty
Copy link

@jmurty jmurty commented Nov 4, 2019

On init, add a pre-commit Git hook script to check
Transcrypt-managed files and abort a commit if
there is an un-encrypted file staged in the index
that would otherwise be committed in plaintext.

This is a safety mechanism to prevent accidental
commits of plain text files that have been staged
by tools that do not respect or run the
.gitattribute filters that Transcrypt needs to do
its job.

On commit failure, the error message says how to
re-stage the file using Git on the command line.

Because Git hooks work with single scripts only
it is difficult to cleanly install and uninstall
hook scripts, especially if the user already has
a pre-commit hook script in place.

To handle this situation cleanly if naively

  • on init, check if the user already has a
    pre-commit script and instead of clobbering it,
    save the script to the working directory and
    print a message asking the user to install it
  • on uninstall, rename the pre-commit script
    instead of deleting and tell the user we have
    done so, to avoid deleting a script the user
    might have customised.

On init, add a pre-commit Git hook script to check
Transcrypt-managed files and abort a commit if
there is an un-encrypted file staged in the index
that would otherwise be committed in plaintext.

This is a safety mechanism to prevent accidental
commits of plain text files that have been staged
by tools that do not respect or run the
.gitattribute filters that Transcrypt needs to do
its job.

On commit failure, the error message says how to
re-stage the file using Git on the command line.

Because Git hooks work with single scripts only
it is difficult to cleanly install and uninstall
hook scripts, especially if the user already has
a pre-commit hook script in place.

To handle this situation cleanly if naively

- on init, check if the user already has a
  pre-commit script and instead of clobbering it,
  save the script to the working directory and
  print a message asking the user to install it
- on uninstall, rename the pre-commit script
  instead of deleting and tell the user we have
  done so, to avoid deleting a script the user
  might have customised.
@jmurty jmurty merged commit 08bc3d2 into master Nov 4, 2019
jmurty added a commit to ixc/ixc-django-docker that referenced this pull request Nov 12, 2019
Update the `transcrypt` encryption utility to be
based on upstream's version 1.1.0 but also with
new features from our IC fork:

- on init, add a merge driver to properly handle
  merge of secrets files with conflicting changes:
  ixc/transcrypt#1
  The .gitattributes file is also adjusted to
  apply the merge driver.
- on init, add a Git pre-commit hook script to
  abort commit if raw content of a secrets file
  is not properly encrypted:
  ixc/transcrypt#2
- cherry-picked upstream fix to silence spurious
  warnings:
  github.com/elasticdog/transcrypt/commit/9a8a1f

Script sourced from
ixc/transcrypt@e9e1d96c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants