@@ -174,9 +174,18 @@ fi`,
174174 if [ "\${FAKE_GIT_IDENTITY_MISSING:-}" = "1" ]; then exit 1; fi
175175 echo "contributor@example.com"
176176 ;;
177+ *" config --get --type=bool commit.gpgsign "*)
178+ if [ "\${FAKE_GIT_SIGNING_MISSING:-}" = "1" ]; then exit 1; fi
179+ if [ "\${FAKE_GIT_SIGNING_UNSET:-}" = "1" ]; then exit 1; fi
180+ if [ "\${FAKE_GIT_SIGNING_INVALID:-}" = "1" ]; then
181+ echo "fatal: bad boolean config value" >&2
182+ exit 128
183+ fi
184+ echo "\${FAKE_GIT_SIGNING_BOOL-true}"
185+ ;;
177186 *" config --get commit.gpgsign "*)
178187 if [ "\${FAKE_GIT_SIGNING_MISSING:-}" = "1" ]; then exit 1; fi
179- echo "true "
188+ echo "1 "
180189 ;;
181190 *" config --get gpg.format "*)
182191 if [ "\${FAKE_GIT_SIGN_FORMAT_UNSET:-}" = "1" ]; then exit 1; fi
@@ -444,6 +453,39 @@ describe("contributor environment doctor", () => {
444453 expect ( result . output ) . toContain ( "Git pre-push hook is missing" ) ;
445454 } ) ;
446455
456+ it . each ( [
457+ [ "disabled" , { FAKE_GIT_SIGNING_BOOL : "false" } ] ,
458+ [ "unset" , { FAKE_GIT_SIGNING_UNSET : "1" } ] ,
459+ [ "invalid" , { FAKE_GIT_SIGNING_INVALID : "1" } ] ,
460+ ] ) ( "rejects %s commit signing" , ( _scenario , env ) => {
461+ const fixture = createFixture ( ) ;
462+
463+ const result = runDoctor ( fixture , env ) ;
464+
465+ expect ( result . status ) . toBe ( 1 ) ;
466+ expect ( result . output ) . toContain ( "Git commit signing is incomplete" ) ;
467+ expect ( result . output ) . not . toContain ( "Git commit signing configured" ) ;
468+ expect ( result . output ) . not . toContain ( "Ready to create a feature branch." ) ;
469+ } ) ;
470+
471+ it . each ( [
472+ [ "true" , "commit.gpgsign=true" ] ,
473+ [ "yes" , "commit.gpgsign=yes" ] ,
474+ [ "on" , "commit.gpgsign=on" ] ,
475+ [ "1" , "commit.gpgsign=1" ] ,
476+ [ "uppercase" , "commit.gpgsign=TRUE" ] ,
477+ [ "valueless" , "commit.gpgsign" ] ,
478+ ] ) ( "lets Git normalize the %s commit-signing spelling" , ( _scenario , configArg ) => {
479+ const result = spawnSync (
480+ "git" ,
481+ [ "-c" , configArg , "config" , "--get" , "--type=bool" , "commit.gpgsign" ] ,
482+ { encoding : "utf-8" } ,
483+ ) ;
484+
485+ expect ( result . status ) . toBe ( 0 ) ;
486+ expect ( result . stdout . trim ( ) ) . toBe ( "true" ) ;
487+ } ) ;
488+
447489 it ( "rejects an unsupported git signing format with a precise remediation" , ( ) => {
448490 const fixture = createFixture ( ) ;
449491
0 commit comments