|
1 | 1 | #include "git-compat-util.h" |
2 | | -#include "abspath.h" |
3 | 2 | #include "alloc.h" |
4 | 3 | #include "environment.h" |
5 | 4 | #include "gettext.h" |
@@ -900,42 +899,6 @@ void strbuf_humanise_rate(struct strbuf *buf, off_t bytes) |
900 | 899 | strbuf_humanise(buf, bytes, 1); |
901 | 900 | } |
902 | 901 |
|
903 | | -void strbuf_add_absolute_path(struct strbuf *sb, const char *path) |
904 | | -{ |
905 | | - if (!*path) |
906 | | - die("The empty string is not a valid path"); |
907 | | - if (!is_absolute_path(path)) { |
908 | | - struct stat cwd_stat, pwd_stat; |
909 | | - size_t orig_len = sb->len; |
910 | | - char *cwd = xgetcwd(); |
911 | | - char *pwd = getenv("PWD"); |
912 | | - if (pwd && strcmp(pwd, cwd) && |
913 | | - !stat(cwd, &cwd_stat) && |
914 | | - (cwd_stat.st_dev || cwd_stat.st_ino) && |
915 | | - !stat(pwd, &pwd_stat) && |
916 | | - pwd_stat.st_dev == cwd_stat.st_dev && |
917 | | - pwd_stat.st_ino == cwd_stat.st_ino) |
918 | | - strbuf_addstr(sb, pwd); |
919 | | - else |
920 | | - strbuf_addstr(sb, cwd); |
921 | | - if (sb->len > orig_len && !is_dir_sep(sb->buf[sb->len - 1])) |
922 | | - strbuf_addch(sb, '/'); |
923 | | - free(cwd); |
924 | | - } |
925 | | - strbuf_addstr(sb, path); |
926 | | -} |
927 | | - |
928 | | -void strbuf_add_real_path(struct strbuf *sb, const char *path) |
929 | | -{ |
930 | | - if (sb->len) { |
931 | | - struct strbuf resolved = STRBUF_INIT; |
932 | | - strbuf_realpath(&resolved, path, 1); |
933 | | - strbuf_addbuf(sb, &resolved); |
934 | | - strbuf_release(&resolved); |
935 | | - } else |
936 | | - strbuf_realpath(sb, path, 1); |
937 | | -} |
938 | | - |
939 | 902 | int printf_ln(const char *fmt, ...) |
940 | 903 | { |
941 | 904 | int ret; |
|
0 commit comments