summaryrefslogtreecommitdiff
path: root/builtin-rerere.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-09-18 00:06:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-27 08:29:56 (GMT)
commitd8b7db0abfd0c74478964f5a9b08ad141f4f7f82 (patch)
tree66a657272dc048755b7a1b70988076a11c3a19e5 /builtin-rerere.c
parent586801650824f0f7b62c34a206b6a60ffbcd8be0 (diff)
downloadgit-d8b7db0abfd0c74478964f5a9b08ad141f4f7f82.zip
git-d8b7db0abfd0c74478964f5a9b08ad141f4f7f82.tar.gz
git-d8b7db0abfd0c74478964f5a9b08ad141f4f7f82.tar.bz2
Export rerere() and launch_editor().
Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-rerere.c')
-rw-r--r--builtin-rerere.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/builtin-rerere.c b/builtin-rerere.c
index b820674..7449323 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -389,18 +389,39 @@ static int is_rerere_enabled(void)
return 1;
}
-int cmd_rerere(int argc, const char **argv, const char *prefix)
+static int setup_rerere(struct path_list *merge_rr)
{
- struct path_list merge_rr = { NULL, 0, 0, 1 };
- int i, fd = -1;
+ int fd;
git_config(git_rerere_config);
if (!is_rerere_enabled())
- return 0;
+ return -1;
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);
+ read_rr(merge_rr);
+ return fd;
+}
+
+int rerere(void)
+{
+ struct path_list merge_rr = { NULL, 0, 0, 1 };
+ int fd;
+
+ fd = setup_rerere(&merge_rr);
+ if (fd < 0)
+ return 0;
+ 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 };
+ int i, fd;
+
+ fd = setup_rerere(&merge_rr);
+ if (fd < 0)
+ return 0;
if (argc < 2)
return do_plain_rerere(&merge_rr, fd);