{"thread":{"id":"9307","subject":"\"git stash\" is not known to git","startedAt":"2007-07-30T09:22:07Z","lastAt":"2007-07-31T13:52:20Z","messageCount":14,"participants":["David Kastrup","Matthieu Moy","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"49085","messageId":"86bqduutz4.fsf@lola.quinscape.zz","threadId":"9307","inReplyTo":null,"subject":"\"git stash\" is not known to git","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-30T09:22:07Z","receivedAt":"2007-07-30T09:22:07Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nOne has to use git-stash rather than \"git stash\".  Oversight?\n\n-- \nDavid Kastrup\n"},{"id":"49086","messageId":"vpqwswi2pkw.fsf@bauges.imag.fr","threadId":"9307","inReplyTo":"86bqduutz4.fsf@lola.quinscape.zz","subject":"Re: \"git stash\" is not known to git","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-07-30T09:44:31Z","receivedAt":"2007-07-30T09:44:31Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> One has to use git-stash rather than \"git stash\".  Oversight?\n\nThis looks like an incorrect installation, with git-stash in your\n$PATH, but not in the place git looks for its commands (I don't\nremember the exact mechanism).\n\n-- \nMatthieu\n"},{"id":"49087","messageId":"863az6uscz.fsf@lola.quinscape.zz","threadId":"9307","inReplyTo":"vpqwswi2pkw.fsf@bauges.imag.fr","subject":"Re: \"git stash\" is not known to git","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-30T09:57:00Z","receivedAt":"2007-07-30T09:57:00Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> David Kastrup <dak@gnu.org> writes:\n>\n>> One has to use git-stash rather than \"git stash\".  Oversight?\n>\n> This looks like an incorrect installation, with git-stash in your\n> $PATH, but not in the place git looks for its commands (I don't\n> remember the exact mechanism).\n\nI don't think so: in git.c we have at lines 362ff\n\n                { \"show-branch\", cmd_show_branch, RUN_SETUP },\n                { \"show\", cmd_show, RUN_SETUP | USE_PAGER },\n                { \"stripspace\", cmd_stripspace },\n                { \"symbolic-ref\", cmd_symbolic_ref, RUN_SETUP },\n\nSo it really seems like stash is not known to git.c.  Of course, I\nhave no real clue about git.c's operation (or I'd have proferred a\npatch) and not right now the time to look further.\n\n-- \nDavid Kastrup\n"},{"id":"49088","messageId":"20070730100408.GA8829@coredump.intra.peff.net","threadId":"9307","inReplyTo":"vpqwswi2pkw.fsf@bauges.imag.fr","subject":"Re: \"git stash\" is not known to git","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-07-30T10:04:08Z","receivedAt":"2007-07-30T10:04:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 30, 2007 at 11:44:31AM +0200, Matthieu Moy wrote:\n\n> > One has to use git-stash rather than \"git stash\".  Oversight?\n> \n> This looks like an incorrect installation, with git-stash in your\n> $PATH, but not in the place git looks for its commands (I don't\n> remember the exact mechanism).\n\nOn a related note, is it just me, or is the following comment and related code\nin git.c (introduced by Linus in 231af832) totally bogus:\n\n  /*\n   * We search for git commands in the following order:\n   *  - git_exec_path()\n   *  - the path of the \"git\" command if we could find it\n   *    in $0\n   *  - the regular PATH.\n   */\n\nWe never actually look in the regular PATH since we call execv_git_cmd\n(although we do still munge the PATH, apparently so shell scripts can\nuse git-foo syntax; see 77cb17e9). This means you can't drop \"git-foo\"\ninto your PATH and have it work as \"git foo\".\n\nWhat is the desired behavior?\n\n-Peff\n"},{"id":"49090","messageId":"20070730100609.GB8829@coredump.intra.peff.net","threadId":"9307","inReplyTo":"863az6uscz.fsf@lola.quinscape.zz","subject":"Re: \"git stash\" is not known to git","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-07-30T10:06:09Z","receivedAt":"2007-07-30T10:06:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 30, 2007 at 11:57:00AM +0200, David Kastrup wrote:\n\n> > This looks like an incorrect installation, with git-stash in your\n> > $PATH, but not in the place git looks for its commands (I don't\n> > remember the exact mechanism).\n> \n> I don't think so: in git.c we have at lines 362ff\n> \n>                 { \"show-branch\", cmd_show_branch, RUN_SETUP },\n>                 { \"show\", cmd_show, RUN_SETUP | USE_PAGER },\n>                 { \"stripspace\", cmd_stripspace },\n>                 { \"symbolic-ref\", cmd_symbolic_ref, RUN_SETUP },\n> \n> So it really seems like stash is not known to git.c.  Of course, I\n> have no real clue about git.c's operation (or I'd have proferred a\n> patch) and not right now the time to look further.\n\nThat list is for builtins; git-stash is an external shell script. See\nexecv_git_cmd for the list of places where it is looking for git-stash.\n\nSince I seem to recall you working some symlink magic with your\ninstallation in a recent message, that might be related. Is it just\ngit-stash, or are other scripts failing (try \"git status\")?\n\n-Peff\n"},{"id":"49092","messageId":"7vy7gyjj3c.fsf@assigned-by-dhcp.cox.net","threadId":"9307","inReplyTo":"86bqduutz4.fsf@lola.quinscape.zz","subject":"Re: \"git stash\" is not known to git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-30T10:12:39Z","receivedAt":"2007-07-30T10:12:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> One has to use git-stash rather than \"git stash\".  Oversight?\n\nDoes any of the other shell-scripts work without dashes?\nE.g. commit, merge, am, checkout?\n\nIf they do, then probably you are invoking older versions of\nthese scripts than what you think you are.  \"git\" itself looks\nat GIT_EXEC_PATH and then the $(gitexecdir) from the Makefile\nwhen it was built for its subcommands.\n\nPerhaps this is your \"symlinked install\" gone awry?  I dunno.\n"},{"id":"49093","messageId":"86lkcytci4.fsf@lola.quinscape.zz","threadId":"9307","inReplyTo":"20070730100609.GB8829@coredump.intra.peff.net","subject":"Re: \"git stash\" is not known to git","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-30T10:24:51Z","receivedAt":"2007-07-30T10:24:51Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Since I seem to recall you working some symlink magic with your\n> installation in a recent message, that might be related. Is it just\n> git-stash, or are other scripts failing (try \"git status\")?\n\nHmpf.  On another system (git version 1.5.3.rc3.48.g0d59d) this works.\nI don't have the system at hand right now where it doesn't.  So it\nwould be my guess that either I have not called the install-symlinks\ntarget recently enough, or its implementation on that system has been\nbroken for some time.\n\nI'll have to check this evening.\n\nOn the other hand, I am quite sure that while \"git stash\" did not\nwork, \"git-stash\" had no problem.\n\nSo something bogus in git's PATH lookup would definitely appear to be\ngoing on: it should be hard to get the symlinks messed up badly enough\nto have one work and not the other.\n\nMore this evening.\n\n-- \nDavid Kastrup\n"},{"id":"49095","messageId":"20070730103720.GA11309@coredump.intra.peff.net","threadId":"9307","inReplyTo":"86lkcytci4.fsf@lola.quinscape.zz","subject":"Re: \"git stash\" is not known to git","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-07-30T10:37:21Z","receivedAt":"2007-07-30T10:37:21Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 30, 2007 at 12:24:51PM +0200, David Kastrup wrote:\n\n> On the other hand, I am quite sure that while \"git stash\" did not\n> work, \"git-stash\" had no problem.\n\nRight. git-stash is in your PATH, but not in git's exec path (which is\n_not_ the same as PATH).\n\n> So something bogus in git's PATH lookup would definitely appear to be\n> going on: it should be hard to get the symlinks messed up badly enough\n> to have one work and not the other.\n\nGit doesn't look for subcommands in the PATH.\n\n-Peff\n"},{"id":"49096","messageId":"86bqdutb7r.fsf@lola.quinscape.zz","threadId":"9307","inReplyTo":"20070730103720.GA11309@coredump.intra.peff.net","subject":"Re: \"git stash\" is not known to git","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-30T10:52:40Z","receivedAt":"2007-07-30T10:52:40Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Jul 30, 2007 at 12:24:51PM +0200, David Kastrup wrote:\n>\n>> On the other hand, I am quite sure that while \"git stash\" did not\n>> work, \"git-stash\" had no problem.\n>\n> Right. git-stash is in your PATH, but not in git's exec path (which is\n> _not_ the same as PATH).\n\nHow does it calculate its exec path?  It would appear that it would\nnot contain _either_ /usr/local/bin _or_ /opt/git/bin in my\ninstallation if it can't find git-stash (which should be statable in\nboth places).\n\nHave a command handy for checking the exec path?\n\nOk, this is pretty much idle speculation until I am back at the system\nin question, but I have problems envisioning just what kind of goof\nmight have happened here.\n\n-- \nDavid Kastrup\n"},{"id":"49097","messageId":"20070730110354.GA11676@coredump.intra.peff.net","threadId":"9307","inReplyTo":"86bqdutb7r.fsf@lola.quinscape.zz","subject":"Re: \"git stash\" is not known to git","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-07-30T11:03:55Z","receivedAt":"2007-07-30T11:03:55Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 30, 2007 at 12:52:40PM +0200, David Kastrup wrote:\n\n> How does it calculate its exec path?  It would appear that it would\n> not contain _either_ /usr/local/bin _or_ /opt/git/bin in my\n> installation if it can't find git-stash (which should be statable in\n> both places).\n\nSee exec_cmd.c:execv_git_cmd. It checks in order:\n  1. --exec-path= on command line\n  2. $GIT_EXEC_PATH from environment\n  3. GIT_EXEC_PATH defined at compile-time (set by Makefile from\n      $(gitexecdir), which is generally the same as $(bindir))\n\nSo it should have /opt/git/bin in your case, but it's possible since\nthat is a Makefile variable that you failed to recompile correctly after\nchanging its value.\n\n> Have a command handy for checking the exec path?\n\ngit --exec-path\n\n-Peff\n"},{"id":"49118","messageId":"7vtzrlkccp.fsf@assigned-by-dhcp.cox.net","threadId":"9307","inReplyTo":"20070730100408.GA8829@coredump.intra.peff.net","subject":"Re: \"git stash\" is not known to git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-30T17:52:54Z","receivedAt":"2007-07-30T17:52:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On a related note, is it just me, or is the following comment and related code\n> in git.c (introduced by Linus in 231af832) totally bogus:\n>\n>   /*\n>    * We search for git commands in the following order:\n>    *  - git_exec_path()\n>    *  - the path of the \"git\" command if we could find it\n>    *    in $0\n>    *  - the regular PATH.\n>    */\n>\n> We never actually look in the regular PATH since we call execv_git_cmd\n> (although we do still munge the PATH, apparently so shell scripts can\n> use git-foo syntax; see 77cb17e9). This means you can't drop \"git-foo\"\n> into your PATH and have it work as \"git foo\".\n>\n> What is the desired behavior?\n\nI failed to spot patches to the area without updating the\ncomment.  What the code does is fine, the comment is stale.\n"},{"id":"49128","messageId":"85ir81u1t1.fsf@lola.goethe.zz","threadId":"9307","inReplyTo":"20070730110354.GA11676@coredump.intra.peff.net","subject":"Re: \"git stash\" is not known to git","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-30T19:30:34Z","receivedAt":"2007-07-30T19:30:34Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Jul 30, 2007 at 12:52:40PM +0200, David Kastrup wrote:\n>\n>> How does it calculate its exec path?  It would appear that it would\n>> not contain _either_ /usr/local/bin _or_ /opt/git/bin in my\n>> installation if it can't find git-stash (which should be statable in\n>> both places).\n>\n> See exec_cmd.c:execv_git_cmd. It checks in order:\n>   1. --exec-path= on command line\n>   2. $GIT_EXEC_PATH from environment\n>   3. GIT_EXEC_PATH defined at compile-time (set by Makefile from\n>       $(gitexecdir), which is generally the same as $(bindir))\n>\n> So it should have /opt/git/bin in your case, but it's possible since\n> that is a Makefile variable that you failed to recompile correctly after\n> changing its value.\n>\n>> Have a command handy for checking the exec path?\n>\n> git --exec-path\n\ndak@lola:/home/tmp/git$ git --exec-path\n/opt/git/bin\ndak@lola:/home/tmp/git$ git stash --help\nReformatting git-stash(1), please wait...\nWARNING: terminal is not fully functional\n-  (press RETURN)q\ndak@lola:/home/tmp/git$ git-stash --help\ndak@lola:/home/tmp/git$ Usage: /usr/local/bin/git-stash [ | list | show | apply | clear]\n\nI think I'll just soak my head in a bucket.  Don't ask me _what_ I\nimagined to be experiencing here.\n\nMaybe missing out shell completion when not typing the hyphen or\nsimilar nonsense.  Sorry for the noise.\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49199","messageId":"7vps29f0gp.fsf@assigned-by-dhcp.cox.net","threadId":"9307","inReplyTo":"20070730100408.GA8829@coredump.intra.peff.net","subject":"Re: \"git stash\" is not known to git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-31T08:20:54Z","receivedAt":"2007-07-31T08:20:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> We never actually look in the regular PATH since we call execv_git_cmd\n> (although we do still munge the PATH, apparently so shell scripts can\n> use git-foo syntax; see 77cb17e9). This means you can't drop \"git-foo\"\n> into your PATH and have it work as \"git foo\".\n\nWould this be a good replacement?\n\ndiff --git a/git.c b/git.c\nindex 2433355..25b8274 100644\n--- a/git.c\n+++ b/git.c\n@@ -448,11 +448,11 @@ int main(int argc, const char **argv)\n \tcmd = argv[0];\n \n \t/*\n-\t * We search for git commands in the following order:\n-\t *  - git_exec_path()\n-\t *  - the path of the \"git\" command if we could find it\n-\t *    in $0\n-\t *  - the regular PATH.\n+\t * We execute external git command via execv_git_cmd(),\n+\t * which looks at \"--exec-path\" option, GIT_EXEC_PATH\n+\t * environment, and $(gitexecdir) in Makefile while built,\n+\t * in this order.  For scripted commands, we prepend\n+\t * the value of the exec_path variable to the PATH.\n \t */\n \tif (exec_path)\n \t\tprepend_to_path(exec_path, strlen(exec_path));\n"},{"id":"49222","messageId":"20070731135220.GA20679@coredump.intra.peff.net","threadId":"9307","inReplyTo":"7vps29f0gp.fsf@assigned-by-dhcp.cox.net","subject":"Re: \"git stash\" is not known to git","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-07-31T13:52:20Z","receivedAt":"2007-07-31T13:52:20Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 31, 2007 at 01:20:54AM -0700, Junio C Hamano wrote:\n\n> +\t * We execute external git command via execv_git_cmd(),\n> +\t * which looks at \"--exec-path\" option, GIT_EXEC_PATH\n> +\t * environment, and $(gitexecdir) in Makefile while built,\n> +\t * in this order.  For scripted commands, we prepend\n> +\t * the value of the exec_path variable to the PATH.\n>  \t */\n\nYes, that matches my reading of the code.\n\n-Jeff\n"}]}