diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-04-25 13:56:19 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-04-25 13:56:20 -0700 |
| commit | 0807e57807aaffe2813fffb7704dcc9153f03832 (patch) | |
| tree | c6a5e764ff9a3e24c7b054ade453c161c2c4b2e5 /strbuf.c | |
| parent | 9ce9dea4e1c2419cca126d29fa7730baa078a11b (diff) | |
| parent | 331b094eec6d4c937af6e59df2a537112e4d8205 (diff) | |
| download | git-0807e57807aaffe2813fffb7704dcc9153f03832.tar.gz | |
Merge branch 'en/header-split-cache-h'
Header clean-up.
* en/header-split-cache-h: (24 commits)
protocol.h: move definition of DEFAULT_GIT_PORT from cache.h
mailmap, quote: move declarations of global vars to correct unit
treewide: reduce includes of cache.h in other headers
treewide: remove double forward declaration of read_in_full
cache.h: remove unnecessary includes
treewide: remove cache.h inclusion due to pager.h changes
pager.h: move declarations for pager.c functions from cache.h
treewide: remove cache.h inclusion due to editor.h changes
editor: move editor-related functions and declarations into common file
treewide: remove cache.h inclusion due to object.h changes
object.h: move some inline functions and defines from cache.h
treewide: remove cache.h inclusion due to object-file.h changes
object-file.h: move declarations for object-file.c functions from cache.h
treewide: remove cache.h inclusion due to git-zlib changes
git-zlib: move declarations for git-zlib functions from cache.h
treewide: remove cache.h inclusion due to object-name.h changes
object-name.h: move declarations for object-name.c functions from cache.h
treewide: remove unnecessary cache.h inclusion
treewide: be explicit about dependence on mem-pool.h
treewide: be explicit about dependence on oid-array.h
...
Diffstat (limited to 'strbuf.c')
| -rw-r--r-- | strbuf.c | 31 |
1 files changed, 2 insertions, 29 deletions
@@ -1,9 +1,10 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h" +#include "object-name.h" #include "refs.h" #include "string-list.h" #include "utf8.h" @@ -1179,34 +1180,6 @@ int strbuf_normalize_path(struct strbuf *src) return 0; } -int strbuf_edit_interactively(struct strbuf *buffer, const char *path, - const char *const *env) -{ - char *path2 = NULL; - int fd, res = 0; - - if (!is_absolute_path(path)) - path = path2 = xstrdup(git_path("%s", path)); - - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0666); - if (fd < 0) - res = error_errno(_("could not open '%s' for writing"), path); - else if (write_in_full(fd, buffer->buf, buffer->len) < 0) { - res = error_errno(_("could not write to '%s'"), path); - close(fd); - } else if (close(fd) < 0) - res = error_errno(_("could not close '%s'"), path); - else { - strbuf_reset(buffer); - if (launch_editor(path, buffer, env) < 0) - res = error_errno(_("could not edit '%s'"), path); - unlink(path); - } - - free(path2); - return res; -} - void strbuf_strip_file_from_path(struct strbuf *sb) { char *path_sep = find_last_dir_sep(sb->buf); |
