git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Deduce exec_path also from calls to git with a relative path
  2007-10-20  6:46 [PATCH] If git is ran with a relative path, try building an absolute exec_path from it Scott R Parish
@ 2007-10-20  7:21 ` Johannes Schindelin
  2007-10-20 12:25   ` David Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-10-20  7:21 UTC (permalink / raw)
  To: Scott R Parish; +Cc: git, spearce, gitster


There is already logic in the git wrapper to deduce the exec_path from
argv[0], when the git wrapper was called with an absolute path.  Extend
that logic to handle relative paths as well.

For example, when you call "../../hello/world/git", it will not turn
"../../hello/world" into an absolute path, and use that.

Initial implementation by Scott R Parish.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	On Fri, 19 Oct 2007, Scott R Parish wrote:

	>  Signed-off-by: Scott R Parish <srp@srparish.net>

	That is a little short for a commit message ;-)

	>  git.c |   35 +++++++++++++++++++++++++++++++++--
	>  1 files changed, 33 insertions(+), 2 deletions(-)

	I had commented on this before.  Probably I did a very bad job 
	at explaining things, so hopefully this is better:

 git.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git.c b/git.c
index d7c6bca..1dad764 100644
--- a/git.c
+++ b/git.c
@@ -414,13 +414,14 @@ int main(int argc, const char **argv)
 	/*
 	 * Take the basename of argv[0] as the command
 	 * name, and the dirname as the default exec_path
-	 * if it's an absolute path and we don't have
-	 * anything better.
+	 * if we don't have anything better.
 	 */
 	if (slash) {
 		*slash++ = 0;
 		if (*cmd == '/')
 			exec_path = cmd;
+		else
+			exec_path = xstrdup(make_absolute_path(cmd));
 		cmd = slash;
 	}
 
-- 
1.5.3.4.1287.g8b31e

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

* Re: [PATCH] Deduce exec_path also from calls to git with a  relative path
@ 2007-10-20  8:13 Scott R Parish
  2007-10-20 21:31 ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Scott R Parish @ 2007-10-20  8:13 UTC (permalink / raw)
  To: Johannes Schindelin, git, spearce, gitster


Wow, that sure cleaned up nicely! :)

Thanks
sRp


----- Original Message -----
Subject: [PATCH] Deduce exec_path also from calls to git with a relative path
Date: Sat, October 20, 2007 0:21
From: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>

> There is already logic in the git wrapper to deduce the exec_path from
> argv[0], when the git wrapper was called with an absolute path.  Extend
> that logic to handle relative paths as well.
>
> For example, when you call "../../hello/world/git", it will not turn
> "../../hello/world" into an absolute path, and use that.
>
> Initial implementation by Scott R Parish.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>
>         On Fri, 19 Oct 2007, Scott R Parish wrote:
>
>         >  Signed-off-by: Scott R Parish <srp@srparish.net>
>
>         That is a little short for a commit message ;-)
>
>         >  git.c |   35 +++++++++++++++++++++++++++++++++--
>         >  1 files changed, 33 insertions(+), 2 deletions(-)
>
>         I had commented on this before.  Probably I did a very bad job
>         at explaining things, so hopefully this is better:
>
>  git.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/git.c b/git.c
> index d7c6bca..1dad764 100644
> --- a/git.c
> +++ b/git.c
> @@ -414,13 +414,14 @@ int main(int argc, const char **argv)
>          /*
>           * Take the basename of argv[0] as the command
>           * name, and the dirname as the default exec_path
> -         * if it's an absolute path and we don't have
> -         * anything better.
> +         * if we don't have anything better.
>           */
>          if (slash) {
>                  *slash++ = 0;
>                  if (*cmd == '/')
>                          exec_path = cmd;
> +                else
> +                        exec_path = xstrdup(make_absolute_path(cmd));
>                  cmd = slash;
>          }
>
> --
> 1.5.3.4.1287.g8b31e
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

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

* Re: [PATCH] Deduce exec_path also from calls to git with a relative path
  2007-10-20  7:21 ` [PATCH] Deduce exec_path also from calls to git with a relative path Johannes Schindelin
@ 2007-10-20 12:25   ` David Brown
  2007-10-20 21:25     ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: David Brown @ 2007-10-20 12:25 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Scott R Parish, git, spearce, gitster

On Sat, Oct 20, 2007 at 08:21:34AM +0100, Johannes Schindelin wrote:

>For example, when you call "../../hello/world/git", it will not turn
>"../../hello/world" into an absolute path, and use that.

Did you mean "it will turn..."?

David

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

* Re: [PATCH] Deduce exec_path also from calls to git with a relative path
  2007-10-20 12:25   ` David Brown
@ 2007-10-20 21:25     ` Johannes Schindelin
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2007-10-20 21:25 UTC (permalink / raw)
  To: David Brown; +Cc: Scott R Parish, git, spearce, gitster

Hi,

On Sat, 20 Oct 2007, David Brown wrote:

> On Sat, Oct 20, 2007 at 08:21:34AM +0100, Johannes Schindelin wrote:
> 
> > For example, when you call "../../hello/world/git", it will not turn 
> > "../../hello/world" into an absolute path, and use that.
> 
> Did you mean "it will turn..."?

Yes, I meant that.  I was in a hurry, since a car was waiting outside the 
door, taking me to the highlands.

Ciao,
Dscho

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

* Re: [PATCH] Deduce exec_path also from calls to git with a      relative path
  2007-10-20  8:13 [PATCH] Deduce exec_path also from calls to git with a relative path Scott R Parish
@ 2007-10-20 21:31 ` Johannes Schindelin
  2007-10-20 23:04   ` Scott Parish
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-10-20 21:31 UTC (permalink / raw)
  To: Scott R Parish; +Cc: git, spearce, gitster

Hi,

On Sat, 20 Oct 2007, Scott R Parish wrote:

> Wow, that sure cleaned up nicely! :)

Heh.

BTW I did not mean to discourage you...  Rather, I wanted to show you that 
this list is a wonderful place to learn, as I did, do, and will do many 
times here.  (Just to clarify, since somebody said that I am usually not 
nice to newbies... cannot understand that at all ;-)

Ciao,
Dscho

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

* Re: [PATCH] Deduce exec_path also from calls to git with a relative path
  2007-10-20 21:31 ` Johannes Schindelin
@ 2007-10-20 23:04   ` Scott Parish
  0 siblings, 0 replies; 6+ messages in thread
From: Scott Parish @ 2007-10-20 23:04 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, spearce, gitster

On Sat, Oct 20, 2007 at 10:31:47PM +0100, Johannes Schindelin wrote:

> BTW I did not mean to discourage you...  Rather, I wanted to show you that 
> this list is a wonderful place to learn, as I did, do, and will do many 
> times here.  (Just to clarify, since somebody said that I am usually not 
> nice to newbies... cannot understand that at all ;-)

Nah, i'm actually rather encouraged that people have shown interest
in my patches and are so quick to find ways to improve on them!

Sorry about the top posting earlier; i've been away from active
open source participation for a while and have been forgetting my
etiquette.

sRp

-- 
Scott Parish
http://srparish.net/

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

end of thread, other threads:[~2007-10-21  2:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-20  8:13 [PATCH] Deduce exec_path also from calls to git with a relative path Scott R Parish
2007-10-20 21:31 ` Johannes Schindelin
2007-10-20 23:04   ` Scott Parish
  -- strict thread matches above, loose matches on Subject: below --
2007-10-20  6:46 [PATCH] If git is ran with a relative path, try building an absolute exec_path from it Scott R Parish
2007-10-20  7:21 ` [PATCH] Deduce exec_path also from calls to git with a relative path Johannes Schindelin
2007-10-20 12:25   ` David Brown
2007-10-20 21:25     ` Johannes Schindelin

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