Skip to contentSkip to conversation

Deduce exec_path also from calls to git with a relative path

PATCH Scott R Parish 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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" <[email protected]>

Quoted 57 lines

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.

---

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

> Signed-off-by: Scott R Parish <[email protected]>

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(-)
git.c +3 -3
index d7c6bca..1dad764 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

Hi,

Quoted 1 line · Scott R Parish

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

#2 lore raw
Quoted 4 lines · Johannes Schindelin

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

Signature · 2 lines
Scott Parish
http://srparish.net/