File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ default() {
4646 info-box " Configuring signature..."
4747 local listkeys=" gpg --list-secret-keys --keyid-format long $( git config --local user.email) "
4848 command-text ${listkeys}
49- ${listkeys}
49+ ${listkeys} 2> /dev/null || {
50+ info-text " There is no gpg key for the given email."
51+ info-text " A signature is not configured."
52+ return 0
53+ }
5054 info-text " From the list of GPG keys above, copy the GPG key ID you'd like to use."
5155 info-text " It will be"
5256 info-text " 3AA5C34371567BD2"
Original file line number Diff line number Diff line change @@ -157,3 +157,22 @@ teardown() {
157157 [[ ! ${lines[@]} =~ " ==>> git config --local tag.gpgSign true" ]]
158158 [[ ! ${lines[@]} =~ " The signature is not configured as the empty key is provided." ]]
159159}
160+
161+ @test " 'acquire-repository': does not configure a signature if there is no key for the email" {
162+ read-answer " The User"
163+ read-answer " the@email"
164+ read-answer " someeditor"
165+ read-answer " "
166+ fake-fail " gpg --list-secret-keys --keyid-format long the@email" " gpg: error reading key: No secret key"
167+ check git-elegant acquire-repository
168+ [[ ${status} -eq 0 ]]
169+ [[ ${lines[@]} =~ " Configuring signature..." ]]
170+ [[ ${lines[@]} =~ " There is no gpg key for the given email." ]]
171+ [[ ${lines[@]} =~ " A signature is not configured." ]]
172+ [[ ! ${lines[@]} =~ " ==>> git config --local user.signingkey" ]]
173+ [[ ! ${lines[@]} =~ " ==>> git config --local gpg.program /tmp/elegant-git-fakes/gpg" ]]
174+ [[ ! ${lines[@]} =~ " ==>> git config --local commit.gpgsign true" ]]
175+ [[ ! ${lines[@]} =~ " ==>> git config --local tag.forceSignAnnotated true" ]]
176+ [[ ! ${lines[@]} =~ " ==>> git config --local tag.gpgSign true" ]]
177+ [[ ! ${lines[@]} =~ " The signature is not configured as the empty key is provided." ]]
178+ }
You can’t perform that action at this time.
0 commit comments