Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: more flexible cd builtin



If the current directory is renamed, zsh's cd will fail because
it's attempting to change to the full path which no longer exists.
This allows one to cd to a subdirectory successfully.  This is
incomplete; `pwd` will become correct, but $PWD will not.

Index: Src/builtin.c
===================================================================
RCS file: /cvs/zsh/zsh/Src/builtin.c,v
retrieving revision 1.1.1.44
diff -u -r1.1.1.44 builtin.c
--- Src/builtin.c	1999/12/10 21:40:57	1.1.1.44
+++ Src/builtin.c	1999/12/13 21:51:42
@@ -951,6 +951,7 @@
     else
 	unmetafy(buf, &dlen);
 
+    if (lchdir(dest, NULL, hard))	/* Try plain relative first */
     if (lchdir(buf, NULL, hard)) {
 	free(buf);
 	return NULL;



Messages sorted by: Reverse Date, Date, Thread, Author