git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* core.worktree bug
@ 2009-12-07 10:15 Robin Rosenberg
  2009-12-15 16:30 ` Nguyen Thai Ngoc Duy
  2009-12-27 13:28 ` [PATCH] Fix core.worktree being used when GIT_DIR is not set Nguyễn Thái Ngọc Duy
  0 siblings, 2 replies; 11+ messages in thread
From: Robin Rosenberg @ 2009-12-07 10:15 UTC (permalink / raw)
  To: git


According to git-config(1) 

       core.worktree
           Set the path to the working tree. The value will not be used in combination with repositories found automatically in a
           .git directory (i.e. $GIT_DIR is not set). This can be overridden by the GIT_WORK_TREE environment variable and the
           --work-tree command line option. It can be a absolute path or relative path to the directory specified by --git-dir or
           GIT_DIR. Note: If --git-dir or GIT_DIR are specified but none of --work-tree, GIT_WORK_TREE and core.worktree is
           specified, the current working directory is regarded as the top directory of your working tree.

this setting is not used if GIT_DIR is set. But when I try it out 

$ mkdir r1
$ mkdir r2
$ cd r2
$ git init
Initialized empty Git repository in /home/me/tmp/r2/.git/
$ date >f
$ git add f
$ git commit -m "f"
 f
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 f
$ git status
# On branch master
nothing to commit (working directory clean)

=> Nothing interesting here. It comes here:

$ git config core.worktree $(cd ../r1;pwd)
$ git status
# On branch master
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    f
#
no changes added to commit (use "git add" and/or "git commit -a")

=> Seems the config is actually honored even though GIT_DIR is not set.

Bisect tells me 4f38f6b5bafb1f7f85c7b54d0bb0a0e977cd947c broke it. My main point is that I am
implementing this in JGit so I want the same behaviour. Question: Should we try to fix this
in git so it matches the documentation or fix the documentation to match behaviour.

The breakage appeared over a year ago and no one has complained.

-- robin

My bisection script:

#!/bin/bash

test_description="CEILING"

. ./test-lib.sh

test_expect_success \
    "ceiling" \
    "
     rm -rf r1 r2 &&
     mkdir r1 r2 &&
     (cd r2 &&
     git init &&
     date >f &&
     git add f &&
echo ADD &&
     git commit -m f &&
echo COMMIT &&
     git diff --exit-code f && 
echo DIFF &&
     git config core.worktree \$(cd ../r1/..;pwd) &&
echo CONFIG &&
     (unset GIT_DIR;git diff --exit-code -- f) &&
echo DIFF
     )
     "

test_don

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-12-29 17:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-07 10:15 core.worktree bug Robin Rosenberg
2009-12-15 16:30 ` Nguyen Thai Ngoc Duy
2009-12-27 13:28 ` [PATCH] Fix core.worktree being used when GIT_DIR is not set Nguyễn Thái Ngọc Duy
2009-12-27 20:58   ` Junio C Hamano
2009-12-28  0:08     ` Robin Rosenberg
2009-12-28  5:41     ` Nguyen Thai Ngoc Duy
2009-12-28  5:55       ` [PATCH] Documentation: always respect core.worktree if set Nguyễn Thái Ngọc Duy
2009-12-28  9:16         ` Junio C Hamano
2009-12-29  7:48           ` Nguyễn Thái Ngọc Duy
2009-12-29 16:58             ` Junio C Hamano
2009-12-29 17:05               ` Robin Rosenberg

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).