git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* update_linked_gitdir writes relative path to .git/worktrees/<id>/gitdir
@ 2016-02-06 20:12 Matt McCutchen
  2016-02-07 23:56 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Matt McCutchen @ 2016-02-06 20:12 UTC (permalink / raw)
  To: git

I noticed that when update_linked_gitdir chooses to update
.git/worktrees/<id>/gitdir, the path it writes is relative, at least
under some circumstances.  This contradicts the gitrepository-layout
man page, which says:

worktrees/<id>/gitdir::
        A text file containing the absolute path back to the .git file
        that points to here.

IIUC, this behavior defeats one of the three safeguards that is
supposed to prevent "git worktree prune" from pruning information for
worktrees that still exist.

A simple script to reproduce:

#!/bin/bash
set -e -x
rm -rf repo worktree2
git init repo
cd repo
touch foo
git add foo
git commit -m 'dummy commit'
git worktree add ../worktree2 -b branch2
cat .git/worktrees/worktree2/gitdir
touch -d '2 days ago' .git/worktrees/worktree2/gitdir
(cd ../worktree2 && git status)
cat .git/worktrees/worktree2/gitdir

Trying this on master as of earlier today (ff4ea60), I get:

[...]
/PATH/REDACTED/worktree2/.git
[...]
.git

Matt

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

end of thread, other threads:[~2016-02-09 21:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-06 20:12 update_linked_gitdir writes relative path to .git/worktrees/<id>/gitdir Matt McCutchen
2016-02-07 23:56 ` Junio C Hamano
2016-02-08  1:04   ` Matt McCutchen
2016-02-08  4:56     ` Duy Nguyen
2016-02-08 13:56     ` Jeff King
2016-02-08 22:16       ` Junio C Hamano
2016-02-09 20:05         ` Matt McCutchen
2016-02-09 21:02           ` Junio C Hamano
2016-02-09 20:30         ` Making the "Note from the maintainer" information discoverable Matt McCutchen
2016-02-09  0:34       ` [PATCH] git.txt: encourage bug reporters to test recent versions Matt McCutchen

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).