Git rebase --exec cannot run git commands affecting other repos

From: Samir Benmendil <hidden>
Date: 2019-01-10 16:19:10

It is impossible to run git commands affecting a different repo from 
within a `git rebase --exec` because in that environment the `GIT_DIR` 
and `GIT_WORK_TREE` variables are set and inherited by any commands run 
as part of `git rebase --exec`.

A minimal reproduction is shown below:

    git init
    touch file
    git add file
    git commit -m"Commit"
    git rebase --root --exec="git clone . subrepo"

It is a bit convoluted for the sake of being self contained. But any git 
command in `--exec` acting on a different repo than the one being 
rebased will fail. See my ticket on CMake [0] for a more real usecase.

As mentioned in the other ticket, unsetting these variables will work 
around the issue.

    git rebase --root --exec="env -u GIT_DIR -u GIT_WORK_TREE git clone . subrepo"


[0] https://gitlab.kitware.com/cmake/cmake/issues/18778

Regards

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help