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

Inconsistency in --work-tree behaviors

From
NKNicholas Kirchner <kirc0076@umn.edu>
Date
Jun 19, 2012, 23:26 UTC
Message-ID
<AAB7D0C4-2A3E-4CCF-8D3E-A2C689B2826D@umn.edu>
There appears to be an inconsistency in how ls-files handles --work-tree compared to how status handles --work-tree.
Context: I have a directory dotfiles.git with core.worktree = /Users/nick (my home directory; I'm on OS X Lion with MacPorts git version 1.7.10.4).
Below are the outputs of git ls-files and git status for the following options of --work-tree:
1) none (equivalent to --work-tree=/Users/nick because of core.worktree setting, right?)
2) --work-tree=~
3) --work-tree=/Users/nick
4) --work-tree=/Users/nick. (note the period at the end)
Note that ls-files works properly with "/Users/nick." and "~", while status works properly with "/Users/nick" and none.  No output is produced for "git ls-files" or "git --work-tree=/Users/nick".

$ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # ../.hiya nothing added to commit but untracked files present (use "git add" to track)

$ git ls-files

$ git --work-tree=~ ls-files .bash_profile .bashrc .gemrc .profile .rvmrc .screenrc

$ git --work-tree=~ status fatal: This operation must be run in a work tree

$ git --work-tree=/Users/nick status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # ../.hiya nothing added to commit but untracked files present (use "git add" to track)

$ git --work-tree=/Users/nick ls-files

$ git --work-tree=/Users/nick. ls-files .bash_profile .bashrc .gemrc .profile .rvmrc .screenrc

$ git --work-tree=/Users/nick. status fatal: This operation must be run in a work tree

Message 1 of 1 in “Inconsistency in --work-tree behaviors”
  1. Nicholas KirchnerJun 19, 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.