git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Lars Hjemli <hjemli@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] Add platform-independent .git "symlink"
Date: Sun, 3 Feb 2008 20:57:08 -0500	[thread overview]
Message-ID: <20080204015707.GH24004@spearce.org> (raw)
In-Reply-To: <alpine.LSU.1.00.0802021825220.7372@racer.site>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Howver, having .git a file pointing to another git directory allows you to 
> have locks there.  And they can be actually pretty sensible locks, like
> 
> 	.git/HEAD.<mangled-path>
> 
> actually containing the symbolic ref describing which branch we're on in 
> that working directory.  Likewise, .git/index.<mangled-path> needs to hold 
> the current index.
> 
> Of course, for this to work, you need to use different HEADs and indexes 
> only if .git was a file originally.
> 
> BTW <mangled-path> could be a hash of the path, and for convenience, we 
> could store the path in .git/workdir.<mangled-path>.

This I like.  Because my day-job coworkers and I make very heavy use of
git-new-workdir to manage our compile areas/working directories.  :)

The biggest problem with new-workdir is the master repository
cannot see the HEAD, index or logs/HEAD of the working directories.
Consequently it is possible for prune (or repack -a -d) to remove
objects that some workdir is still referring to.  Its not uncommon
for my HEAD reflogs to have stale commits in them.  Every once in
a while a user looses their HEAD entirely when it gets pruned away,
as they had a workdir checked out on a detached HEAD.

The second biggest problem is checking out the same branch in two
different directories at once.  This becomes a problem only if you
modify the branch, but still, its a problem.


I was thinking that we could add a WORKDIR_HASH to the .git file
Lars was proposing.  This hash would be the <mangled-path> suffix
you are talking about above, and would avoid the need to compute
the absolute path for the working directory every time we run a
Git command.

The hash could be something simple, like the SHA-1 hash of the
absolute path at the time of workdir creation.  But it would be nice
if we could recommend a specific value during workdir creation,
so that the WORKDIR_HASH could start with a value that matches
something the user would readily recognize.

-- 
Shawn.

  reply	other threads:[~2008-02-04  1:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-02 10:36 [PATCH] Add platform-independent .git "symlink" Lars Hjemli
2008-02-02 15:02 ` [PATCH] Add tests for .git file Lars Hjemli
2008-02-02 15:56 ` [PATCH] Add platform-independent .git "symlink" Johannes Schindelin
2008-02-02 17:59   ` Lars Hjemli
2008-02-02 18:09     ` Lars Hjemli
2008-02-02 18:19       ` Johannes Schindelin
2008-02-02 18:34         ` Johannes Schindelin
2008-02-04  1:57           ` Shawn O. Pearce [this message]
2008-02-04  3:05             ` Junio C Hamano
2008-02-04 14:34               ` Johannes Schindelin
2008-02-04 21:17           ` Brandon Casey
2008-02-04 21:31             ` Johannes Schindelin
2008-02-04 22:08               ` Brandon Casey
2008-02-04 22:19                 ` Johannes Schindelin
2008-02-04 22:44                   ` Brandon Casey
2008-02-04 22:56                     ` Brandon Casey
2008-02-05  0:51                       ` Johannes Schindelin
2008-02-05  0:49                     ` Johannes Schindelin
2008-02-05  2:42                       ` Brandon Casey
2008-02-05 12:57                         ` Johannes Schindelin
2008-02-02 18:47         ` Lars Hjemli
2008-02-03  1:55           ` Johannes Schindelin
2008-02-04  0:07           ` Junio C Hamano
2008-02-04  0:24             ` Johannes Schindelin
2008-02-04  1:35               ` Shawn O. Pearce
2008-02-04  1:45                 ` Junio C Hamano
2008-02-04  2:00                   ` Shawn O. Pearce
2008-02-04 11:59               ` Lars Hjemli
2008-02-04 14:36                 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080204015707.GH24004@spearce.org \
    --to=spearce@spearce.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hjemli@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).