tenseleyflow/gitswitch / 64a8fb4

Browse files

fix: don't set gpg.program, GNUPGHOME suffices

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
64a8fb470ef0ec1aca036129a97ddd41f6d38d09
Parents
3f30371
Tree
8902f69

1 changed file

StatusFile+-
M src/gpg_manager.c 5 9
src/gpg_manager.cmodified
@@ -390,15 +390,11 @@ int gpg_configure_git_signing(gpg_config_t *gpg_config, const account_t *account
390390
         return -1;
391391
     }
392392
     
393
-    /* Set GPG program if using isolated environment */
394
-    if (gpg_config->mode == GPG_MODE_ISOLATED && strlen(gpg_config->gnupg_home) > 0) {
395
-        char gpg_command[MAX_PATH_LEN + 50];
396
-        if (safe_snprintf(gpg_command, sizeof(gpg_command), "gpg --homedir '%s'", gpg_config->gnupg_home) == 0) {
397
-            if (git_set_config_value("gpg.program", gpg_command, scope) != 0) {
398
-                log_warning("Failed to set git GPG program");
399
-            }
400
-        }
401
-    }
393
+    /* GNUPGHOME is already set via gpg_set_environment() - no need to override
394
+     * gpg.program. git inherits the env var and gpg uses it automatically.
395
+     * Setting gpg.program to "gpg --homedir ..." breaks because git execs it
396
+     * as a single binary path, not a shell command. */
397
+    git_unset_config_value("gpg.program", scope);
402398
     
403399
     log_info("Git GPG signing configured successfully for account: %s", account->name);
404400
     return 0;