Open tobiasBora opened 6 years ago
Does this also help with git add -p
? I'm using that all the time and git considers the encrypted files to be binary, silently ignoring them 😢
I'm sorry, put my patch seems to work with git merge, with the mergetools, ans with cherry-picking, but patching seems to be another problem. It looks like that there is no way to create a custom "patch" command thar overwrite the default behaviour, but it may be possible to write a custom script that do the sane thing, maybe by temporary jumping to a temp uncrypted git project, run the git add here, copy the file in the current folder, stash it, and replace it with the new version, but I'm not sure that there no better way to proceed… Sorry.
Thank you for the reply 👍
Will either this or https://github.com/AGWA/git-crypt/pull/107 get merged at some point?
git-crypt is basically unusable without this. Is there any reason @AGWA this never has been merged?
I tested this PR with the following process:
Initiate a repo with git-crypt:
$ mkdir /tmp/test1
$ cd !$
$ git init
Initialized empty Git repository in /tmp/test1/.git/
$ git-crypt init
Generating key...
$ git-crypt add-gpg-user plup@plup.io
[master (root-commit) dc75cba] Add 1 git-crypt collaborator
3 files changed, 19 insertions(+)
create mode 100644 .git-crypt/.gitattributes
create mode 100644 .git-crypt/keys/default/0/8A236E404A25F35A96B6ED57A953BD11758ED9D4.gpg
create mode 100644 .git-crypt/merge-tool.sh
$ vi .gitattributes
* filter=git-crypt diff=git-crypt merge=git-crypt
.gitattributes !filter !diff !merge
$ echo 'some text' > text
$ git add .
$ git commit -m "added text"
$ git remote add origin git@github.com:plup/test.git
$ git push -u origin master
Create a second local repo:
$ git clone git@github.com:plup/test.git /tmp/test2
$ cd !$
$ git-crypt unlock
Make modification in both local repos:
$ cd /tmp/test1
$ echo 'another text' > text
$ git commit -am "wrote another text"
$ git push
$ cd /tmp/test2
$ echo 'will this work ?' > test
$ git commit -am "wrote another text again"
Try to merge:
$ git pull
From github.com:plup/test
767190d..e98211c master -> origin/master
# Git crypt driver called #
Auto-merging text
CONFLICT (content): Merge conflict in text
Automatic merge failed; fix conflicts and then commit the result.
$ cat text
<<<<<<< current branch
will this work ?
=======
another text
>>>>>>> other branch
So yeah, it works !
But this requires to start from a fresh repository as the script merge-tool.sh
is created when gpg keys are added to the repository.
Thanks @tobiasBora
I know it's been a while, but is there any chance this could be merged provided the issue above gets fixed? :)
There's also https://github.com/AGWA/git-crypt/pull/180
A pretty simple pull request that let the user merge branches. This should correct this bug: https://github.com/AGWA/git-crypt/issues/140