Skip to content

Let the user merge branches.#141

Open
tobiasBora wants to merge 1 commit into
AGWA:masterfrom
tobiasBora:master
Open

Let the user merge branches.#141
tobiasBora wants to merge 1 commit into
AGWA:masterfrom
tobiasBora:master

Conversation

@tobiasBora

Copy link
Copy Markdown

A pretty simple pull request that let the user merge branches. This should correct this bug: #140

@iGEL

iGEL commented Feb 12, 2018

Copy link
Copy Markdown

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 😢

@tobiasBora

tobiasBora commented Feb 12, 2018 via email

Copy link
Copy Markdown
Author

@iGEL

iGEL commented Feb 12, 2018

Copy link
Copy Markdown

Thank you for the reply 👍

@ericamador

Copy link
Copy Markdown

Will either this or #107 get merged at some point?

@Quentin-M

Quentin-M commented Oct 31, 2018

Copy link
Copy Markdown

git-crypt is basically unusable without this. Is there any reason @AGWA this never has been merged?

@plup

plup commented Nov 3, 2018

Copy link
Copy Markdown

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

Comment thread commands.cpp
if (access(state_mergetool_path.c_str(), F_OK) != 0) {
std::ofstream state_mergetool_file(state_mergetool_path.c_str());
// |--------------------------------------------------------------------------------| 80 chars
state_mergetool_file << "#!/usr/bin/env bash\n";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use /bin/sh instead of /usr/bin/env bash for better compatibility – not every system ships bash by default. /bin/sh exists on every *nix system, it’s defined by POSIX, and this script is compatible with POSIX shell.

@joaosa

joaosa commented Jan 26, 2021

Copy link
Copy Markdown

I know it's been a while, but is there any chance this could be merged provided the issue above gets fixed? :)

@Quentin-M

Copy link
Copy Markdown

There's also #180

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.

7 participants