Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git_extract_argv0_path(): Move check for valid argv0 from caller to callee
author
Steffen Prohaska
<prohaska@zib.de>
Sun, 18 Jan 2009 12:00:11 +0000
(13:00 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 26 Jan 2009 08:26:05 +0000
(
00:26
-0800)
This simplifies the calling code.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
exec_cmd.c
patch
|
blob
|
history
git.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(from parent 1:
4dd47c3
)
diff --git
a/exec_cmd.c
b/exec_cmd.c
index e508f1e66d92d46c00013691d5a7c1d7dc8fe11a..f8f416b6460d7d2d4f5415258dadc7367412ba5a 100644
(file)
--- a/
exec_cmd.c
+++ b/
exec_cmd.c
@@
-22,7
+22,11
@@
const char *system_path(const char *path)
const char *git_extract_argv0_path(const char *argv0)
{
- const char *slash = argv0 + strlen(argv0);
+ const char *slash;
+
+ if (!argv0 || !*argv0)
+ return NULL;
+ slash = argv0 + strlen(argv0);
while (argv0 <= slash && !is_dir_sep(*slash))
slash--;
diff --git
a/git.c
b/git.c
index bf21e21cef00ca5e52ac9a9689aec9c7b6f73b84..320cb435646361b9d542d22d1592f985008fb750 100644
(file)
--- a/
git.c
+++ b/
git.c
@@
-444,9
+444,8
@@
int main(int argc, const char **argv)
{
const char *cmd;
- if (argv[0] && *argv[0])
- cmd = git_extract_argv0_path(argv[0]);
- else
+ cmd = git_extract_argv0_path(argv[0]);
+ if (!cmd)
cmd = "git-help";
/*