This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #167 from ministryofjustice/gitcrypt-merging
Add git-crypt merge driver
- Loading branch information
Showing
3 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
secretfile filter=git-crypt diff=git-crypt | ||
*.tfvars filter=git-crypt diff=git-crypt | ||
k8s-resources/grafana/config.yml filter=git-crypt diff=git-crypt | ||
k8s-resources/kibana-auth-proxy/envs/**/* filter=git-crypt diff=git-crypt | ||
k8s-resources/fluentd/envs/**/* filter=git-crypt diff=git-crypt | ||
k8s-resources/jenkins/envs/**/* filter=git-crypt diff=git-crypt | ||
k8s-resources/prometheus/envs/**/* filter=git-crypt diff=git-crypt | ||
infra/kops/clusters/**/* filter=git-crypt diff=git-crypt | ||
chart-env-config/**/* filter=git-crypt diff=git-crypt | ||
infra/terraform/modules/federated_identity/saml/**/* filter=git-crypt diff=git-crypt | ||
secretfile filter=git-crypt diff=git-crypt merge=git-crypt | ||
*.tfvars filter=git-crypt diff=git-crypt merge=git-crypt | ||
k8s-resources/grafana/config.yml filter=git-crypt diff=git-crypt merge=git-crypt | ||
k8s-resources/kibana-auth-proxy/envs/**/* filter=git-crypt diff=git-crypt merge=git-crypt | ||
k8s-resources/fluentd/envs/**/* filter=git-crypt diff=git-crypt merge=git-crypt | ||
k8s-resources/jenkins/envs/**/* filter=git-crypt diff=git-crypt merge=git-crypt | ||
k8s-resources/prometheus/envs/**/* filter=git-crypt diff=git-crypt merge=git-crypt | ||
infra/kops/clusters/**/* filter=git-crypt diff=git-crypt merge=git-crypt | ||
chart-env-config/**/* filter=git-crypt diff=git-crypt merge=git-crypt | ||
infra/terraform/modules/federated_identity/saml/**/* filter=git-crypt diff=git-crypt merge=git-crypt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
# See: https://github.com/AGWA/git-crypt/issues/140#issuecomment-361031719 | ||
ancestor_decrypted="$1__decrypt" | ||
current_decrypted="$2__decrypt" | ||
other_decrypted="$3__decrypt" | ||
echo "" | ||
echo "###########################" | ||
echo "# Git crypt driver called #" | ||
echo "###########################" | ||
echo "" | ||
|
||
echo "Decrypting ancestor file..." | ||
cat $1 | git-crypt smudge > "${ancestor_decrypted}" | ||
echo "Decrypting current file..." | ||
cat $2 | git-crypt smudge > "${current_decrypted}" | ||
echo "Decrypting other file..." | ||
cat $3 | git-crypt smudge > "${other_decrypted}" | ||
echo "" | ||
|
||
echo "Merging ..." | ||
git merge-file -L "current branch" -L "ancestor branch" -L "other branch" "${current_decrypted}" "${ancestor_decrypted}" "${other_decrypted}" | ||
exit_code=$? | ||
cat "${current_decrypted}" | git-crypt clean > $2 | ||
|
||
echo "Removing temporary files..." | ||
rm "${other_decrypted}" "${ancestor_decrypted}" "${current_decrypted}" | ||
|
||
if [ "$exit_code" -eq "0" ] | ||
then | ||
echo "@@@ No conflict!" | ||
else | ||
echo "@@@ You need to solve some conflicts..." | ||
fi | ||
|
||
exit $exit_code | ||
|