File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -82,15 +82,25 @@ static int git_sysdir_guess_global_dirs(git_buf *out)
8282#else
8383 int error ;
8484 uid_t uid , euid ;
85+ const char * sandbox_id ;
8586
8687 uid = getuid ();
8788 euid = geteuid ();
8889
90+ /**
91+ * If APP_SANDBOX_CONTAINER_ID is set, we are running in a
92+ * sandboxed environment on macOS.
93+ */
94+ sandbox_id = getenv ("APP_SANDBOX_CONTAINER_ID" );
95+
8996 /*
9097 * In case we are running setuid, use the configuration
9198 * of the effective user.
99+ *
100+ * If we are running in a sandboxed environment on macOS,
101+ * we have to get the HOME dir from the password entry file.
92102 */
93- if (uid == euid )
103+ if (! sandbox_id && uid == euid )
94104 error = git__getenv (out , "HOME" );
95105 else
96106 error = get_passwd_home (out , euid );
You can’t perform that action at this time.
0 commit comments