git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git's is_inside_git_dir too strict?
@ 2007-03-06 15:41 Nguyen Thai Ngoc Duy
  2007-03-06 21:46 ` Johannes Schindelin
  0 siblings, 1 reply; 8+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-03-06 15:41 UTC (permalink / raw)
  To: git

Hi,

I have a working directory separated from its git repository. When I
work on this directory, I specify --git-dir argument (actually all
happens in script so I don't have to type that much). It used to work
but no longer since git 1.5.0. Complaints include "cannot be used
without a working tree" and "This operation must be run in a work
tree". Can I have the former behaviour back in some ways?
-- 
Duy

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

* Re: git's is_inside_git_dir too strict?
  2007-03-06 15:41 git's is_inside_git_dir too strict? Nguyen Thai Ngoc Duy
@ 2007-03-06 21:46 ` Johannes Schindelin
  2007-03-07 12:17   ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2007-03-06 21:46 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git

Hi,

On Tue, 6 Mar 2007, Nguyen Thai Ngoc Duy wrote:

> I have a working directory separated from its git repository. When I
> work on this directory, I specify --git-dir argument (actually all
> happens in script so I don't have to type that much). It used to work
> but no longer since git 1.5.0.

Yes, we tried to make sure a few common errors were harder to make.

> Complaints include "cannot be used without a working tree" and "This 
> operation must be run in a work tree". Can I have the former behaviour 
> back in some ways?

Well, there is a real problem with "This operation must be run in a work 
tree". What operation is that? We tried to make it hard to overwrite 
things in $GIT_DIR by running Git operations meant for the working tree, 
and it seems like you are running one of them.

However, I think that is_bare_repository() really should check if 
$GIT_DIR is a prefix of $(pwd). Because if it is not, we are likely to run 
in a detached work tree.

If you agree, then is_inside_git_dir() might actually be a better way to 
ask if the repo is bare than is_bare_repository().

Comments?

Ciao,
Dscho

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

* Re: git's is_inside_git_dir too strict?
  2007-03-06 21:46 ` Johannes Schindelin
@ 2007-03-07 12:17   ` Nguyen Thai Ngoc Duy
  2007-03-07 15:53     ` Shawn O. Pearce
  2007-03-09 12:00     ` Matthias Lederhofer
  0 siblings, 2 replies; 8+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-03-07 12:17 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On 3/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Complaints include "cannot be used without a working tree" and "This
> > operation must be run in a work tree". Can I have the former behaviour
> > back in some ways?
>
> Well, there is a real problem with "This operation must be run in a work
> tree". What operation is that? We tried to make it hard to overwrite
> things in $GIT_DIR by running Git operations meant for the working tree,
> and it seems like you are running one of them.

>From this command:

git --git-dir=/home/pclouds/blog/data.git ls-files --others --modified
2007-03-07T18_52_41.txt

It was run in /home/pclouds/blog/data, which is the working directory
of data.git.

By the way, is it plausible to add --git-workdir option to specify
working directory? With that option, I won't need to chdir to the
working directory, run git commands and chdir back.

>
> However, I think that is_bare_repository() really should check if
> $GIT_DIR is a prefix of $(pwd). Because if it is not, we are likely to run
> in a detached work tree.
>
> If you agree, then is_inside_git_dir() might actually be a better way to
> ask if the repo is bare than is_bare_repository().
>
> Comments?

I didn't follow git development lately so I'm afraid I'm incapable to
comment on this :-)

>
> Ciao,
> Dscho
>
>


-- 
Duy

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

* Re: git's is_inside_git_dir too strict?
  2007-03-07 12:17   ` Nguyen Thai Ngoc Duy
@ 2007-03-07 15:53     ` Shawn O. Pearce
  2007-03-07 16:12       ` Nguyen Thai Ngoc Duy
  2007-03-09 12:00     ` Matthias Lederhofer
  1 sibling, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2007-03-07 15:53 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Johannes Schindelin, git

Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> On 3/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> >Well, there is a real problem with "This operation must be run in a work
> >tree". What operation is that? We tried to make it hard to overwrite
> >things in $GIT_DIR by running Git operations meant for the working tree,
> >and it seems like you are running one of them.
> 
> From this command:
> 
> git --git-dir=/home/pclouds/blog/data.git ls-files --others --modified
> 2007-03-07T18_52_41.txt
> 
> It was run in /home/pclouds/blog/data, which is the working directory
> of data.git.

Why not just symlink it?

	cd /home/pclouds/blog/data
	ln -s ../data.git .git

But really, why is your Git repository for the working directory
outside of the working directory?  Why not just move data.git to
data/.git ?

-- 
Shawn.

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

* Re: git's is_inside_git_dir too strict?
  2007-03-07 15:53     ` Shawn O. Pearce
@ 2007-03-07 16:12       ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 8+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-03-07 16:12 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Johannes Schindelin, git

On 3/7/07, Shawn O. Pearce <spearce@spearce.org> wrote:
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> > It was run in /home/pclouds/blog/data, which is the working directory
> > of data.git.
>
> Why not just symlink it?
>
>         cd /home/pclouds/blog/data
>         ln -s ../data.git .git

It's currently my workaround.

> But really, why is your Git repository for the working directory
> outside of the working directory?  Why not just move data.git to
> data/.git ?

The directory "data" is  automatically manipulated by scripts. I feel
it safer for data.git being outside of data so if I make any mistake,
data.git _might_ remain intact. You see, if I link data/.git to
data.git, my scripts' bugs might affect data.git too.

> --
> Shawn.
>


-- 
Duy

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

* Re: git's is_inside_git_dir too strict?
  2007-03-07 12:17   ` Nguyen Thai Ngoc Duy
  2007-03-07 15:53     ` Shawn O. Pearce
@ 2007-03-09 12:00     ` Matthias Lederhofer
  2007-03-10  1:11       ` Junio C Hamano
  2007-03-10 11:49       ` Nguyen Thai Ngoc Duy
  1 sibling, 2 replies; 8+ messages in thread
From: Matthias Lederhofer @ 2007-03-09 12:00 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git

Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> By the way, is it plausible to add --git-workdir option to specify
> working directory? With that option, I won't need to chdir to the
> working directory, run git commands and chdir back.

http://article.gmane.org/gmane.comp.version-control.git/38382
Since I did not need this feature that much and no one replied that
there is any interest I did not look any further into it.

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

* Re: git's is_inside_git_dir too strict?
  2007-03-09 12:00     ` Matthias Lederhofer
@ 2007-03-10  1:11       ` Junio C Hamano
  2007-03-10 11:49       ` Nguyen Thai Ngoc Duy
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2007-03-10  1:11 UTC (permalink / raw)
  To: Matthias Lederhofer; +Cc: git, Nguyen Thai Ngoc Duy

Matthias Lederhofer <matled@gmx.net> writes:

> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
>> By the way, is it plausible to add --git-workdir option to specify
>> working directory? With that option, I won't need to chdir to the
>> working directory, run git commands and chdir back.
>
> http://article.gmane.org/gmane.comp.version-control.git/38382
> Since I did not need this feature that much and no one replied that
> there is any interest I did not look any further into it.

FWIW, I was once in favor of that, and currently I am neutral.
I vaguely recall that I suggested something like that back when
I was still a contributor.  The proposal was shot down by people
on the list, but I do not recall the details of why.

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

* Re: git's is_inside_git_dir too strict?
  2007-03-09 12:00     ` Matthias Lederhofer
  2007-03-10  1:11       ` Junio C Hamano
@ 2007-03-10 11:49       ` Nguyen Thai Ngoc Duy
  1 sibling, 0 replies; 8+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-03-10 11:49 UTC (permalink / raw)
  To: Matthias Lederhofer, git

On 3/9/07, Matthias Lederhofer <matled@gmx.net> wrote:
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> > By the way, is it plausible to add --git-workdir option to specify
> > working directory? With that option, I won't need to chdir to the
> > working directory, run git commands and chdir back.
>
> http://article.gmane.org/gmane.comp.version-control.git/38382
> Since I did not need this feature that much and no one replied that
> there is any interest I did not look any further into it.
>

You obviously have a fan now :) Are you going to rework the patch? I
think I could finish it if you don't have time for it. FYI, the patch
seems not working ("Not below specified working directory")

-- 
Duy

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

end of thread, other threads:[~2007-03-10 11:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 15:41 git's is_inside_git_dir too strict? Nguyen Thai Ngoc Duy
2007-03-06 21:46 ` Johannes Schindelin
2007-03-07 12:17   ` Nguyen Thai Ngoc Duy
2007-03-07 15:53     ` Shawn O. Pearce
2007-03-07 16:12       ` Nguyen Thai Ngoc Duy
2007-03-09 12:00     ` Matthias Lederhofer
2007-03-10  1:11       ` Junio C Hamano
2007-03-10 11:49       ` Nguyen Thai Ngoc Duy

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