git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: Inconsistent results from git rev-parse --show-toplevel

From
CACrabtree, Andrew <andrew.crabtree@hpe.com>
Date
Jan 30, 2020, 21:59 UTC
Message-ID
<TU4PR8401MB111777B793EA9C3D5336CE26F9040@TU4PR8401MB1117.NAMPRD84.PROD.OUTLOOK.COM>
In-Reply-To
<20200130102933.GE840531@coredump.intra.peff.net>
From: Jeff King [mailto:peff@peff.net] 
Sent: Thursday, January 30, 2020 2:30 AM
To: Crabtree, Andrew <andrew.crabtree@hpe.com>
Cc: Junio C Hamano <gitster@pobox.com>; git@vger.kernel.org
Subject: Re: Inconsistent results from git rev-parse --show-toplevel
> > But the bigger thing, I think, is: who is setting GIT_DIR but not setting GIT_WORK_TREE to match? Because IMHO that's the situation that is causing the confusion.
> but it fails a test in t5601 around git-clone. 
Thanks jeff.  It looks like this might have been tried previously and abandoned?  I'm pretty far out of my league here in terms of how things are supposed to operate and any history around the previous attempts at making it work.
-A 
commit d95138e695d99d32dcad528a2a7974f434c51e79
Author: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date:   Fri Jun 26 17:37:35 2015 +0700
setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR
Which was subsequently reverted 
commit 86d26f240fcb4f287258ad459efc2b5e30e60cfd
Author: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date:   Sun Dec 20 14:50:18 2015 +0700
    setup.c: re-fix d95138e (setup: set env $GIT_WORK_TREE when ..
    
    Commit d95138e [1] attempted to fix a .git file problem by
    setting GIT_WORK_TREE whenever GIT_DIR is set. It sounded harmless
    because we handle GIT_DIR and GIT_WORK_TREE side by side for most
    commands, with two exceptions: git-init and git-clone.
    
    "git clone" is not happy with d95138e.
Previous: Jeff KingNext: Jeff King
Message 7 of 8 in “Inconsistent results from git rev-parse --show-toplevel”
  1. Crabtree, AndrewJan 24, 2020
  2. Junio C HamanoJan 24, 2020
  3. Crabtree, AndrewJan 25, 2020
  4. Jeff KingJan 25, 2020
  5. Crabtree, AndrewJan 25, 2020
  6. Jeff KingJan 30, 2020
  7. Crabtree, AndrewJan 30, 2020
  8. Jeff KingFeb 14, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.