# [PATCH] cvsserver: Fix for work trees

3 messages from 2007-08-09 to 2007-08-09. Participants: Brian Downing, Junio C Hamano, Johannes Schindelin.
Thread: https://gitlist.dev/t/9448

## Brian Downing, 2007-08-09 04:26

Subject: [PATCH] cvsserver: Fix for work trees
Message-ID: <1186633570700-git-send-email-bdowning@lavos.net>
URL: https://gitlist.dev/e/1186633570700-git-send-email-bdowning%40lavos.net

```
git-cvsserver used checkout-index internally for commit and annotate.
Since a work tree is required for this to function now, this was
breaking.  Work around this by defining GIT_WORK_TREE=. in the
appropriate places.

Signed-off-by: Brian Downing <bdowning@lavos.net>
---
 git-cvsserver.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index ae7d511..13dbd27 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -1196,6 +1196,7 @@ sub req_ci
     $log->info("Lockless commit start, basing commit on '$tmpdir', index file is '$file_index'");
 
     $ENV{GIT_DIR} = $state->{CVSROOT} . "/";
+    $ENV{GIT_WORK_TREE} = ".";
     $ENV{GIT_INDEX_FILE} = $file_index;
 
     # Remember where the head was at the beginning.
@@ -1721,6 +1722,7 @@ sub req_annotate
     $log->info("Temp checkoutdir creation successful, basing annotate session work on '$tmpdir', index file is '$file_index'");
 
     $ENV{GIT_DIR} = $state->{CVSROOT} . "/";
+    $ENV{GIT_WORK_TREE} = ".";
     $ENV{GIT_INDEX_FILE} = $file_index;
 
     chdir $tmpdir;
-- 
1.5.3.GIT

```

## Junio C Hamano, 2007-08-09 05:45

Subject: Re: [PATCH] cvsserver: Fix for work trees
Message-ID: <7v1wedz2er.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v1wedz2er.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <1186633570700-git-send-email-bdowning@lavos.net>

```
Hmmmmm....

This is a good fix to adjust to the new world order introduced
by Dscho's rewrite of work-tree stuff, where the rules are:

 * When GIT_DIR is set and GIT_WORK_TREE is not, GIT_DIR is used
   to read config file, to figure out core.worktree.  When
   core.worktree is not set, a complicated algorithm is used to
   figure out the top of the working tree based on the value of
   GIT_DIR, and this can sometimes figure out that you are in a
   subdirectory of the working tree.  In such a case, you are in
   the working tree, but not necessarily at the top.

 * Otherwise, commands that require to have working tree now
   barf.  Earlier they always and consistently treated that your
   $cwd is the top of working tree and did not barf.

This new world order is probably an improvement, and if the
rules were like this from the beginning, it would have been
much nicer.  However, this _is_ a change of semantics in the
middle of the road, and probably we will see many fallouts like
this.  Unfortunate...  I am torn between a cleaner semantics and
the short-term pain...

```

## Johannes Schindelin, 2007-08-09 08:45

Subject: Re: [PATCH] cvsserver: Fix for work trees
Message-ID: <Pine.LNX.4.64.0708090943340.21857@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0708090943340.21857%40racer.site
In-Reply-To: <7v1wedz2er.fsf@assigned-by-dhcp.cox.net>

```
Hi,

On Wed, 8 Aug 2007, Junio C Hamano wrote:

> This new world order is probably an improvement, and if the rules were 
> like this from the beginning, it would have been much nicer.  However, 
> this _is_ a change of semantics in the middle of the road, and probably 
> we will see many fallouts like this.  Unfortunate...  I am torn between 
> a cleaner semantics and the short-term pain...

With your warning at the beginning of the ReleaseNotes, I think it would 
be the same amount of pain if we did it later.  It just would be...  
later.

Ciao,
Dscho

```
