git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git rebase --exec cannot run git commands affecting other repos
@ 2019-01-10 16:19 Samir Benmendil
  2019-01-10 18:26 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Samir Benmendil @ 2019-01-10 16:19 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-11 16:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10 16:19 Git rebase --exec cannot run git commands affecting other repos Samir Benmendil
2019-01-10 18:26 ` Junio C Hamano
2019-01-10 21:48   ` Samir Benmendil
2019-01-11 16:04     ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).