Re: [PATCH v2] config: allow inaccessible configuration under $HOME

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan's patch would indeed be nice. In cgit, we are forced to do
ugly things like this:

        /* Do not look in /etc/ for gitconfig and gitattributes. */
        setenv("GIT_CONFIG_NOSYSTEM", "1", 1);
        setenv("GIT_ATTR_NOSYSTEM", "1", 1);

        /* We unset HOME and XDG_CONFIG_HOME before calling the git
setup function
         * so that we don't make unneccessary filesystem accesses. */
        user_home = getenv("HOME");
        xdg_home = getenv("XDG_CONFIG_HOME");
        unsetenv("HOME");
        unsetenv("XDG_CONFIG_HOME");

        /* Setup the git directory and initialize the notes system.
Both of these
         * load local configuration from the git repository, so we do
them both while
         * the HOME variables are unset. */
        setup_git_directory_gently(&nongit);
        init_display_notes(NULL);

        /* We restore the unset variables afterward. */
        if (user_home)
                setenv("HOME", user_home, 1);
        if (xdg_home)
                setenv("XDG_CONFIG_HOME", xdg_home, 1);

A big nasty guard around the git setup function, so that we don't error out.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]