mirror of
https://github.com/AGWA/git-crypt.git
synced 2025-12-05 20:40:05 -08:00
When adding GPG collaborator, include full fingerprint in commit message
Short key IDs are bad (https://evil32.com/) Closes: #253
This commit is contained in:
@@ -1297,7 +1297,8 @@ int add_gpg_user (int argc, const char** argv)
|
||||
std::ostringstream commit_message_builder;
|
||||
commit_message_builder << "Add " << collab_keys.size() << " git-crypt collaborator" << (collab_keys.size() != 1 ? "s" : "") << "\n\nNew collaborators:\n\n";
|
||||
for (std::vector<std::pair<std::string, bool> >::const_iterator collab(collab_keys.begin()); collab != collab_keys.end(); ++collab) {
|
||||
commit_message_builder << '\t' << gpg_shorten_fingerprint(collab->first) << ' ' << gpg_get_uid(collab->first) << '\n';
|
||||
commit_message_builder << " " << collab->first << '\n';
|
||||
commit_message_builder << " " << gpg_get_uid(collab->first) << '\n';
|
||||
}
|
||||
|
||||
// git commit -m MESSAGE NEW_FILE ...
|
||||
|
||||
6
gpg.cpp
6
gpg.cpp
@@ -61,12 +61,6 @@ static std::string gpg_nth_column (const std::string& line, unsigned int col)
|
||||
line.substr(pos);
|
||||
}
|
||||
|
||||
// given a key fingerprint, return the last 8 nibbles
|
||||
std::string gpg_shorten_fingerprint (const std::string& fingerprint)
|
||||
{
|
||||
return fingerprint.size() == 40 ? fingerprint.substr(32) : fingerprint;
|
||||
}
|
||||
|
||||
// given a key fingerprint, return the key's UID (e.g. "John Smith <jsmith@example.com>")
|
||||
std::string gpg_get_uid (const std::string& fingerprint)
|
||||
{
|
||||
|
||||
1
gpg.hpp
1
gpg.hpp
@@ -41,7 +41,6 @@ struct Gpg_error {
|
||||
explicit Gpg_error (std::string m) : message(m) { }
|
||||
};
|
||||
|
||||
std::string gpg_shorten_fingerprint (const std::string& fingerprint);
|
||||
std::string gpg_get_uid (const std::string& fingerprint);
|
||||
std::vector<std::string> gpg_lookup_key (const std::string& query);
|
||||
std::vector<std::string> gpg_list_secret_keys ();
|
||||
|
||||
Reference in New Issue
Block a user