summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cd2ef59)
raw | patch | inline | side by side (parent: cd2ef59)
author | Stephen Boyd <bebarino@gmail.com> | |
Mon, 23 Mar 2009 02:14:04 +0000 (19:14 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 23 Mar 2009 04:42:05 +0000 (21:42 -0700) |
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-log.c | patch | blob | history | |
log-tree.c | patch | blob | history | |
log-tree.h | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index 6a27ce6958e119f55e39848f1156deb3e801f80f..4f438db4c1985ef2d634dfedcb8a7075ce19a9e5 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
}
/* format-patch */
-#define FORMAT_PATCH_NAME_MAX 64
static const char *fmt_patch_suffix = ".patch";
static int numbered = 0;
return git_log_config(var, value, cb);
}
-
-static void get_patch_filename(struct commit *commit, int nr,
- const char *suffix, struct strbuf *buf)
-{
- int suffix_len = strlen(suffix) + 1;
- int start_len = buf->len;
-
- strbuf_addf(buf, commit ? "%04d-" : "%d", nr);
- if (commit) {
- format_commit_message(commit, "%f", buf, DATE_NORMAL);
- /*
- * Replace characters at the end with the suffix if the
- * filename is too long
- */
- if (buf->len + suffix_len > FORMAT_PATCH_NAME_MAX + start_len)
- strbuf_splice(buf,
- start_len + FORMAT_PATCH_NAME_MAX - suffix_len,
- suffix_len, suffix, suffix_len);
- else
- strbuf_addstr(buf, suffix);
- }
-}
-
static FILE *realstdout = NULL;
static const char *output_directory = NULL;
static int outdir_offset;
diff --git a/log-tree.c b/log-tree.c
index 9565c184db681ac1de905d33dbaf175ec61c48fc..aee9995531903808ec6b8a47f1ac9887267391a7 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
return 0;
}
+void get_patch_filename(struct commit *commit, int nr, const char *suffix,
+ struct strbuf *buf)
+{
+ int suffix_len = strlen(suffix) + 1;
+ int start_len = buf->len;
+
+ strbuf_addf(buf, commit ? "%04d-" : "%d", nr);
+ if (commit) {
+ format_commit_message(commit, "%f", buf, DATE_NORMAL);
+ /*
+ * Replace characters at the end with the suffix if the
+ * filename is too long
+ */
+ if (buf->len + suffix_len > FORMAT_PATCH_NAME_MAX + start_len)
+ strbuf_splice(buf,
+ start_len + FORMAT_PATCH_NAME_MAX - suffix_len,
+ suffix_len, suffix, suffix_len);
+ else
+ strbuf_addstr(buf, suffix);
+ }
+}
+
void log_write_email_headers(struct rev_info *opt, const char *name,
const char **subject_p,
const char **extra_headers_p,
diff --git a/log-tree.h b/log-tree.h
index f2a90084ae1874632318c7880e95426eca2682ea..78dc5be76f2c3b278bb321d90f27493eabf9f859 100644 (file)
--- a/log-tree.h
+++ b/log-tree.h
int *need_8bit_cte_p);
void load_ref_decorations(void);
+#define FORMAT_PATCH_NAME_MAX 64
+void get_patch_filename(struct commit *commit, int nr, const char *suffix,
+ struct strbuf *buf);
+
#endif