git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "git stash" is not known to git
@ 2007-07-30  9:22 David Kastrup
  2007-07-30  9:44 ` Matthieu Moy
  2007-07-30 10:12 ` Junio C Hamano
  0 siblings, 2 replies; 14+ messages in thread
From: David Kastrup @ 2007-07-30  9:22 UTC (permalink / raw)
  To: git


One has to use git-stash rather than "git stash".  Oversight?

-- 
David Kastrup

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

* Re: "git stash" is not known to git
  2007-07-30  9:22 "git stash" is not known to git David Kastrup
@ 2007-07-30  9:44 ` Matthieu Moy
  2007-07-30  9:57   ` David Kastrup
  2007-07-30 10:04   ` Jeff King
  2007-07-30 10:12 ` Junio C Hamano
  1 sibling, 2 replies; 14+ messages in thread
From: Matthieu Moy @ 2007-07-30  9:44 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

David Kastrup <dak@gnu.org> writes:

> One has to use git-stash rather than "git stash".  Oversight?

This looks like an incorrect installation, with git-stash in your
$PATH, but not in the place git looks for its commands (I don't
remember the exact mechanism).

-- 
Matthieu

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

* Re: "git stash" is not known to git
  2007-07-30  9:44 ` Matthieu Moy
@ 2007-07-30  9:57   ` David Kastrup
  2007-07-30 10:06     ` Jeff King
  2007-07-30 10:04   ` Jeff King
  1 sibling, 1 reply; 14+ messages in thread
From: David Kastrup @ 2007-07-30  9:57 UTC (permalink / raw)
  To: git

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> David Kastrup <dak@gnu.org> writes:
>
>> One has to use git-stash rather than "git stash".  Oversight?
>
> This looks like an incorrect installation, with git-stash in your
> $PATH, but not in the place git looks for its commands (I don't
> remember the exact mechanism).

I don't think so: in git.c we have at lines 362ff

                { "show-branch", cmd_show_branch, RUN_SETUP },
                { "show", cmd_show, RUN_SETUP | USE_PAGER },
                { "stripspace", cmd_stripspace },
                { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },

So it really seems like stash is not known to git.c.  Of course, I
have no real clue about git.c's operation (or I'd have proferred a
patch) and not right now the time to look further.

-- 
David Kastrup

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

* Re: "git stash" is not known to git
  2007-07-30  9:44 ` Matthieu Moy
  2007-07-30  9:57   ` David Kastrup
@ 2007-07-30 10:04   ` Jeff King
  2007-07-30 17:52     ` Junio C Hamano
  2007-07-31  8:20     ` Junio C Hamano
  1 sibling, 2 replies; 14+ messages in thread
From: Jeff King @ 2007-07-30 10:04 UTC (permalink / raw)
  To: git; +Cc: David Kastrup, Linus Torvalds

On Mon, Jul 30, 2007 at 11:44:31AM +0200, Matthieu Moy wrote:

> > One has to use git-stash rather than "git stash".  Oversight?
> 
> This looks like an incorrect installation, with git-stash in your
> $PATH, but not in the place git looks for its commands (I don't
> remember the exact mechanism).

On a related note, is it just me, or is the following comment and related code
in git.c (introduced by Linus in 231af832) totally bogus:

  /*
   * We search for git commands in the following order:
   *  - git_exec_path()
   *  - the path of the "git" command if we could find it
   *    in $0
   *  - the regular PATH.
   */

We never actually look in the regular PATH since we call execv_git_cmd
(although we do still munge the PATH, apparently so shell scripts can
use git-foo syntax; see 77cb17e9). This means you can't drop "git-foo"
into your PATH and have it work as "git foo".

What is the desired behavior?

-Peff

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

* Re: "git stash" is not known to git
  2007-07-30  9:57   ` David Kastrup
@ 2007-07-30 10:06     ` Jeff King
  2007-07-30 10:24       ` David Kastrup
  0 siblings, 1 reply; 14+ messages in thread
From: Jeff King @ 2007-07-30 10:06 UTC (permalink / raw)
  To: git; +Cc: David Kastrup

On Mon, Jul 30, 2007 at 11:57:00AM +0200, David Kastrup wrote:

> > This looks like an incorrect installation, with git-stash in your
> > $PATH, but not in the place git looks for its commands (I don't
> > remember the exact mechanism).
> 
> I don't think so: in git.c we have at lines 362ff
> 
>                 { "show-branch", cmd_show_branch, RUN_SETUP },
>                 { "show", cmd_show, RUN_SETUP | USE_PAGER },
>                 { "stripspace", cmd_stripspace },
>                 { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
> 
> So it really seems like stash is not known to git.c.  Of course, I
> have no real clue about git.c's operation (or I'd have proferred a
> patch) and not right now the time to look further.

That list is for builtins; git-stash is an external shell script. See
execv_git_cmd for the list of places where it is looking for git-stash.

Since I seem to recall you working some symlink magic with your
installation in a recent message, that might be related. Is it just
git-stash, or are other scripts failing (try "git status")?

-Peff

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

* Re: "git stash" is not known to git
  2007-07-30  9:22 "git stash" is not known to git David Kastrup
  2007-07-30  9:44 ` Matthieu Moy
@ 2007-07-30 10:12 ` Junio C Hamano
  1 sibling, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2007-07-30 10:12 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

David Kastrup <dak@gnu.org> writes:

> One has to use git-stash rather than "git stash".  Oversight?

Does any of the other shell-scripts work without dashes?
E.g. commit, merge, am, checkout?

If they do, then probably you are invoking older versions of
these scripts than what you think you are.  "git" itself looks
at GIT_EXEC_PATH and then the $(gitexecdir) from the Makefile
when it was built for its subcommands.

Perhaps this is your "symlinked install" gone awry?  I dunno.

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

* Re: "git stash" is not known to git
  2007-07-30 10:06     ` Jeff King
@ 2007-07-30 10:24       ` David Kastrup
  2007-07-30 10:37         ` Jeff King
  0 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2007-07-30 10:24 UTC (permalink / raw)
  To: git

Jeff King <peff@peff.net> writes:

> Since I seem to recall you working some symlink magic with your
> installation in a recent message, that might be related. Is it just
> git-stash, or are other scripts failing (try "git status")?

Hmpf.  On another system (git version 1.5.3.rc3.48.g0d59d) this works.
I don't have the system at hand right now where it doesn't.  So it
would be my guess that either I have not called the install-symlinks
target recently enough, or its implementation on that system has been
broken for some time.

I'll have to check this evening.

On the other hand, I am quite sure that while "git stash" did not
work, "git-stash" had no problem.

So something bogus in git's PATH lookup would definitely appear to be
going on: it should be hard to get the symlinks messed up badly enough
to have one work and not the other.

More this evening.

-- 
David Kastrup

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

* Re: "git stash" is not known to git
  2007-07-30 10:24       ` David Kastrup
@ 2007-07-30 10:37         ` Jeff King
  2007-07-30 10:52           ` David Kastrup
  0 siblings, 1 reply; 14+ messages in thread
From: Jeff King @ 2007-07-30 10:37 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

On Mon, Jul 30, 2007 at 12:24:51PM +0200, David Kastrup wrote:

> On the other hand, I am quite sure that while "git stash" did not
> work, "git-stash" had no problem.

Right. git-stash is in your PATH, but not in git's exec path (which is
_not_ the same as PATH).

> So something bogus in git's PATH lookup would definitely appear to be
> going on: it should be hard to get the symlinks messed up badly enough
> to have one work and not the other.

Git doesn't look for subcommands in the PATH.

-Peff

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

* Re: "git stash" is not known to git
  2007-07-30 10:37         ` Jeff King
@ 2007-07-30 10:52           ` David Kastrup
  2007-07-30 11:03             ` Jeff King
  0 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2007-07-30 10:52 UTC (permalink / raw)
  To: git

Jeff King <peff@peff.net> writes:

> On Mon, Jul 30, 2007 at 12:24:51PM +0200, David Kastrup wrote:
>
>> On the other hand, I am quite sure that while "git stash" did not
>> work, "git-stash" had no problem.
>
> Right. git-stash is in your PATH, but not in git's exec path (which is
> _not_ the same as PATH).

How does it calculate its exec path?  It would appear that it would
not contain _either_ /usr/local/bin _or_ /opt/git/bin in my
installation if it can't find git-stash (which should be statable in
both places).

Have a command handy for checking the exec path?

Ok, this is pretty much idle speculation until I am back at the system
in question, but I have problems envisioning just what kind of goof
might have happened here.

-- 
David Kastrup

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

* Re: "git stash" is not known to git
  2007-07-30 10:52           ` David Kastrup
@ 2007-07-30 11:03             ` Jeff King
  2007-07-30 19:30               ` David Kastrup
  0 siblings, 1 reply; 14+ messages in thread
From: Jeff King @ 2007-07-30 11:03 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

On Mon, Jul 30, 2007 at 12:52:40PM +0200, David Kastrup wrote:

> How does it calculate its exec path?  It would appear that it would
> not contain _either_ /usr/local/bin _or_ /opt/git/bin in my
> installation if it can't find git-stash (which should be statable in
> both places).

See exec_cmd.c:execv_git_cmd. It checks in order:
  1. --exec-path= on command line
  2. $GIT_EXEC_PATH from environment
  3. GIT_EXEC_PATH defined at compile-time (set by Makefile from
      $(gitexecdir), which is generally the same as $(bindir))

So it should have /opt/git/bin in your case, but it's possible since
that is a Makefile variable that you failed to recompile correctly after
changing its value.

> Have a command handy for checking the exec path?

git --exec-path

-Peff

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

* Re: "git stash" is not known to git
  2007-07-30 10:04   ` Jeff King
@ 2007-07-30 17:52     ` Junio C Hamano
  2007-07-31  8:20     ` Junio C Hamano
  1 sibling, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2007-07-30 17:52 UTC (permalink / raw)
  To: Jeff King; +Cc: git, David Kastrup, Linus Torvalds

Jeff King <peff@peff.net> writes:

> On a related note, is it just me, or is the following comment and related code
> in git.c (introduced by Linus in 231af832) totally bogus:
>
>   /*
>    * We search for git commands in the following order:
>    *  - git_exec_path()
>    *  - the path of the "git" command if we could find it
>    *    in $0
>    *  - the regular PATH.
>    */
>
> We never actually look in the regular PATH since we call execv_git_cmd
> (although we do still munge the PATH, apparently so shell scripts can
> use git-foo syntax; see 77cb17e9). This means you can't drop "git-foo"
> into your PATH and have it work as "git foo".
>
> What is the desired behavior?

I failed to spot patches to the area without updating the
comment.  What the code does is fine, the comment is stale.

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

* Re: "git stash" is not known to git
  2007-07-30 11:03             ` Jeff King
@ 2007-07-30 19:30               ` David Kastrup
  0 siblings, 0 replies; 14+ messages in thread
From: David Kastrup @ 2007-07-30 19:30 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Jeff King <peff@peff.net> writes:

> On Mon, Jul 30, 2007 at 12:52:40PM +0200, David Kastrup wrote:
>
>> How does it calculate its exec path?  It would appear that it would
>> not contain _either_ /usr/local/bin _or_ /opt/git/bin in my
>> installation if it can't find git-stash (which should be statable in
>> both places).
>
> See exec_cmd.c:execv_git_cmd. It checks in order:
>   1. --exec-path= on command line
>   2. $GIT_EXEC_PATH from environment
>   3. GIT_EXEC_PATH defined at compile-time (set by Makefile from
>       $(gitexecdir), which is generally the same as $(bindir))
>
> So it should have /opt/git/bin in your case, but it's possible since
> that is a Makefile variable that you failed to recompile correctly after
> changing its value.
>
>> Have a command handy for checking the exec path?
>
> git --exec-path

dak@lola:/home/tmp/git$ git --exec-path
/opt/git/bin
dak@lola:/home/tmp/git$ git stash --help
Reformatting git-stash(1), please wait...
WARNING: terminal is not fully functional
-  (press RETURN)q
dak@lola:/home/tmp/git$ git-stash --help
dak@lola:/home/tmp/git$ Usage: /usr/local/bin/git-stash [ | list | show | apply | clear]

I think I'll just soak my head in a bucket.  Don't ask me _what_ I
imagined to be experiencing here.

Maybe missing out shell completion when not typing the hyphen or
similar nonsense.  Sorry for the noise.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: "git stash" is not known to git
  2007-07-30 10:04   ` Jeff King
  2007-07-30 17:52     ` Junio C Hamano
@ 2007-07-31  8:20     ` Junio C Hamano
  2007-07-31 13:52       ` Jeff King
  1 sibling, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2007-07-31  8:20 UTC (permalink / raw)
  To: Jeff King; +Cc: git, David Kastrup, Linus Torvalds

Jeff King <peff@peff.net> writes:

> We never actually look in the regular PATH since we call execv_git_cmd
> (although we do still munge the PATH, apparently so shell scripts can
> use git-foo syntax; see 77cb17e9). This means you can't drop "git-foo"
> into your PATH and have it work as "git foo".

Would this be a good replacement?

diff --git a/git.c b/git.c
index 2433355..25b8274 100644
--- a/git.c
+++ b/git.c
@@ -448,11 +448,11 @@ int main(int argc, const char **argv)
 	cmd = argv[0];
 
 	/*
-	 * We search for git commands in the following order:
-	 *  - git_exec_path()
-	 *  - the path of the "git" command if we could find it
-	 *    in $0
-	 *  - the regular PATH.
+	 * We execute external git command via execv_git_cmd(),
+	 * which looks at "--exec-path" option, GIT_EXEC_PATH
+	 * environment, and $(gitexecdir) in Makefile while built,
+	 * in this order.  For scripted commands, we prepend
+	 * the value of the exec_path variable to the PATH.
 	 */
 	if (exec_path)
 		prepend_to_path(exec_path, strlen(exec_path));

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

* Re: "git stash" is not known to git
  2007-07-31  8:20     ` Junio C Hamano
@ 2007-07-31 13:52       ` Jeff King
  0 siblings, 0 replies; 14+ messages in thread
From: Jeff King @ 2007-07-31 13:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, David Kastrup, Linus Torvalds

On Tue, Jul 31, 2007 at 01:20:54AM -0700, Junio C Hamano wrote:

> +	 * We execute external git command via execv_git_cmd(),
> +	 * which looks at "--exec-path" option, GIT_EXEC_PATH
> +	 * environment, and $(gitexecdir) in Makefile while built,
> +	 * in this order.  For scripted commands, we prepend
> +	 * the value of the exec_path variable to the PATH.
>  	 */

Yes, that matches my reading of the code.

-Jeff

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

end of thread, other threads:[~2007-07-31 13:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-30  9:22 "git stash" is not known to git David Kastrup
2007-07-30  9:44 ` Matthieu Moy
2007-07-30  9:57   ` David Kastrup
2007-07-30 10:06     ` Jeff King
2007-07-30 10:24       ` David Kastrup
2007-07-30 10:37         ` Jeff King
2007-07-30 10:52           ` David Kastrup
2007-07-30 11:03             ` Jeff King
2007-07-30 19:30               ` David Kastrup
2007-07-30 10:04   ` Jeff King
2007-07-30 17:52     ` Junio C Hamano
2007-07-31  8:20     ` Junio C Hamano
2007-07-31 13:52       ` Jeff King
2007-07-30 10:12 ` Junio C Hamano

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