bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU global, do not resolve symlinks by default and use PWD if available


From: dhruva
Subject: GNU global, do not resolve symlinks by default and use PWD if available
Date: Mon, 23 Jun 2014 13:00:36 -0700

I use GNU global via emacs interface. My working directory root is a
symlink under which I have different SCM clients. The root provides
storage that is backed up.
I use recentf in emacs to store recently visited source files. GNU
global always resolves the symlinks and opens the file with the
'realpath'. Many times this is very long and not so user friendly.

I have a small fix that fixes this issue.

Index: libutil/getdbpath.c
===================================================================
RCS file: /sources/global/global/libutil/getdbpath.c,v
retrieving revision 1.32
diff -d -u -r1.32 getdbpath.c
--- libutil/getdbpath.c 28 Feb 2014 04:08:11 -0000      1.32
+++ libutil/getdbpath.c 23 Jun 2014 19:28:47 -0000
@@ -211,7 +211,11 @@
        char *p;
        static char msg[1024];

-       if (!getcwd(cwd, MAXPATHLEN)) {
+       /* Prefer shorter paths over long realpath */
+       p = getenv("PWD");
+       if (p) {
+               strncpy(cwd, p, sizeof(cwd) - 1);
+       } else if (!getcwd(cwd, MAXPATHLEN)) {
                gtags_dbpath_error = "cannot get current directory.";
                return -1;
        }

-dhruva



reply via email to

[Prev in Thread] Current Thread [Next in Thread]