Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make git-crypt add-gpg-user -k default fool-proof #265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,12 @@ static bool decrypt_repo_keys (std::vector<Key_file>& key_files, uint32_t key_ve

static void encrypt_repo_key (const char* key_name, const Key_file::Entry& key, const std::vector<std::pair<std::string, bool> >& collab_keys, const std::string& keys_path, std::vector<std::string>* new_files)
{
if (!key_name)
key_name = "default";
std::string key_file_data;
{
Key_file this_version_key_file;
this_version_key_file.set_key_name(key_name);
this_version_key_file.set_key_name(std::strcmp(key_name, "default") != 0 ? key_name : nullptr);
this_version_key_file.add(key);
key_file_data = this_version_key_file.store_to_string();
}
Expand All @@ -689,7 +691,7 @@ static void encrypt_repo_key (const char* key_name, const Key_file::Entry& key,
const std::string& fingerprint(collab->first);
const bool key_is_trusted(collab->second);
std::ostringstream path_builder;
path_builder << keys_path << '/' << (key_name ? key_name : "default") << '/' << key.version << '/' << fingerprint << ".gpg";
path_builder << keys_path << '/' << key_name << '/' << key.version << '/' << fingerprint << ".gpg";
std::string path(path_builder.str());

if (access(path.c_str(), F_OK) == 0) {
Expand Down