{"thread":{"id":"10643","subject":"[PATCH 4/5] pretty describe: de-const'ify struct commit arg of format_commit_message()","startedAt":"2007-11-04T11:48:49Z","lastAt":"2007-11-04T11:48:49Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"58255","messageId":"472DB1A1.6020208@lsrfire.ath.cx","threadId":"10643","inReplyTo":null,"subject":"[PATCH 4/5] pretty describe: de-const'ify struct commit arg of format_commit_message()","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2007-11-04T11:48:49Z","receivedAt":"2007-11-04T11:48:49Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"As a preparation to use describe_commit() in format_commit_message(),\nthe const attribute of the struct commit parameter must go, as\ndescribe_commit() needs to change the name related members in order\nto do its work.\n\nThis change requires changes in other places, too -- those that call\nformat_commit_message() with a const struct commit, and the places\ncalling those places.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n---\n archive-tar.c     |    2 +-\n archive-zip.c     |    2 +-\n archive.h         |    4 ++--\n builtin-archive.c |    8 ++++----\n commit.c          |    4 ++--\n commit.h          |    4 ++--\n 6 files changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex e1bced5..792462c 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -16,7 +16,7 @@ static unsigned long offset;\n static time_t archive_time;\n static int tar_umask = 002;\n static int verbose;\n-static const struct commit *commit;\n+static struct commit *commit;\n \n /* writes out the whole block, but only if it is full */\n static void write_if_needed(void)\ndiff --git a/archive-zip.c b/archive-zip.c\nindex 74e30f6..ed0918e 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -12,7 +12,7 @@\n static int verbose;\n static int zip_date;\n static int zip_time;\n-static const struct commit *commit;\n+static struct commit *commit;\n \n static unsigned char *zip_dir;\n static unsigned int zip_dir_size;\ndiff --git a/archive.h b/archive.h\nindex 5791e65..7fb69c4 100644\n--- a/archive.h\n+++ b/archive.h\n@@ -8,7 +8,7 @@ struct archiver_args {\n \tconst char *base;\n \tstruct tree *tree;\n \tconst unsigned char *commit_sha1;\n-\tconst struct commit *commit;\n+\tstruct commit *commit;\n \ttime_t time;\n \tconst char **pathspec;\n \tunsigned int verbose : 1;\n@@ -43,6 +43,6 @@ extern int write_tar_archive(struct archiver_args *);\n extern int write_zip_archive(struct archiver_args *);\n extern void *parse_extra_zip_args(int argc, const char **argv);\n \n-extern void *sha1_file_to_archive(const char *path, const unsigned char *sha1, unsigned int mode, enum object_type *type, unsigned long *size, const struct commit *commit);\n+extern void *sha1_file_to_archive(const char *path, const unsigned char *sha1, unsigned int mode, enum object_type *type, unsigned long *size, struct commit *commit);\n \n #endif\t/* ARCHIVE_H */\ndiff --git a/builtin-archive.c b/builtin-archive.c\nindex 14a1b30..759f265 100644\n--- a/builtin-archive.c\n+++ b/builtin-archive.c\n@@ -79,7 +79,7 @@ static int run_remote_archiver(const char *remote, int argc,\n \treturn !!rv;\n }\n \n-static void format_subst(const struct commit *commit,\n+static void format_subst(struct commit *commit,\n                          const char *src, size_t len,\n                          struct strbuf *buf)\n {\n@@ -115,7 +115,7 @@ static void format_subst(const struct commit *commit,\n static int convert_to_archive(const char *path,\n                               const void *src, size_t len,\n                               struct strbuf *buf,\n-                              const struct commit *commit)\n+                              struct commit *commit)\n {\n \tstatic struct git_attr *attr_export_subst;\n \tstruct git_attr_check check[1];\n@@ -139,7 +139,7 @@ static int convert_to_archive(const char *path,\n void *sha1_file_to_archive(const char *path, const unsigned char *sha1,\n                            unsigned int mode, enum object_type *type,\n                            unsigned long *sizep,\n-                           const struct commit *commit)\n+                           struct commit *commit)\n {\n \tvoid *buffer;\n \n@@ -188,7 +188,7 @@ void parse_treeish_arg(const char **argv, struct archiver_args *ar_args,\n \tconst unsigned char *commit_sha1;\n \ttime_t archive_time;\n \tstruct tree *tree;\n-\tconst struct commit *commit;\n+\tstruct commit *commit;\n \tunsigned char sha1[20];\n \n \tif (get_sha1(name, sha1))\ndiff --git a/commit.c b/commit.c\nindex 24b7268..2e52a2f 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -771,7 +771,7 @@ static void fill_person(struct interp *table, const char *msg, int len)\n \tinterp_set_entry(table, 6, show_date(date, tz, DATE_ISO8601));\n }\n \n-void format_commit_message(const struct commit *commit,\n+void format_commit_message(struct commit *commit,\n                            const void *format, struct strbuf *sb)\n {\n \tstruct interp table[] = {\n@@ -1064,7 +1064,7 @@ static void pp_remainder(enum cmit_fmt fmt,\n \t}\n }\n \n-void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n+void pretty_print_commit(enum cmit_fmt fmt, struct commit *commit,\n \t\t\t\t  struct strbuf *sb, int abbrev,\n \t\t\t\t  const char *subject, const char *after_subject,\n \t\t\t\t  enum date_mode dmode)\ndiff --git a/commit.h b/commit.h\nindex 80e94b9..d74859e 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -65,9 +65,9 @@ enum cmit_fmt {\n };\n \n extern enum cmit_fmt get_commit_format(const char *arg);\n-extern void format_commit_message(const struct commit *commit,\n+extern void format_commit_message(struct commit *commit,\n                                   const void *format, struct strbuf *sb);\n-extern void pretty_print_commit(enum cmit_fmt fmt, const struct commit*,\n+extern void pretty_print_commit(enum cmit_fmt fmt, struct commit*,\n                                 struct strbuf *,\n                                 int abbrev, const char *subject,\n                                 const char *after_subject, enum date_mode);\n-- \n1.5.3.5.529.ge3d6d\n"}]}