{"thread":{"id":"7111","subject":"git's is_inside_git_dir too strict?","startedAt":"2007-03-06T15:41:14Z","lastAt":"2007-03-10T11:49:50Z","messageCount":8,"participants":["Nguyen Thai Ngoc Duy","Johannes Schindelin","Shawn O. Pearce","Matthias Lederhofer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"36465","messageId":"fcaeb9bf0703060741l7cbfd0f3ue443730176606db6@mail.gmail.com","threadId":"7111","inReplyTo":null,"subject":"git's is_inside_git_dir too strict?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-03-06T15:41:14Z","receivedAt":"2007-03-06T15:41:14Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\n\nI have a working directory separated from its git repository. When I\nwork on this directory, I specify --git-dir argument (actually all\nhappens in script so I don't have to type that much). It used to work\nbut no longer since git 1.5.0. Complaints include \"cannot be used\nwithout a working tree\" and \"This operation must be run in a work\ntree\". Can I have the former behaviour back in some ways?\n-- \nDuy\n"},{"id":"36473","messageId":"Pine.LNX.4.63.0703062232570.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7111","inReplyTo":"fcaeb9bf0703060741l7cbfd0f3ue443730176606db6@mail.gmail.com","subject":"Re: git's is_inside_git_dir too strict?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-06T21:46:30Z","receivedAt":"2007-03-06T21:46:30Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 6 Mar 2007, Nguyen Thai Ngoc Duy wrote:\n\n> I have a working directory separated from its git repository. When I\n> work on this directory, I specify --git-dir argument (actually all\n> happens in script so I don't have to type that much). It used to work\n> but no longer since git 1.5.0.\n\nYes, we tried to make sure a few common errors were harder to make.\n\n> Complaints include \"cannot be used without a working tree\" and \"This \n> operation must be run in a work tree\". Can I have the former behaviour \n> back in some ways?\n\nWell, there is a real problem with \"This operation must be run in a work \ntree\". What operation is that? We tried to make it hard to overwrite \nthings in $GIT_DIR by running Git operations meant for the working tree, \nand it seems like you are running one of them.\n\nHowever, I think that is_bare_repository() really should check if \n$GIT_DIR is a prefix of $(pwd). Because if it is not, we are likely to run \nin a detached work tree.\n\nIf you agree, then is_inside_git_dir() might actually be a better way to \nask if the repo is bare than is_bare_repository().\n\nComments?\n\nCiao,\nDscho\n"},{"id":"36543","messageId":"fcaeb9bf0703070417n5d3fb168jc7efd4642ad38c92@mail.gmail.com","threadId":"7111","inReplyTo":"Pine.LNX.4.63.0703062232570.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git's is_inside_git_dir too strict?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-03-07T12:17:42Z","receivedAt":"2007-03-07T12:17:42Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 3/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > Complaints include \"cannot be used without a working tree\" and \"This\n> > operation must be run in a work tree\". Can I have the former behaviour\n> > back in some ways?\n>\n> Well, there is a real problem with \"This operation must be run in a work\n> tree\". What operation is that? We tried to make it hard to overwrite\n> things in $GIT_DIR by running Git operations meant for the working tree,\n> and it seems like you are running one of them.\n\n>From this command:\n\ngit --git-dir=/home/pclouds/blog/data.git ls-files --others --modified\n2007-03-07T18_52_41.txt\n\nIt was run in /home/pclouds/blog/data, which is the working directory\nof data.git.\n\nBy the way, is it plausible to add --git-workdir option to specify\nworking directory? With that option, I won't need to chdir to the\nworking directory, run git commands and chdir back.\n\n>\n> However, I think that is_bare_repository() really should check if\n> $GIT_DIR is a prefix of $(pwd). Because if it is not, we are likely to run\n> in a detached work tree.\n>\n> If you agree, then is_inside_git_dir() might actually be a better way to\n> ask if the repo is bare than is_bare_repository().\n>\n> Comments?\n\nI didn't follow git development lately so I'm afraid I'm incapable to\ncomment on this :-)\n\n>\n> Ciao,\n> Dscho\n>\n>\n\n\n-- \nDuy\n"},{"id":"36548","messageId":"20070307155307.GC27596@spearce.org","threadId":"7111","inReplyTo":"fcaeb9bf0703070417n5d3fb168jc7efd4642ad38c92@mail.gmail.com","subject":"Re: git's is_inside_git_dir too strict?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-03-07T15:53:07Z","receivedAt":"2007-03-07T15:53:07Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> On 3/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> >Well, there is a real problem with \"This operation must be run in a work\n> >tree\". What operation is that? We tried to make it hard to overwrite\n> >things in $GIT_DIR by running Git operations meant for the working tree,\n> >and it seems like you are running one of them.\n> \n> From this command:\n> \n> git --git-dir=/home/pclouds/blog/data.git ls-files --others --modified\n> 2007-03-07T18_52_41.txt\n> \n> It was run in /home/pclouds/blog/data, which is the working directory\n> of data.git.\n\nWhy not just symlink it?\n\n\tcd /home/pclouds/blog/data\n\tln -s ../data.git .git\n\nBut really, why is your Git repository for the working directory\noutside of the working directory?  Why not just move data.git to\ndata/.git ?\n\n-- \nShawn.\n"},{"id":"36550","messageId":"fcaeb9bf0703070812y27425b07pf78fbdf14898b360@mail.gmail.com","threadId":"7111","inReplyTo":"20070307155307.GC27596@spearce.org","subject":"Re: git's is_inside_git_dir too strict?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-03-07T16:12:57Z","receivedAt":"2007-03-07T16:12:57Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 3/7/07, Shawn O. Pearce <spearce@spearce.org> wrote:\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> > It was run in /home/pclouds/blog/data, which is the working directory\n> > of data.git.\n>\n> Why not just symlink it?\n>\n>         cd /home/pclouds/blog/data\n>         ln -s ../data.git .git\n\nIt's currently my workaround.\n\n> But really, why is your Git repository for the working directory\n> outside of the working directory?  Why not just move data.git to\n> data/.git ?\n\nThe directory \"data\" is  automatically manipulated by scripts. I feel\nit safer for data.git being outside of data so if I make any mistake,\ndata.git _might_ remain intact. You see, if I link data/.git to\ndata.git, my scripts' bugs might affect data.git too.\n\n> --\n> Shawn.\n>\n\n\n-- \nDuy\n"},{"id":"36673","messageId":"20070309120001.GA32300@moooo.ath.cx","threadId":"7111","inReplyTo":"fcaeb9bf0703070417n5d3fb168jc7efd4642ad38c92@mail.gmail.com","subject":"Re: git's is_inside_git_dir too strict?","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-03-09T12:00:01Z","receivedAt":"2007-03-09T12:00:01Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> By the way, is it plausible to add --git-workdir option to specify\n> working directory? With that option, I won't need to chdir to the\n> working directory, run git commands and chdir back.\n\nhttp://article.gmane.org/gmane.comp.version-control.git/38382\nSince I did not need this feature that much and no one replied that\nthere is any interest I did not look any further into it.\n"},{"id":"36709","messageId":"7vzm6l2982.fsf@assigned-by-dhcp.cox.net","threadId":"7111","inReplyTo":"20070309120001.GA32300@moooo.ath.cx","subject":"Re: git's is_inside_git_dir too strict?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-10T01:11:41Z","receivedAt":"2007-03-10T01:11:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Lederhofer <matled@gmx.net> writes:\n\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n>> By the way, is it plausible to add --git-workdir option to specify\n>> working directory? With that option, I won't need to chdir to the\n>> working directory, run git commands and chdir back.\n>\n> http://article.gmane.org/gmane.comp.version-control.git/38382\n> Since I did not need this feature that much and no one replied that\n> there is any interest I did not look any further into it.\n\nFWIW, I was once in favor of that, and currently I am neutral.\nI vaguely recall that I suggested something like that back when\nI was still a contributor.  The proposal was shot down by people\non the list, but I do not recall the details of why.\n"},{"id":"36743","messageId":"fcaeb9bf0703100349h329bbc1dn41e65531a8d1e5b9@mail.gmail.com","threadId":"7111","inReplyTo":"20070309120001.GA32300@moooo.ath.cx","subject":"Re: git's is_inside_git_dir too strict?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-03-10T11:49:50Z","receivedAt":"2007-03-10T11:49:50Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 3/9/07, Matthias Lederhofer <matled@gmx.net> wrote:\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> > By the way, is it plausible to add --git-workdir option to specify\n> > working directory? With that option, I won't need to chdir to the\n> > working directory, run git commands and chdir back.\n>\n> http://article.gmane.org/gmane.comp.version-control.git/38382\n> Since I did not need this feature that much and no one replied that\n> there is any interest I did not look any further into it.\n>\n\nYou obviously have a fan now :) Are you going to rework the patch? I\nthink I could finish it if you don't have time for it. FYI, the patch\nseems not working (\"Not below specified working directory\")\n\n-- \nDuy\n"}]}