git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Samir Benmendil <me@rmz.io>
To: git@vger.kernel.org
Subject: Git rebase --exec cannot run git commands affecting other repos
Date: Thu, 10 Jan 2019 16:19:04 +0000	[thread overview]
Message-ID: <20190110161904.23fwbrgg7blyx3nj@uh-nuc001> (raw)

[-- 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 --]

             reply	other threads:[~2019-01-10 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 16:19 Samir Benmendil [this message]
2019-01-10 18:26 ` Git rebase --exec cannot run git commands affecting other repos Junio C Hamano
2019-01-10 21:48   ` Samir Benmendil
2019-01-11 16:04     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190110161904.23fwbrgg7blyx3nj@uh-nuc001 \
    --to=me@rmz.io \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).