summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5868016)
raw | patch | inline | side by side (parent: 5868016)
author | Kristian Høgsberg <krh@redhat.com> | |
Tue, 18 Sep 2007 00:06:47 +0000 (20:06 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 27 Sep 2007 08:29:56 +0000 (01:29 -0700) |
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-rerere.c | patch | blob | history | |
commit.h | patch | blob | history |
diff --git a/builtin-rerere.c b/builtin-rerere.c
index b8206744c12307b3efbdebc99e5bcdd4a8632212..74493237c9ca129cd7398963ace747a04a6bf6fd 100644 (file)
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
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);
diff --git a/commit.h b/commit.h
index b50c30e255340ecfcb7167e899ef7c16bc562bd3..b661503972e54a6c0eb20295cf982f8f8b48f461 100644 (file)
--- a/commit.h
+++ b/commit.h
extern int interactive_add(void);
extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
+extern int rerere(void);
#endif /* COMMIT_H */