Sync with 'maint'
[git/gitster.git] / editor.h
blobf1c41df378c5c3ae5e54ee4985eddecba54f00b4
1 #ifndef EDITOR_H
2 #define EDITOR_H
4 struct repository;
5 struct strbuf;
7 const char *git_editor(void);
8 const char *git_sequence_editor(void);
9 int is_terminal_dumb(void);
11 /**
12 * Launch the user preferred editor to edit a file and fill the buffer
13 * with the file's contents upon the user completing their editing. The
14 * third argument can be used to set the environment which the editor is
15 * run in. If the buffer is NULL the editor is launched as usual but the
16 * file's contents are not read into the buffer upon completion.
18 int launch_editor(const char *path, struct strbuf *buffer,
19 const char *const *env);
21 int launch_sequence_editor(const char *path, struct strbuf *buffer,
22 const char *const *env);
25 * In contrast to `launch_editor()`, this function writes out the contents
26 * of the specified file first, then clears the `buffer`, then launches
27 * the editor and reads back in the file contents into the `buffer`.
28 * Finally, it deletes the temporary file.
30 * If `path` is relative, it refers to a file in the `.git` directory.
32 int strbuf_edit_interactively(struct repository *r, struct strbuf *buffer,
33 const char *path, const char *const *env);
35 #endif