Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Wan <calvinwan@google.com>2023-06-06 22:48:39 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-12 23:49:35 +0300
commit5d1344b4973c8ea4904005f3bb51a47334ebb370 (patch)
tree0e8ade677ab5d12198aa16afe23d159cca122fb8 /strbuf.c
parent16b171fda03d9186e58fade7d727d38613938097 (diff)
abspath: move related functions to abspath
Move abspath-related functions from strbuf.[ch] to abspath.[ch] so that strbuf is focused on string manipulation routines with minimal dependencies. Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/strbuf.c b/strbuf.c
index f5dfd093a0..a2249ae7ed 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,5 +1,4 @@
#include "git-compat-util.h"
-#include "abspath.h"
#include "alloc.h"
#include "environment.h"
#include "gettext.h"
@@ -900,42 +899,6 @@ void strbuf_humanise_rate(struct strbuf *buf, off_t bytes)
strbuf_humanise(buf, bytes, 1);
}
-void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
-{
- if (!*path)
- die("The empty string is not a valid path");
- if (!is_absolute_path(path)) {
- struct stat cwd_stat, pwd_stat;
- size_t orig_len = sb->len;
- char *cwd = xgetcwd();
- char *pwd = getenv("PWD");
- if (pwd && strcmp(pwd, cwd) &&
- !stat(cwd, &cwd_stat) &&
- (cwd_stat.st_dev || cwd_stat.st_ino) &&
- !stat(pwd, &pwd_stat) &&
- pwd_stat.st_dev == cwd_stat.st_dev &&
- pwd_stat.st_ino == cwd_stat.st_ino)
- strbuf_addstr(sb, pwd);
- else
- strbuf_addstr(sb, cwd);
- if (sb->len > orig_len && !is_dir_sep(sb->buf[sb->len - 1]))
- strbuf_addch(sb, '/');
- free(cwd);
- }
- strbuf_addstr(sb, path);
-}
-
-void strbuf_add_real_path(struct strbuf *sb, const char *path)
-{
- if (sb->len) {
- struct strbuf resolved = STRBUF_INIT;
- strbuf_realpath(&resolved, path, 1);
- strbuf_addbuf(sb, &resolved);
- strbuf_release(&resolved);
- } else
- strbuf_realpath(sb, path, 1);
-}
-
int printf_ln(const char *fmt, ...)
{
int ret;