Git fork
at reftables-rust 35 lines 1.2 kB view raw
1#ifndef EDITOR_H 2#define EDITOR_H 3 4struct repository; 5struct strbuf; 6 7const char *git_editor(void); 8const char *git_sequence_editor(void); 9int is_terminal_dumb(void); 10 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. 17 */ 18int launch_editor(const char *path, struct strbuf *buffer, 19 const char *const *env); 20 21int launch_sequence_editor(const char *path, struct strbuf *buffer, 22 const char *const *env); 23 24/* 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. 29 * 30 * If `path` is relative, it refers to a file in the `.git` directory. 31 */ 32int strbuf_edit_interactively(struct repository *r, struct strbuf *buffer, 33 const char *path, const char *const *env); 34 35#endif