git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 8/9] Export rerere() and launch_editor().

From
Kristian Høgsberg <krh@redhat.com>
Date
Sep 6, 2007, 00:23 UTC
Message-ID
<11890382264046-git-send-email-krh@redhat.com>
In-Reply-To
<11890382262161-git-send-email-krh@redhat.com>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
 builtin-rerere.c |   16 ++++++++++++++++
 builtin-tag.c    |    3 +--
 commit.h         |    1 +
 strbuf.h         |    1 +
 4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/builtin-rerere.c b/builtin-rerere.c
index 29d057c..eb22a28 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -415,6 +415,22 @@ static int is_rerere_enabled(void)
 	return 1;
 }
 
+/* Export for builtin-commit. */
+int rerere(void)
+{
+	struct path_list merge_rr = { NULL, 0, 0, 1 };
+	int fd;
+
+	git_config(git_rerere_config);
+	if (!is_rerere_enabled())
+		return 0;
+
+	merge_rr_path = xstrdup(git_path("rr-cache/MERGE_RR"));
+	fd = hold_lock_file_for_update(&write_lock, merge_rr_path, 1);
+	read_rr(&merge_rr);
+	return do_plain_rerere(&merge_rr, fd);
+}
+
 int cmd_rerere(int argc, const char **argv, const char *prefix)
 {
 	struct path_list merge_rr = { NULL, 0, 0, 1 };
diff --git a/builtin-tag.c b/builtin-tag.c
index 8724d49..3b181f5 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -18,12 +18,11 @@ static const char builtin_tag_usage[] =
 
 static char signingkey[1000];
 
-static void launch_editor(const char *path, struct strbuf *sb)
+void launch_editor(const char *path, struct strbuf *sb)
 {
 	const char *editor, *terminal;
 	struct child_process child;
 	const char *args[3];
-	int fd;
 
 	editor = getenv("GIT_EDITOR");
 	if (!editor && editor_program)
diff --git a/commit.h b/commit.h
index 64e1d4b..39934cc 100644
--- a/commit.h
+++ b/commit.h
@@ -130,5 +130,6 @@ create_commit(const unsigned char *tree_sha1,
 	      const char *message, int length);
 
 extern int interactive_add(void);
+extern int rerere(void);
 
 #endif /* COMMIT_H */
diff --git a/strbuf.h b/strbuf.h
index e852070..b009b4b 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -16,5 +16,6 @@ extern void strbuf_printf(struct strbuf *sb, const char *fmt, ...);
 extern int strbuf_read_fd(struct strbuf *sb, int fd);
 extern int strbuf_read_path(struct strbuf *sb, const char *path);
 extern size_t stripspace(struct strbuf *sb, int skip_comments);
+extern void launch_editor(const char *path, struct strbuf *sb);
 
 #endif /* STRBUF_H */
-- 
1.5.2.GIT
Previous: Kristian HøgsbergNext: Kristian Høgsberg
Message 8 of 25 in “Enable wt-status output to a given FILE pointer.”
  1. 1/9 Enable wt-status output to a given FILE pointer.Kristian Høgsberg, Sep 6, 2007
  2. 2/9 Enable wt-status to run against non-standard index file.Kristian Høgsberg, Sep 6, 2007
  3. 3/9 Add strbuf_printf() to do formatted printing to a strbuf.Kristian Høgsberg, Sep 6, 2007
  4. 4/9 Introduce entry point for launching add--interactive.Kristian Høgsberg, Sep 6, 2007
  5. 5/9 Introduce strbuf_read_fd().Kristian Høgsberg, Sep 6, 2007
  6. 6/9 Rewrite launch_editor, create_tag and stripspace to use strbufs.Kristian Høgsberg, Sep 6, 2007
  7. 7/9 Add strbuf_read_path().Kristian Høgsberg, Sep 6, 2007
  8. 8/9 Export rerere() and launch_editor().Kristian Høgsberg, Sep 6, 2007
  9. 9/9 Implement git commit as a builtin command.Kristian Høgsberg, Sep 6, 2007
  10. Johannes SchindelinSep 6, 2007
  11. Kristian HøgsbergSep 17, 2007
  12. Johannes SchindelinSep 17, 2007
  13. Jeff KingSep 17, 2007
  14. Kristian HøgsbergSep 18, 2007
  15. Johannes SchindelinSep 6, 2007
  16. Johannes SchindelinSep 6, 2007
  17. Kristian HøgsbergSep 17, 2007
  18. Johannes SchindelinSep 6, 2007
  19. Kristian HøgsbergSep 17, 2007
  20. Johannes SchindelinSep 17, 2007
  21. Junio C HamanoSep 6, 2007
  22. Pierre HabouzitSep 6, 2007
  23. Pierre HabouzitSep 6, 2007
  24. Johannes SchindelinSep 6, 2007
  25. Kristian HøgsbergSep 17, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.