Re: rev-parse --show-toplevel broken during exec'ed rebase?
From: Junio C Hamano <hidden>
Date: 2018-07-19 22:35:01
SZEDER Gábor [off-list ref] writes:
quoted
Forgetting the code in git-sh-setup, are we? git_dir_init() rather specifically set GIT_DIR to the absolute path, and since that variable is already exported, the `exec` commands launched via `git-rebase--interactive` all saw it. That is the reason why the sequencer.c was taught to set GIT_DIR to an absolute path rathern than not setting it: for backwards compatibility.GIT_DIR was not exported to 'exec' commands during an interactive rebase prior to 18633e1a22 (rebase -i: use the rebase--helper builtin, 2017-02-09) (nor was GIT_PREFIX): $ git log -Sgit_dir_init master git-rebase*.sh # Nothing. $ git checkout 18633e1a22a6^ && make -j4 prefix=/tmp/BEFORE install <....> $ git checkout 18633e1a22a6 && make -j4 prefix=/tmp/AFTER install <....> $ GIT_EDITOR='sed -i -e "1ix set |grep ^GIT"' /tmp/BEFORE/bin/git rebase -i HEAD^ Executing: set |grep ^GIT GIT_CHERRY_PICK_HELP=$'\nWhen you have resolved this problem, run "git rebase --continue".\nIf you prefer to skip this patch, run "git rebase --skip" instead.\nTo check out the original branch and stop rebasing, run "git rebase --abort".\n' GIT_EDITOR='sed -i -e "1ix set |grep ^GIT"' GIT_INTERNAL_GETTEXT_SH_SCHEME=gnu GIT_REFLOG_ACTION='rebase -i (start): checkout HEAD^' warning: notes ref refs/notes/commits is invalid Successfully rebased and updated refs/heads/master. $ GIT_EDITOR='sed -i -e "1ix set |grep ^GIT"' /tmp/AFTER/bin/git rebase -i HEAD^ Executing: set |grep ^GIT GIT_CHERRY_PICK_HELP=' GIT_DIR='.git' GIT_EDITOR='sed -i -e "1ix set |grep ^GIT"' GIT_INTERNAL_GETTEXT_SH_SCHEME='gnu' GIT_PREFIX='' GIT_REFLOG_ACTION='rebase -i (start): checkout HEAD^' warning: notes ref refs/notes/commits is invalid Successfully rebased and updated refs/heads/master. And then recently came 226c0ddd0d (exec_cmd: RUNTIME_PREFIX on some POSIX systems, 2018-04-10), which then started to export GIT_EXEC_PATH to 'exec' commands as well...
Correct. git-sh-setup does assign to GIT_DIR, but unless the end-user has it exported, it does not export, which has long been very deliberate. But it does not really matter, as exporting BOTH GIT_DIR and GIT_WORK_TREE is a lot easier to understand and probably safe (even though technically a regressing) solution, and fewer and fewer things will be relying on git-sh-setup in the future anyway.