Post 2.46-rc0 batch #1
[git.git] / editor.h
blob8016bb5e00b3ca2d21105b94d504505728fe5e69
1 #ifndef EDITOR_H
2 #define EDITOR_H
4 struct strbuf;
6 const char *git_editor(void);
7 const char *git_sequence_editor(void);
8 int is_terminal_dumb(void);
10 /**
11 * Launch the user preferred editor to edit a file and fill the buffer
12 * with the file's contents upon the user completing their editing. The
13 * third argument can be used to set the environment which the editor is
14 * run in. If the buffer is NULL the editor is launched as usual but the
15 * file's contents are not read into the buffer upon completion.
17 int launch_editor(const char *path, struct strbuf *buffer,
18 const char *const *env);
20 int launch_sequence_editor(const char *path, struct strbuf *buffer,
21 const char *const *env);
24 * In contrast to `launch_editor()`, this function writes out the contents
25 * of the specified file first, then clears the `buffer`, then launches
26 * the editor and reads back in the file contents into the `buffer`.
27 * Finally, it deletes the temporary file.
29 * If `path` is relative, it refers to a file in the `.git` directory.
31 int strbuf_edit_interactively(struct strbuf *buffer, const char *path,
32 const char *const *env);
34 #endif