StackExchange / blackbox

Safely store secrets in Git/Mercurial/Subversion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recommended ways for resolving merge conflicts in encrypted files.

sanjo-joy opened this issue · comments

Hi,
I was trying to integrate Blackbox with our project and have came across a situation where I got merge conflicts while applying the stashed changes. Please find the detailed steps below:

  1. Make some changes, encrypt the file, and commit the changes (probably the gpg file).
  2. Checkout to a new branch, decrypt the file make changes to the same file at same line.
  3. Encrypt the file again commit the changes(let's say commit with id 'xyz').
  4. Checkout to the previous branch.
  5. Decrypt the file again (This would decrypt the file with the changes in the current branch, just to make sure no changes from the new branch is available at this moment).
  6. Make changes to the same file same place (Just to create a possible scenario for conflict).
  7. Encrypt the file again and then stash this change.
  8. Cherry-pick the commit we made earlier from the new branch (the commit with id 'xyz').
  9. Then apply the stashed changes. This would probably create a merge conflict.

May also try some other situations that would create a merge conflict.

In these situations of a merge conflicts I am unable to resolve it as the conflict is showing in the encrypted file.

Currently a workaround we have in mind is to decrypt both the versions of the file. Then compare and accept the changes manually.

I believe this is not directly related to Blackbox and more of a binary file related thing. But it would be really helpful to know how others are getting around this issue. I have found similar issue #73 , but couldn't find much information from it, so created this again.

Thanks,
Sanjo

Hi there!

Sorry to hear you are having this problem.

I agree that this is a problem with Git, not blackbox. Blackbox is a layer on top of Git, we don't try to fix Git's problems.

The manual merge is easier if you configure Git to understand how to diff the files. Here's some advice about that: https://gist.github.com/marceloalmeida/e6593b93b388cdf1dbc282dffd424d1b

Hope that helps!

Hi,
Thanks for the quick response.

The manual merge is easier if you configure Git to understand how to diff the files. Here's some advice about that: https://gist.github.com/marceloalmeida/e6593b93b388cdf1dbc282dffd424d1b

This sounds good to me. I think I can proceed with this approach.
Thanks for the help,
Sanjo