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

Simulating an empty git repository without having said repository on disk

From
Richard Hartmann <richih.mailinglist@gmail.com>
Date
Jan 16, 2012, 18:34 UTC
Message-ID
<CAD77+gR=txp8sKrA57ztQX0a1-QZM7wwR6ThBq77c=c+AbsS0w@mail.gmail.com>
Hi all,

for vcsh[1], I need a rather hackish feature: List all files untracked by vcsh. The plan to achieve this is:

Get lists of all files by all repos which' GIT_WORK_TREE is in one directory ($HOME, by default), merge all lists into one and use that as a .gitignore or exclude. Then run `git status` with $GIT_WORK_TREE pointing to $HOME while using said ignore/exclude. That will give me a list of all files & directories which are not tracked by any of the git repos managed by vcsh.

I could create an empty git repo to run this operation in, but that seems wasteful. Thus, I would prefer to run this command against a non-existing, empty git repo. Problem is, I could not find a way to do this.

I know the empty tree's SHA is hard-coded into git so I was hoping there would be a way to trick git using this, but I couldn't find a way.

Any and all help appreciated, even if it's just a "no, this is not possible"

Thanks, Richard

[1] https://github.com/RichiH/vcsh
Next: Jeff King
Message 1 of 3 in “Simulating an empty git repository without having said repository on disk”
  1. Richard HartmannJan 16, 2012
  2. Jeff KingJan 16, 2012
  3. Richard HartmannJan 16, 2012

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.