From f22a76e9110e8e31efa3781b1a3cf2b4565d9e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 28 Jul 2014 20:24:29 +0200 Subject: strbuf: add strbuf_getcwd() Add strbuf_getcwd(), which puts the current working directory into a strbuf. Because it doesn't use a fixed-size buffer it supports arbitrarily long paths, provided the platform's getcwd() does as well. At least on Linux and FreeBSD it handles paths longer than PATH_MAX just fine. Suggested-by: Karsten Blees Helped-by: Duy Nguyen Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/technical/api-strbuf.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/technical') diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt index 3350d97dda..834c406b3b 100644 --- a/Documentation/technical/api-strbuf.txt +++ b/Documentation/technical/api-strbuf.txt @@ -289,6 +289,10 @@ same behaviour as well. use it unless you need the correct position in the file descriptor. +`strbuf_getcwd`:: + + Set the buffer to the path of the current working directory. + `stripspace`:: Strip whitespace from a buffer. The second parameter controls if -- cgit v1.2.3 From 679eebe24d4c2120f8c01fb4524fcc489718fc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 28 Jul 2014 20:33:55 +0200 Subject: abspath: convert absolute_path() to strbuf Move most of the code of absolute_path() into the new function strbuf_add_absolute_path() and in the process transform it to use struct strbuf and xgetcwd() instead of a PATH_MAX-sized buffer, which can be too small on some file systems. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/technical/api-strbuf.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Documentation/technical') diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt index 834c406b3b..1639a4a56b 100644 --- a/Documentation/technical/api-strbuf.txt +++ b/Documentation/technical/api-strbuf.txt @@ -293,6 +293,12 @@ same behaviour as well. Set the buffer to the path of the current working directory. +`strbuf_add_absolute_path` + + Add a path to a buffer, converting a relative path to an + absolute one in the process. Symbolic links are not + resolved. + `stripspace`:: Strip whitespace from a buffer. The second parameter controls if -- cgit v1.2.3