Re: Compiler warning under cygwin/mingw (was: fix for 50a6c8e)
From: SZEDER Gábor <hidden>
Date: 2016-06-15 23:08:32
Subsystem:
the rest · Maintainer:
Linus Torvalds
Hi,
quoted
And MINGW is not happy for other reasons: builtin/rev-parse.c: In function 'cmd_rev_parse': builtin/rev-parse.c:775:12: warning: implicit declaration of function 'realpath' [-Wimplicit-function-declaration] if (!realpath(gitdir, absolute_path)) ^I guess you're building "pu"; that is only in sg/completion-updates. I don't know if our custom real_path() would suffice there. You might want to ping the author. The patch is: http://article.gmane.org/gmane.comp.version-control.git/287462
Oh, I was not aware that there is a custom real_path() that is preferred over the system realpath(). I don't see why our real_path() would not suffice, it even makes the code a tad shorter. I will include the patch below in the reroll. Best, Gábor ---- >8 ---- Subject: [PATCH] fixup! rev-parse: add '--absolute-git-dir' option --- builtin/rev-parse.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 90a4dd6032c0..d6d9a82c77c4 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c@@ -762,10 +762,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) if (!gitdir && !prefix) gitdir = ".git"; if (gitdir) { - char absolute_path[PATH_MAX]; - if (!realpath(gitdir, absolute_path)) - die_errno(_("unable to get absolute path")); - puts(absolute_path); + puts(real_path(gitdir)); continue; } }
--
2.7.2.410.g92cb358