Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) $ env | grep GIT $ git --version git version 2.30.1 $ git init t Initialized empty Git repository in /tmp/t/.git/ $ mkdir t/foo $ cd t/foo $ git rev-parse --show-toplevel /tmp/t $ GIT_DIR=$(git rev-parse --git-dir) git rev-parse --show-toplevel /tmp/t/foo $ git rev-parse --git-dir /tmp/t/.git What did you expect to happen? (Expected behavior) "git rev-parse --show-toplevel" should be the same in both invocation. What happened instead? (Actual behavior) "git rev-parse --show-toplevel" shows the current working directory if GIT_DIR is set. What's different between what you expected and what actually happened? Setting GIT_DIR to $(git rev-parse --git-dir) should not change anything. Anything else you want to add: Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.30.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.3.18-22-default #1 SMP Wed Jun 3 12:16:43 UTC 2020 (720aeba) x86_64 compiler info: gnuc: 9.1 libc info: glibc: 2.26 $SHELL (typically, interactive shell): /opt/local/bin/bash [Enabled Hooks]