DeeNewcum / dotfiles

my personal config files
12 stars 4 forks source link

Use the right ~/.gitconfig when running under ~/.sudo_bashrc #1

Closed DeeNewcum closed 12 years ago

DeeNewcum commented 12 years ago

When you sudo to root, it should pull in $STDIN_OWNERS_HOME/.gitconfig instead of ~root/.gitconfig.

Currently, there's no clear way to do this:

The closest I can think of is:

git() {
    HOME=$STDIN_OWNERS_HOME command git "$@"
}

(ie. do the $HOME hack, but only when running the 'git' command) However, that has the downside that any program that would get spawned by git (eg. external merge, external diff) would behave wonky.

Surely, there's SOME way to do this?

DeeNewcum commented 12 years ago

One way is to use ViewOS's umfuse (background info).

But I'm very wary of adding any dependencies that I don't absolutely need, because that means I'd need to manually compile them on a lot of different machines.

DeeNewcum commented 12 years ago

Another possibility is to use FUSE along with FunionFS, unionfs-fuse, mhddfs, FuniFS, or NubiSave.

DeeNewcum commented 12 years ago

The downsides of using

git() {
    HOME=$STDIN_OWNERS_HOME command git "$@"
}

happens mainly whenever git spawns a major program: