{"thread":{"id":"5647","subject":"git commands that only work correctly at top directory","startedAt":"2006-09-22T09:21:09Z","lastAt":"2006-09-28T19:55:35Z","messageCount":12,"participants":["Nguyen Thai Ngoc Duy","Matthias Lederhofer","Jeff King","Thomas Kolejka","Petr Baudis","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"27408","messageId":"fcaeb9bf0609220221w3a65af24u9db1da4e1be0d1eb@mail.gmail.com","threadId":"5647","inReplyTo":null,"subject":"git commands that only work correctly at top directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-09-22T09:21:09Z","receivedAt":"2006-09-22T09:21:09Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Here is the list (checks are done in with 1.4.2.rc4):\ncount-objects (always 0 objects, 0 kilobytes)\nbisect (fatal: Not a git repository: '.git'. Bad HEAD - I need a symbolic ref)\ndescribe (fatal: Not a valid object name HEAD)\nrepack (line 42: cd: .git/objects/pack: No such file or directory. And\nit creates a new .git directory in current directory)\ngit format-patch in subdir generates files in topdir instead of\ncurrent dir as documented in its man page\n\nBTW, either git blame or git annotate should be available in git help's listing.\ngit format-patch with no argument shows nothing. It should show help\nusage instead.\nI might miss some commands because I only tested commands I'm familiar with.\n-- \nDuy\n"},{"id":"27410","messageId":"20060922111201.GA10124@moooo.ath.cx","threadId":"5647","inReplyTo":"fcaeb9bf0609220221w3a65af24u9db1da4e1be0d1eb@mail.gmail.com","subject":"[PATCH] format-patch: use cwd as default output directory","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-09-22T11:12:01Z","receivedAt":"2006-09-22T11:12:01Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"---\nNguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> git format-patch in subdir generates files in topdir instead of\n> current dir as documented in its man page\nHere is a patch for this.\n---\n builtin-log.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex fbc58bb..130b53a 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -270,6 +270,8 @@ int cmd_format_patch(int argc, const cha\n \n \trev.extra_headers = extra_headers;\n \n+\toutput_directory = prefix;\n+\n \t/*\n \t * Parse the arguments before setup_revisions(), or something\n \t * like \"git fmt-patch -o a123 HEAD^..\" may fail; a123 is\n-- \n1.4.2.1.ge767\n"},{"id":"27411","messageId":"20060922112615.GB10124@moooo.ath.cx","threadId":"5647","inReplyTo":"fcaeb9bf0609220221w3a65af24u9db1da4e1be0d1eb@mail.gmail.com","subject":"Re: git commands that only work correctly at top directory","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-09-22T11:26:15Z","receivedAt":"2006-09-22T11:26:15Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> Here is the list (checks are done in with 1.4.2.rc4):\n> count-objects (always 0 objects, 0 kilobytes)\n> bisect (fatal: Not a git repository: '.git'. Bad HEAD - I need a symbolic \n> ref)\n> describe (fatal: Not a valid object name HEAD)\n> repack (line 42: cd: .git/objects/pack: No such file or directory. And\n> it creates a new .git directory in current directory)\ncount-objects and describe work in the current master.\nrepack/bisect/reset and some other commands make only sense from the\ntoplevel directory but anyway I would allow them to be run in a\nsubdirectory and change up to the topdirectory (like git checkout for\nbranch switching).  Is there any good reason not to do this?  I found\nit often annoying to go down to the toplevel directory/get a new shell\njust to reset to HEAD~1.\n"},{"id":"27412","messageId":"fcaeb9bf0609220557m7802a446nd47a9560c6977b31@mail.gmail.com","threadId":"5647","inReplyTo":"20060922112615.GB10124@moooo.ath.cx","subject":"Re: git commands that only work correctly at top directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-09-22T12:57:33Z","receivedAt":"2006-09-22T12:57:33Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 9/22/06, Matthias Lederhofer <matled@gmx.net> wrote:\n> count-objects and describe work in the current master.\nYes. Somehow my master is not updated to origin :(\n\n> repack/bisect/reset and some other commands make only sense from the\n> toplevel directory but anyway I would allow them to be run in a\n> subdirectory and change up to the topdirectory (like git checkout for\n> branch switching).  Is there any good reason not to do this?  I found\n> it often annoying to go down to the toplevel directory/get a new shell\n> just to reset to HEAD~1.\nIn case there is good reason not to do it, I'd like those commands to\ntell users run them in top directory. (Although I prefer to run it\neverywhere, I hate to cd around just for one command)\n-- \nDuy\n"},{"id":"27413","messageId":"20060922151054.GA29198@coredump.intra.peff.net","threadId":"5647","inReplyTo":"fcaeb9bf0609220221w3a65af24u9db1da4e1be0d1eb@mail.gmail.com","subject":"[PATCH] git-repack: allow git-repack to run in subdirectory","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-09-22T15:10:54Z","receivedAt":"2006-09-22T15:10:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Now that we explicitly create all tmpfiles below $GIT_DIR, there's no reason\nto care about which directory we're in.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n git-repack.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-repack.sh b/git-repack.sh\nindex 9ae5092..f2c9071 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -4,6 +4,7 @@ # Copyright (c) 2005 Linus Torvalds\n #\n \n USAGE='[-a] [-d] [-f] [-l] [-n] [-q]'\n+SUBDIRECTORY_OK='Yes'\n . git-sh-setup\n \n no_update_info= all_into_one= remove_redundant=\n-- \n1.4.2.1.gb6052-dirty\n"},{"id":"27414","messageId":"20060922170859.119780@gmx.net","threadId":"5647","inReplyTo":"fcaeb9bf0609220221w3a65af24u9db1da4e1be0d1eb@mail.gmail.com","subject":"Re: git commands that only work correctly at top directory","fromName":"Thomas Kolejka","fromEmail":"thomas.kolejka@gmx.at","sentAt":"2006-09-22T17:08:59Z","receivedAt":"2006-09-22T17:08:59Z","isPatch":false,"sender":{"key":"thomas.kolejka@gmx.at","avatar":null},"body":"\n-------- Original-Nachricht --------\nDatum: Fri, 22 Sep 2006 16:21:09 +0700\nVon: \"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com>\nAn: git@vger.kernel.org\nBetreff: git commands that only work correctly at top directory\n\nDid you set $GIT_DIR? ... to an absolute path or \"./.git\" ?\n\n> Here is the list (checks are done in with 1.4.2.rc4):\n> count-objects (always 0 objects, 0 kilobytes)\n\nWorks for me in every directory with GIT_DIR abolute or ./.git\n\n> bisect (fatal: Not a git repository: '.git'. Bad HEAD - I need a symbolic\n> ref)\n\nwith an absolute GIT_DIR works from every directory - at least bisect start\n\n> describe (fatal: Not a valid object name HEAD)\n\nwith an absolute GIT_DIR works from every directory.\nv1.4.1-gcddb939\n\n\n> repack (line 42: cd: .git/objects/pack: No such file or directory. And\n> it creates a new .git directory in current directory)\n> git format-patch in subdir generates files in topdir instead of\n> current dir as documented in its man page\n> \n> BTW, either git blame or git annotate should be available in git help's\n> listing.\n> git format-patch with no argument shows nothing. It should show help\n> usage instead.\n> I might miss some commands because I only tested commands I'm familiar\n> with.\n> -- \n> Duy\n\n\nThomas\n\n-- \nNEU: GMX DSL Sofort-Start-Set - blitzschnell ins Internet!\nEchte DSL-Flatrate ab 0,- Euro* http://www.gmx.net/de/go/dsl\n"},{"id":"27480","messageId":"20060923151630.GN8259@pasky.or.cz","threadId":"5647","inReplyTo":"20060922112615.GB10124@moooo.ath.cx","subject":"Re: git commands that only work correctly at top directory","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-23T15:16:30Z","receivedAt":"2006-09-23T15:16:30Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Sep 22, 2006 at 01:26:15PM CEST, I got a letter\nwhere Matthias Lederhofer <matled@gmx.net> said that...\n> repack/bisect/reset and some other commands make only sense from the\n> toplevel directory but anyway I would allow them to be run in a\n> subdirectory and change up to the topdirectory (like git checkout for\n> branch switching).  Is there any good reason not to do this?  I found\n> it often annoying to go down to the toplevel directory/get a new shell\n> just to reset to HEAD~1.\n\nProbably not for repack, but in case of bisect and especially reset it\nwould be reasonable to expect that it will touch just the subdirectory\nand in case of git reset --hard that could be deadly.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"27605","messageId":"20060925023111.GA14003@coredump.intra.peff.net","threadId":"5647","inReplyTo":"fcaeb9bf0609220221w3a65af24u9db1da4e1be0d1eb@mail.gmail.com","subject":"[PATCH/RESEND] git-repack: allow git-repack to run in subdirectory","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-09-25T02:31:11Z","receivedAt":"2006-09-25T02:31:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Now that we explicitly create all tmpfiles below $GIT_DIR, there's no reason\nto care about which directory we're in.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThere was no response on this; is there any reason not to allow this, or\ndid it just get dropped?\n\n git-repack.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-repack.sh b/git-repack.sh\nindex 9ae5092..f2c9071 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -4,6 +4,7 @@ # Copyright (c) 2005 Linus Torvalds\n #\n \n USAGE='[-a] [-d] [-f] [-l] [-n] [-q]'\n+SUBDIRECTORY_OK='Yes'\n . git-sh-setup\n \n no_update_info= all_into_one= remove_redundant=\n-- \n1.4.2.1.gb6052-dirty\n"},{"id":"27608","messageId":"7vwt7s63gt.fsf@assigned-by-dhcp.cox.net","threadId":"5647","inReplyTo":"20060925023111.GA14003@coredump.intra.peff.net","subject":"Re: [PATCH/RESEND] git-repack: allow git-repack to run in subdirectory","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-25T03:16:02Z","receivedAt":"2006-09-25T03:16:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Now that we explicitly create all tmpfiles below $GIT_DIR, there's no reason\n> to care about which directory we're in.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> There was no response on this; is there any reason not to allow this, or\n> did it just get dropped?\n\nSimply forgotten; it might be _correct_ but it is not important.\n\nWhile it may technically be correct that the command could be\nrun from anywhere, repack is a whole repository operation, and\nit is an operation performed not that often.  There is no reason\nto forbid it to run from subdirectories, but it does not hurt\nusers much if it did.\n\nWill queue for \"next\" and push it out before 1.4.3 if I do not\nforget it again ;-).\n"},{"id":"27883","messageId":"fcaeb9bf0609280325l1e88e9u75e8eac122e05e60@mail.gmail.com","threadId":"5647","inReplyTo":"20060922111201.GA10124@moooo.ath.cx","subject":"Re: [PATCH] format-patch: use cwd as default output directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-09-28T10:25:00Z","receivedAt":"2006-09-28T10:25:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This patch works great. I assume you forgot it?\n\nOn 9/22/06, Matthias Lederhofer <matled@gmx.net> wrote:\n> ---\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> > git format-patch in subdir generates files in topdir instead of\n> > current dir as documented in its man page\n> Here is a patch for this.\n> ---\n>  builtin-log.c |    2 ++\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n>\n> diff --git a/builtin-log.c b/builtin-log.c\n> index fbc58bb..130b53a 100644\n> --- a/builtin-log.c\n> +++ b/builtin-log.c\n> @@ -270,6 +270,8 @@ int cmd_format_patch(int argc, const cha\n>\n>         rev.extra_headers = extra_headers;\n>\n> +       output_directory = prefix;\n> +\n>         /*\n>          * Parse the arguments before setup_revisions(), or something\n>          * like \"git fmt-patch -o a123 HEAD^..\" may fail; a123 is\n> --\n> 1.4.2.1.ge767\n>\n>\n-- \nDuy\n"},{"id":"27900","messageId":"7vzmckufu0.fsf@assigned-by-dhcp.cox.net","threadId":"5647","inReplyTo":"fcaeb9bf0609280325l1e88e9u75e8eac122e05e60@mail.gmail.com","subject":"Re: [PATCH] format-patch: use cwd as default output directory","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-28T16:16:23Z","receivedAt":"2006-09-28T16:16:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com> writes:\n\n> This patch works great. I assume you forgot it?\n\nThanks for reminding.\n"},{"id":"27928","messageId":"20060928195535.GA25262@moooo.ath.cx","threadId":"5647","inReplyTo":"7vzmckufu0.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] git-format-patch: fix bug using -o in subdirectories","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-09-28T19:55:35Z","receivedAt":"2006-09-28T19:55:35Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"This was introduced by me in commit v1.4.2.1-gc08e524.\n\nSigned-off-by: Matthias Lederhofer <matled@gmx.net>\n---\nJunio C Hamano <junkio@cox.net> wrote:\n> \"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com> writes:\n> \n> > This patch works great. I assume you forgot it?\n> \n> Thanks for reminding.\nArgh, there is a bug.  When prefix is not NULL and -o is specified\ngit-format-patch fails:\n~/src/git/a% ../git-format-patch -o ./b HEAD~1\nfatal: Two output directories?\n---\n builtin-log.c |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 130b53a..9d1ceae 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -270,8 +270,6 @@ int cmd_format_patch(int argc, const cha\n \n \trev.extra_headers = extra_headers;\n \n-\toutput_directory = prefix;\n-\n \t/*\n \t * Parse the arguments before setup_revisions(), or something\n \t * like \"git fmt-patch -o a123 HEAD^..\" may fail; a123 is\n@@ -350,6 +348,9 @@ int cmd_format_patch(int argc, const cha\n \tif (!rev.diffopt.output_format)\n \t\trev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;\n \n+\tif (!output_directory)\n+\t\toutput_directory = prefix;\n+\n \tif (output_directory) {\n \t\tif (use_stdout)\n \t\t\tdie(\"standard output, or directory, which one?\");\n-- \n1.4.2.1.ge767\n"}]}