threads / discuss / 17643

tool and worktree

Subject: tool and worktree

## tl;dr

6 messages between Feb 8, 2009 and Feb 9, 2009.

replies: 5people: 3as markdown or json

bill lam· Feb 8, 2009, 03:44 UTC · lore
I track /etc using a config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	worktree = /etc
	logAllRefUpdates = true
	excludesfile =
But that can not be handled by tools,

git gui : cannot use funny .git directory . tig : status view said, The status view requires a working tree

Can these be improved?
 
-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩314 王昌齡  長信怨
    奉帚平明金殿開  且將團扇共徘徊  玉顏不及寒鴉色  猶帶昭陽日影來
Jonas Fonseca· Feb 8, 2009, 09:47 UTC · re: bill lam · lore

Re: tool and worktree

On Sun, Feb 8, 2009 at 04:44, bill lam <cbill.lam@gmail.com> wrote:
Show 13 quoted lines
> I track /etc using a config
>
> [core]
>        repositoryformatversion = 0
>        filemode = true
>        bare = false
>        worktree = /etc
>        logAllRefUpdates = true
>        excludesfile =
>
> But that can not be handled by tools,
>
> tig : status view said, The status view requires a working tree

Yes, on startup, tig checks git-rev-parse --is-inside-work-tree and disables things like the status view if it is false. I don't know how much work it would be to start using core.worktree. It might be as simple as setting the GIT_DIR environment to getcwd() + output of git-rev-parse --git-dir and then chdir() to core.worktree.

-- 
Jonas Fonseca
Jonas Fonseca· Feb 9, 2009, 01:17 UTC · re: Jonas Fonseca · lore

Re: tool and worktree

On Sun, Feb 8, 2009 at 10:47, Jonas Fonseca <jonas.fonseca@gmail.com> wrote:
> It might be as
> simple as setting the GIT_DIR environment to getcwd() + output of
> git-rev-parse --git-dir and then chdir() to core.worktree.
I have pushed a lightly tested patch that does something like this ...
-- 
Jonas Fonseca
bill lam· Feb 9, 2009, 02:15 UTC · re: Jonas Fonseca · lore

Re: tool and worktree

On Mon, 09 Feb 2009, Jonas Fonseca wrote:
Show 6 quoted lines
> On Sun, Feb 8, 2009 at 10:47, Jonas Fonseca <jonas.fonseca@gmail.com> wrote:
> > It might be as
> > simple as setting the GIT_DIR environment to getcwd() + output of
> > git-rev-parse --git-dir and then chdir() to core.worktree.
> 
> I have pushed a lightly tested patch that does something like this ...
Thanks. Now the status view works.

Since /etc contains both public and private files. When browsing the untracked files in the status view, for files that without read permission, eg the shadow passwd file, the lower pane displays the content of the last readable file. Could it clear the content or just filter and display only files with read permission for the untracked files?

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩215 李商隱  無題
    相見時難別亦難  東風無力百花殘  春蠶到死絲方盡  蠟炬成灰淚始乾
    曉鏡但愁雲鬢改  夜吟應覺月光寒  蓬萊此去無多路  青鳥殷勤為探看
Jonas Fonseca· Feb 9, 2009, 03:23 UTC · re: bill lam · lore

Re: tool and worktree

2009/2/9 bill lam <cbill.lam@gmail.com>:
Show 6 quoted lines
> Since /etc contains both public and private files.  When browsing the
> untracked files in the status view, for files that without read
> permission, eg the shadow passwd file, the lower pane displays the
> content of the last readable file.  Could it clear the content or just
> filter and display only files with read permission for the untracked
> files?

It now closes the lower pane and displays the reason why it failed to load the file using strerror().

-- 
Jonas Fonseca
Shawn O. Pearce· Feb 8, 2009, 19:25 UTC · re: bill lam · lore

Re: tool and worktree

bill lam <cbill.lam@gmail.com> wrote:
Show 13 quoted lines
> I track /etc using a config
> 
> [core]
> 	repositoryformatversion = 0
> 	filemode = true
> 	bare = false
> 	worktree = /etc
> 	logAllRefUpdates = true
> 	excludesfile =
> 
> But that can not be handled by tools,
> 
> git gui : cannot use funny .git directory .

If someone sends patches for git-gui, maybe. This use case of different repository and worktree isn't very common for git-gui so it doesn't support it.

On Windows with some versions of Tcl/Tk I've had trouble in the past with Git finding the repository when forked out of the wish process. To work around it I just required that the repository be in ".git".

Have you tried making /etc/.git a symlink to the real repository?

BTW, tracking /etc/ in git won't track permissions and ownership so restoring /etc from git isn't enough on its own. Usually I use some sort of shell script to copy /etc to another location and check it into git, and a different script to go the other way, with that script handling mode and ownership as it goes.

-- 
Shawn.

← back to recent threads