AGWA / AGWA/git-crypt

`git worktree add` in repo with encrypted commited file made encrypted fails.

Đang mở
#105 19 bình luận 34 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
9.9k
Fork
544
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I've tested this on debian jessie, with `git/testing` (2.11.0-1) from `http://ftp.us.debian.org/debian/ testing/main amd64 Packages`.

What I observe is, `git worktree add`'s failure behavior falls into, what I get the impression to be, a large range of compatibility problems that stem from having a previously committed file with the same path as a current encrypted file. I'm curios if a `.gitcryptignore` and `.git/info/gitcryptignore` type file to list files for which the error condition triggered for "an older version of this file may be unencrypted in the repository's history." does not interrupt git plumbing commands.

Its a bit annoying that all worktree's have to independently be decrypted; maybe a feature to apply lock/unlocks across all work trees would be a nice configuration option to add. `git config --global gitcrypt.globalworktreelockstate true` kinda thing.
```
# Init
$ git init example
$ cd example/
$ git crypt init
$ git crypt exampleport-key ../example.gitcrypt
$ cat .gitattributes
secretfile filter=git-crypt diff=git-crypt
*.key filter=git-crypt diff=git-crypt

# Encrypted file Works
$ touch secretfile
$ git add secretfile
$ git commit secretfile -m "add secret file, encrypted"

$ git crypt lock
$ git worktree add ../example1 # Success

$ git crypt unlock ../example.gitcrypt
$ git worktree add ../example2 # Success

# Unencrypted file turned encrypted fails unless repo is locked
$ touch file
$ git add file
$ git commit file -m "unencrypted file"
$ cat .gitattributes
secretfile filter=git-crypt diff=git-crypt
file filter=git-crypt diff=git-crypt
*.key filter=git-crypt diff=git-crypt

$ git rm --cached file
$ git add file .gitattributes
$ git commit file .gitattributes -m "encrypt file"

$ git worktree add ../example3 # Fails (128)
Preparing ../example3 (identifier example3)
git-crypt: Error: Unable to open key file - have you unlocked/initialized this repository yet?
error: external filter '"/usr/local/bin/git-crypt" smudge' failed 1
error: external filter '"/usr/local/bin/git-crypt" smudge' failed
fatal: file: smudge filter git-crypt failed

$ echo $?
128

$ git crypt lock
$ git worktree add ../example4 # Works
$ git crypt unlock ../example.gitcrypt

$ cd ../example4/
$ git crypt unlock ../example.gitcrypt # Must also decrypt the work tree
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.