From 043a3c6ef29f3f8dc553ee16cddd43ee091fafeb Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 7 Mar 2010 22:57:16 -0800 Subject: [PATCH 001/211] Return instead of calling exit() where equivalent Metrowerks C doesn't recognize the __noreturn__ attribute, so this avoids warnings. --- builtin/merge-ours.c | 2 +- builtin/mktree.c | 2 +- test-match-trees.c | 2 +- test-sha1.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index 684411694f64ca..522e3690295104 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -30,5 +30,5 @@ int cmd_merge_ours(int argc, const char **argv, const char *prefix) */ if (cmd_diff_index(NARGS, diff_index_args, prefix)) exit(2); - exit(0); + return 0; } diff --git a/builtin/mktree.c b/builtin/mktree.c index 098395fda19326..bdd68a3ee01b5a 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -186,5 +186,5 @@ int cmd_mktree(int ac, const char **av, const char *prefix) used=0; /* reset tree entry buffer for re-use in batch mode */ } strbuf_release(&sb); - exit(0); + return 0; } diff --git a/test-match-trees.c b/test-match-trees.c index a3c4688778d9db..33e533978c016b 100644 --- a/test-match-trees.c +++ b/test-match-trees.c @@ -20,5 +20,5 @@ int main(int ac, char **av) shift_tree(one->object.sha1, two->object.sha1, shifted, -1); printf("shifted: %s\n", sha1_to_hex(shifted)); - exit(0); + return 0; } diff --git a/test-sha1.c b/test-sha1.c index 80daba980ecd85..e3b249c4f2d207 100644 --- a/test-sha1.c +++ b/test-sha1.c @@ -43,5 +43,5 @@ int main(int ac, char **av) } git_SHA1_Final(sha1, &ctx); puts(sha1_to_hex(sha1)); - exit(0); + return 0; } From e2f36f75dee870d10a2e6adc4b628a077b2271d7 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 7 Mar 2010 23:06:36 -0800 Subject: [PATCH 002/211] Return unconditionally at the end of cmd_push() The 'else' clause is superfluous since usage_with_options() doesn't return. This avoids a warning. --- builtin/push.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/push.c b/builtin/push.c index f4358b9d230f6d..b2d0e1a69f3a86 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -247,6 +247,5 @@ int cmd_push(int argc, const char **argv, const char *prefix) rc = do_push(repo, flags); if (rc == -1) usage_with_options(push_usage, options); - else - return rc; + return rc; } From 2a567480565b05483f1fabf011fe9d8dd0564233 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Wed, 21 Jul 2010 21:28:35 -0700 Subject: [PATCH 003/211] Cast to (intptr_t) by way of (char*) Required for Metrowerks C 2.4.1. --- builtin/gc.c | 2 +- builtin/grep.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index c304638b784560..2c2ef5b8813c25 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -183,7 +183,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) OPT__QUIET(&quiet), { OPTION_STRING, 0, "prune", &prune_expire, "date", "prune unreferenced objects", - PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire }, + PARSE_OPT_OPTARG, NULL, (intptr_t)(char*)prune_expire }, OPT_BOOLEAN(0, "aggressive", &aggressive, "be more thorough (increased runtime)"), OPT_BOOLEAN(0, "auto", &auto_gc, "enable auto-gc mode"), OPT_END() diff --git a/builtin/grep.c b/builtin/grep.c index 597f76bc42f51e..3a169d16e090e9 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -922,7 +922,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_GROUP(""), { OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager, "pager", "show matching files in the pager", - PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager }, + PARSE_OPT_OPTARG, NULL, (intptr_t)(char*)default_pager }, OPT_BOOLEAN(0, "ext-grep", &external_grep_allowed__ignored, "allow calling of grep(1) (ignored by this build)"), { OPTION_CALLBACK, 0, "help-all", &options, NULL, "show usage", From 2257c0c05bd45dacc6b4275e43813cae3b7423b0 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Wed, 10 Mar 2010 05:24:54 -0800 Subject: [PATCH 004/211] Add a hand-made common-cmds.h, since one isn't generated yet. --- common-cmds.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 common-cmds.h diff --git a/common-cmds.h b/common-cmds.h new file mode 100644 index 00000000000000..540bd39e8aa835 --- /dev/null +++ b/common-cmds.h @@ -0,0 +1,23 @@ +struct cmdname_help +{ + char name[16]; + char help[80]; +}; + +static struct cmdname_help common_cmds[] = +{ + { "add", "" }, + { "branch", "" }, + { "checkout", "" }, + { "clone", "" }, + { "commit", "" }, + { "diff", "" }, + { "fetch", "" }, + { "init", "" }, + { "merge", "" }, + { "remote", "" }, + { "reset", "" }, + { "shortlog", "" }, + { "status", "" } +}; + From 4565566661c9ffded5bcfe269e5f41091035851f Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 7 Mar 2010 22:49:23 -0800 Subject: [PATCH 005/211] Replace empty loop bodies with 'continue' This avoids warnings. --- builtin/mailinfo.c | 2 +- diff-delta.c | 2 +- imap-send.c | 2 +- path.c | 2 +- quote.c | 4 ++-- setup.c | 2 +- xdiff/xdiffi.c | 26 +++++++++++++------------- xdiff/xutils.c | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index 71e6262a87d883..d41e74d1a4d542 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -265,7 +265,7 @@ static void cleanup_space(struct strbuf *sb) for (pos = 0; pos < sb->len; pos++) { if (isspace(sb->buf[pos])) { sb->buf[pos] = ' '; - for (cnt = 0; isspace(sb->buf[pos + cnt + 1]); cnt++); + for (cnt = 0; isspace(sb->buf[pos + cnt + 1]); cnt++) continue; strbuf_remove(sb, pos + 1, cnt); } } diff --git a/diff-delta.c b/diff-delta.c index 93385e12baa0d9..baa451aa16e74e 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -155,7 +155,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) entries = 0xfffffffeU / RABIN_WINDOW; } hsize = entries / 4; - for (i = 4; (1u << i) < hsize && i < 31; i++); + for (i = 4; (1u << i) < hsize && i < 31; i++) continue; hsize = 1 << i; hmask = hsize - 1; diff --git a/imap-send.c b/imap-send.c index 71506a8dd3ed07..e8e221355b62b3 100644 --- a/imap-send.c +++ b/imap-send.c @@ -811,7 +811,7 @@ static int parse_response_code(struct imap_store *ctx, struct imap_cmd_cb *cb, /* RFC2060 says that these messages MUST be displayed * to the user */ - for (; isspace((unsigned char)*p); p++); + for (; isspace((unsigned char)*p); p++) continue; fprintf(stderr, "*** IMAP ALERT *** %s\n", p); } else if (cb && cb->ctx && !strcmp("APPENDUID", arg)) { if (!(arg = next_arg(&s)) || !(ctx->gen.uidvalidity = atoi(arg)) || diff --git a/path.c b/path.c index 8951333cb88a6e..9b6da1cb971bfa 100644 --- a/path.c +++ b/path.c @@ -552,7 +552,7 @@ int longest_ancestor_length(const char *path, const char *prefix_list) return -1; for (colon = ceil = prefix_list; *colon; ceil = colon+1) { - for (colon = ceil; *colon && *colon != PATH_SEP; colon++); + for (colon = ceil; *colon && *colon != PATH_SEP; colon++) continue; len = colon - ceil; if (len == 0 || len > PATH_MAX || !is_absolute_path(ceil)) continue; diff --git a/quote.c b/quote.c index 63d3b018183abc..cde6ca96f27703 100644 --- a/quote.c +++ b/quote.c @@ -169,9 +169,9 @@ static size_t next_quote_pos(const char *s, ssize_t maxlen) { size_t len; if (maxlen < 0) { - for (len = 0; !sq_must_quote(s[len]); len++); + for (len = 0; !sq_must_quote(s[len]); len++) continue; } else { - for (len = 0; len < maxlen && !sq_must_quote(s[len]); len++); + for (len = 0; len < maxlen && !sq_must_quote(s[len]); len++) continue; } return len; } diff --git a/setup.c b/setup.c index dadc66659a4037..5c4a7860df74b0 100644 --- a/setup.c +++ b/setup.c @@ -570,7 +570,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok) if (is_git_directory(".")) return setup_bare_git_dir(cwd, offset, len, nongit_ok); - while (--offset > ceil_offset && cwd[offset] != '/'); + while (--offset > ceil_offset && cwd[offset] != '/') continue; if (offset <= ceil_offset) return setup_nongit(cwd, nongit_ok); if (one_filesystem) { diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c index da67c04357dfe4..4a71dfbc29d6f8 100644 --- a/xdiff/xdiffi.c +++ b/xdiff/xdiffi.c @@ -102,7 +102,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1, i1 = kvdf[d + 1]; prev1 = i1; i2 = i1 - d; - for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++); + for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++) continue; if (i1 - prev1 > xenv->snake_cnt) got_snake = 1; kvdf[d] = i1; @@ -137,7 +137,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1, i1 = kvdb[d + 1] - 1; prev1 = i1; i2 = i1 - d; - for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--); + for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--) continue; if (prev1 - i1 > xenv->snake_cnt) got_snake = 1; kvdb[d] = i1; @@ -273,8 +273,8 @@ int xdl_recs_cmp(diffdata_t *dd1, long off1, long lim1, /* * Shrink the box by walking through each diagonal snake (SW and NE). */ - for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++); - for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--); + for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++) continue; + for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--) continue; /* * If one dimension is empty, then all records on the other one must @@ -417,7 +417,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * a zero at position -1 and N. */ for (; ix < nrec && !rchg[ix]; ix++) - while (rchgo[ixo++]); + while (rchgo[ixo++]) continue; if (ix == nrec) break; @@ -427,8 +427,8 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * indexes (ix and ixo). */ ixs = ix; - for (ix++; rchg[ix]; ix++); - for (; rchgo[ixo]; ixo++); + for (ix++; rchg[ix]; ix++) continue; + for (; rchgo[ixo]; ixo++) continue; do { grpsiz = ix - ixs; @@ -449,8 +449,8 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * the start index accordingly (and so the other-file * end-of-group index). */ - for (; rchg[ixs - 1]; ixs--); - while (rchgo[--ixo]); + for (; rchg[ixs - 1]; ixs--) continue; + while (rchgo[--ixo]) continue; } /* @@ -479,7 +479,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * index in case we are shifting together with a * corresponding group of changes in the other file. */ - for (; rchg[ix]; ix++); + for (; rchg[ix]; ix++) continue; while (rchgo[++ixo]) ixref = ix; } @@ -492,7 +492,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { while (ixref < ix) { rchg[--ixs] = 1; rchg[--ix] = 0; - while (rchgo[--ixo]); + while (rchgo[--ixo]) continue; } } @@ -510,8 +510,8 @@ int xdl_build_script(xdfenv_t *xe, xdchange_t **xscr) { */ for (i1 = xe->xdf1.nrec, i2 = xe->xdf2.nrec; i1 >= 0 || i2 >= 0; i1--, i2--) if (rchg1[i1 - 1] || rchg2[i2 - 1]) { - for (l1 = i1; rchg1[i1 - 1]; i1--); - for (l2 = i2; rchg2[i2 - 1]; i2--); + for (l1 = i1; rchg1[i1 - 1]; i1--) continue; + for (l2 = i2; rchg2[i2 - 1]; i2--) continue; if (!(xch = xdl_add_change(cscr, i1, i2, l1 - i1, l2 - i2))) { xdl_free_script(cscr); diff --git a/xdiff/xutils.c b/xdiff/xutils.c index ab6503460f7603..f270964f516120 100644 --- a/xdiff/xutils.c +++ b/xdiff/xutils.c @@ -313,7 +313,7 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) { unsigned int xdl_hashbits(unsigned int size) { unsigned int val = 1, bits = 0; - for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++); + for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++) continue; return bits ? bits: 1; } @@ -345,7 +345,7 @@ long xdl_atol(char const *str, char const **next) { long val, base; char const *top; - for (top = str; XDL_ISDIGIT(*top); top++); + for (top = str; XDL_ISDIGIT(*top); top++) continue; if (next) *next = top; for (val = 0, base = 1, top--; top >= str; top--, base *= 10) From bd1bfd72b8aa373f3342f41b85fdd99cb34a4884 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sat, 19 Feb 2011 16:59:33 -0800 Subject: [PATCH 006/211] Guard gitmkstemps() with NO_MKSTEMPS --- wrapper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wrapper.c b/wrapper.c index 8d7dd31c4ba543..b6216c50c58ca2 100644 --- a/wrapper.c +++ b/wrapper.c @@ -313,11 +313,15 @@ int git_mkstemp_mode(char *pattern, int mode) return git_mkstemps_mode(pattern, 0, mode); } +#ifdef NO_MKSTEMPS + int gitmkstemps(char *pattern, int suffix_len) { return git_mkstemps_mode(pattern, suffix_len, 0600); } +#endif + int xmkstemp_mode(char *template, int mode) { int fd; From 84ade9f8fa005894f7149e86b06dcb0131ce7c06 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sat, 19 Feb 2011 18:46:23 -0800 Subject: [PATCH 007/211] Allocate bidirectional_transfer_state dynamically The bidirectional_transfer_state struct is over 128K, exceeding both the 68K limit of 32K and our current default stack size of 64K. Allocate the struct with malloc() instead. --- transport-helper.c | 53 +++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/transport-helper.c b/transport-helper.c index 4e4754c32bd53f..1115c6a56e0954 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -1151,26 +1151,39 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s) */ int bidirectional_transfer_loop(int input, int output) { - struct bidirectional_transfer_state state; + int status; + + struct bidirectional_transfer_state* state; + + state = malloc( sizeof (struct bidirectional_transfer_state) ); + + if ( state == NULL ) + { + return -1; + } /* Fill the state fields. */ - state.ptg.src = input; - state.ptg.dest = 1; - state.ptg.src_is_sock = (input == output); - state.ptg.dest_is_sock = 0; - state.ptg.state = SSTATE_TRANSFERING; - state.ptg.bufuse = 0; - state.ptg.src_name = "remote input"; - state.ptg.dest_name = "stdout"; - - state.gtp.src = 0; - state.gtp.dest = output; - state.gtp.src_is_sock = 0; - state.gtp.dest_is_sock = (input == output); - state.gtp.state = SSTATE_TRANSFERING; - state.gtp.bufuse = 0; - state.gtp.src_name = "stdin"; - state.gtp.dest_name = "remote output"; - - return tloop_spawnwait_tasks(&state); + state->ptg.src = input; + state->ptg.dest = 1; + state->ptg.src_is_sock = (input == output); + state->ptg.dest_is_sock = 0; + state->ptg.state = SSTATE_TRANSFERING; + state->ptg.bufuse = 0; + state->ptg.src_name = "remote input"; + state->ptg.dest_name = "stdout"; + + state->gtp.src = 0; + state->gtp.dest = output; + state->gtp.src_is_sock = 0; + state->gtp.dest_is_sock = (input == output); + state->gtp.state = SSTATE_TRANSFERING; + state->gtp.bufuse = 0; + state->gtp.src_name = "stdin"; + state->gtp.dest_name = "remote output"; + + status = tloop_spawnwait_tasks(state); + + free( state ); + + return status; } From 8bac888882e1f1741077526256ce43707ce455b1 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Wed, 8 Apr 2009 01:51:04 -0700 Subject: [PATCH 008/211] Cast compare_info() args to (const foo *const *) Cast compare_info() arguments to (const struct pack_info *const *) for the benefit of Metrowerks C 2.4.1. Otherwise, it reports "illegal implicit conversion from 'const void *' to 'struct pack_info *const *'". --- server-info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-info.c b/server-info.c index 9ec744e9f2da29..f2d64dbbe12bca 100644 --- a/server-info.c +++ b/server-info.c @@ -129,8 +129,8 @@ static int read_pack_info_file(const char *infofile) static int compare_info(const void *a_, const void *b_) { - struct pack_info *const *a = a_; - struct pack_info *const *b = b_; + const struct pack_info *const *a = a_; + const struct pack_info *const *b = b_; if (0 <= (*a)->old_num && 0 <= (*b)->old_num) /* Keep the order in the original */ From 29a8d4c6cbe92540d81722648f697147be2564ad Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Wed, 8 Apr 2009 23:03:24 -0700 Subject: [PATCH 009/211] Undefine conflicting PREFIX macro exec_cmd.c expects PREFIX to be defined by including cache.h, whereas sideband.c expects it to be undefined. Although sideband.c doesn't explicitly include cache.h, Lamp uses cache.h as a precompiled header, automatically included by all master source files. Undefine the PREFIX macro here to avoid the conflict. --- sideband.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sideband.c b/sideband.c index d5ffa1c8919a6d..f137f45097b6c1 100644 --- a/sideband.c +++ b/sideband.c @@ -12,6 +12,7 @@ * the remote died unexpectedly. A flush() concludes the stream. */ +#undef PREFIX #define PREFIX "remote:" #define ANSI_SUFFIX "\033[K" From 1c2cee35c3f1530da078036e6d11c8cfd1e918e9 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Tue, 21 Apr 2009 08:43:47 -0700 Subject: [PATCH 010/211] Allow a platform to override LARGE_PACKET_MAX Lamp needs this due to small stack sizes. --- sideband.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sideband.h b/sideband.h index d72db35d1e0dc1..1f61362083d5d3 100644 --- a/sideband.h +++ b/sideband.h @@ -5,7 +5,9 @@ #define SIDEBAND_REMOTE_ERROR -1 #define DEFAULT_PACKET_MAX 1000 +#ifndef LARGE_PACKET_MAX #define LARGE_PACKET_MAX 65520 +#endif int recv_sideband(const char *me, int in_stream, int out); ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max); From 35bd9b6480152422976cd1b664cd7f13cbbe0655 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Wed, 13 Jan 2010 17:11:53 -0800 Subject: [PATCH 011/211] Add A-line config files for git on Lamp Link with dlmalloc so malloc() can use temporary memory. Link with plproxy's poll_compat for poll() over select(). This is needed for git daemon. --- A-line.confd/Source.list | 247 +++++++++++++++++++++++++++++++++++++++ A-line.confd/git.conf | 37 ++++++ 2 files changed, 284 insertions(+) create mode 100644 A-line.confd/Source.list create mode 100644 A-line.confd/git.conf diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list new file mode 100644 index 00000000000000..1dbbeb828e60a8 --- /dev/null +++ b/A-line.confd/Source.list @@ -0,0 +1,247 @@ +abspath.c +advice.c +alias.c +alloc.c +archive-tar.c +archive-zip.c +archive.c +attr.c +base85.c +bisect.c +blob.c +block-sha1/sha1.c +branch.c +builtin/add.c +builtin/annotate.c +builtin/apply.c +builtin/archive.c +builtin/bisect--helper.c +builtin/blame.c +builtin/branch.c +builtin/bundle.c +builtin/cat-file.c +builtin/check-attr.c +builtin/check-ref-format.c +builtin/checkout-index.c +builtin/checkout.c +builtin/clean.c +builtin/clone.c +builtin/commit-tree.c +builtin/commit.c +builtin/config.c +builtin/count-objects.c +builtin/describe.c +builtin/diff-files.c +builtin/diff-index.c +builtin/diff-tree.c +builtin/diff.c +builtin/fast-export.c +builtin/fetch-pack.c +builtin/fetch.c +builtin/fmt-merge-msg.c +builtin/for-each-ref.c +builtin/fsck.c +builtin/gc.c +builtin/grep.c +builtin/hash-object.c +builtin/help.c +builtin/index-pack.c +builtin/init-db.c +builtin/log.c +builtin/ls-files.c +builtin/ls-remote.c +builtin/ls-tree.c +builtin/mailinfo.c +builtin/mailsplit.c +builtin/merge-base.c +builtin/merge-file.c +builtin/merge-index.c +builtin/merge-ours.c +builtin/merge-recursive.c +builtin/merge-tree.c +builtin/merge.c +builtin/mktag.c +builtin/mktree.c +builtin/mv.c +builtin/name-rev.c +builtin/notes.c +builtin/pack-objects.c +builtin/pack-redundant.c +builtin/pack-refs.c +builtin/patch-id.c +builtin/prune-packed.c +builtin/prune.c +builtin/push.c +builtin/read-tree.c +builtin/receive-pack.c +builtin/reflog.c +builtin/remote.c +builtin/remote-ext.c +builtin/remote-fd.c +builtin/replace.c +builtin/rerere.c +builtin/reset.c +builtin/rev-list.c +builtin/rev-parse.c +builtin/revert.c +builtin/rm.c +builtin/send-pack.c +builtin/shortlog.c +builtin/show-branch.c +builtin/show-ref.c +builtin/stripspace.c +builtin/symbolic-ref.c +builtin/tag.c +builtin/tar-tree.c +builtin/unpack-file.c +builtin/unpack-objects.c +builtin/update-index.c +builtin/update-ref.c +builtin/update-server-info.c +builtin/upload-archive.c +builtin/var.c +builtin/verify-pack.c +builtin/verify-tag.c +builtin/write-tree.c +bundle.c +cache-tree.c +check-racy.c +color.c +combine-diff.c +commit.c +compat/basename.c +compat/fnmatch/fnmatch.c +compat/inet_ntop.c +compat/inet_pton.c +compat/memmem.c +compat/strcasestr.c +config.c +connect.c +convert.c +copy.c +csum-file.c +ctype.c +daemon.c +date.c +decorate.c +diff-delta.c +diff-lib.c +diff-no-index.c +diff.c +diffcore-break.c +diffcore-delta.c +diffcore-order.c +diffcore-pickaxe.c +diffcore-rename.c +dir.c +editor.c +entry.c +environment.c +exec_cmd.c +fast-import.c +fsck.c +git.c +graph.c +grep.c +hash.c +help.c +hex.c +http-backend.c +#http-fetch.c +#http-push.c +#http-walker.c +#http.c +ident.c +imap-send.c +levenshtein.c +list-objects.c +ll-merge.c +lockfile.c +log-tree.c +mailmap.c +match-trees.c +merge-file.c +merge-recursive.c +name-hash.c +notes.c +notes-cache.c +notes-merge.c +object.c +pack-check.c +pack-refs.c +pack-revindex.c +pack-write.c +pager.c +parse-options.c +patch-delta.c +patch-ids.c +path.c +pkt-line.c +preload-index.c +pretty.c +progress.c +quote.c +reachable.c +read-cache.c +reflog-walk.c +refs.c +remote.c +replace_object.c +rerere.c +resolve-undo.c +revision.c +run-command.c +server-info.c +setup.c +sha1-lookup.c +sha1_file.c +sha1_name.c +shallow.c +shell.c +show-index.c +sideband.c +sigchain.c +strbuf.c +string-list.c +submodule.c +symlinks.c +tag.c +test-chmtime.c +test-ctype.c +test-date.c +test-delta.c +test-dump-cache-tree.c +test-genrandom.c +test-index-version.c +test-match-trees.c +#test-parse-options.c +test-path-utils.c +test-run-command.c +test-sha1.c +test-sigchain.c +thread-utils.c +trace.c +transport.c +transport-helper.c +tree-diff.c +tree-walk.c +tree.c +unpack-trees.c +upload-pack.c +url.c +usage.c +userdiff.c +utf8.c +walker.c +wrapper.c +write_or_die.c +ws.c +wt-status.c +xdiff/xdiffi.c +xdiff/xemit.c +xdiff/xmerge.c +xdiff/xpatience.c +xdiff/xprepare.c +xdiff/xutils.c +xdiff-interface.c +zlib.c diff --git a/A-line.confd/git.conf b/A-line.confd/git.conf new file mode 100644 index 00000000000000..d690ac9564a955 --- /dev/null +++ b/A-line.confd/git.conf @@ -0,0 +1,37 @@ +# git +# --- + +product toolkit + +use zlib +use POSIX +use __dlmalloc +use poll_compat + +precompile cache.h + +tools check-racy.c +tools daemon.c +tools fast-import.c +tools git.c +tools http-backend.c +tools http-fetch.c +tools http-push.c +tools imap-send.c +tools shell.c +tools show-index.c +tools test-chmtime.c +tools test-ctype.c +tools test-date.c +tools test-delta.c +tools test-dump-cache-tree.c +tools test-genrandom.c +tools test-index-version.c +tools test-match-trees.c +tools test-parse-options.c +tools test-path-utils.c +tools test-run-command.c +tools test-sha1.c +tools test-sigchain.c +tools upload-pack.c + From 8c8975cc0bf74b15a3d6a18f804e76a1889a125d Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sat, 29 May 2010 23:24:59 -0700 Subject: [PATCH 012/211] revert: Use raw message if no reencoding occurs When NO_ICONV is defined, reencode_string() is a no-op which evaluates to NULL. In this case, revert/cherry-pick's message buffer pointer remains NULL, which is detected by a subsequent check and reported as "Could not read commit message of " (though not before the NULL pointer is dereferenced). If reencode_string() returns NULL for any reason (whether it's a no-op or not), set the message pointer to the raw message buffer. Signed-off-by: Joshua Juran --- builtin/revert.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builtin/revert.c b/builtin/revert.c index bb6e9e83b756b4..8ccf2984cb37e6 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -121,6 +121,8 @@ static int get_message(const char *raw_message, struct commit_message *out) git_commit_encoding, encoding); if (out->reencoded_message) out->message = out->reencoded_message; + else + out->message = raw_message; abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV); abbrev_len = strlen(abbrev); From a9e688fa071c1725f069252cf25a1a56665387d5 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Tue, 21 Apr 2009 08:48:17 -0700 Subject: [PATCH 013/211] Use vfork() and reexec() instead of fork() on Lamp --- run-command.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/run-command.c b/run-command.c index f91e446c86be8e..35bbfdc302a668 100644 --- a/run-command.c +++ b/run-command.c @@ -2,6 +2,12 @@ #include "run-command.h" #include "exec_cmd.h" +#ifdef __LAMP__ +#define GIT_FORK() vfork() +#else +#define GIT_FORK() fork() +#endif + static inline void close_pair(int fd[2]) { close(fd[0]); @@ -202,7 +208,7 @@ int start_command(struct child_process *cmd) if (pipe(notify_pipe)) notify_pipe[0] = notify_pipe[1] = -1; - cmd->pid = fork(); + cmd->pid = GIT_FORK(); if (!cmd->pid) { /* * Redirect the channel to write syscall error messages to @@ -481,6 +487,15 @@ static NORETURN void die_async(const char *err, va_list params) } #endif +static void run_async_proc(struct async *async, int proc_in, int proc_out) +{ +#ifdef __LAMP__ + (void) reexec(async->proc, proc_in, proc_out, async->data); +#else + exit(!!async->proc(proc_in, proc_out, async->data)); +#endif +} + int start_async(struct async *async) { int need_in, need_out; @@ -527,7 +542,7 @@ int start_async(struct async *async) /* Flush stdio before fork() to avoid cloning buffers */ fflush(NULL); - async->pid = fork(); + async->pid = GIT_FORK(); if (async->pid < 0) { error("fork (async) failed: %s", strerror(errno)); goto error; @@ -537,7 +552,7 @@ int start_async(struct async *async) close(fdin[1]); if (need_out) close(fdout[0]); - exit(!!async->proc(proc_in, proc_out, async->data)); + run_async_proc(async, proc_in, proc_out); } if (need_in) From 92b4728c5f6ad3ec93e99c08dde6eae958837a4b Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Mon, 21 Feb 2011 15:23:23 -0800 Subject: [PATCH 014/211] Guard functions with NO_PTHREADS --- thread-utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thread-utils.c b/thread-utils.c index 589f838f82b568..27acdbd4978e83 100644 --- a/thread-utils.c +++ b/thread-utils.c @@ -18,6 +18,8 @@ # endif #endif +#ifndef NO_PTHREADS + int online_cpus(void) { #ifdef _SC_NPROCESSORS_ONLN @@ -59,3 +61,5 @@ int init_recursive_mutex(pthread_mutex_t *m) } return ret; } + +#endif From 92338c12c07089eacc6f5c6504a949a25e7fa7d7 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 7 Mar 2010 22:53:44 -0800 Subject: [PATCH 015/211] Silence warnings of uninitialized variable use --- builtin/cat-file.c | 2 +- builtin/rev-list.c | 2 +- fast-import.c | 6 +++--- merge-recursive.c | 2 +- run-command.c | 2 +- submodule.c | 2 +- wt-status.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 94632dbdb400f9..31cb1722a877b0 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -168,7 +168,7 @@ static int batch_one_object(const char *obj_name, int print_contents) unsigned char sha1[20]; enum object_type type = 0; unsigned long size; - void *contents = contents; + void *contents; if (!obj_name) return 1; diff --git a/builtin/rev-list.c b/builtin/rev-list.c index ba27d39f977f28..96d10b01a61424 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -397,7 +397,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) mark_edges_uninteresting(revs.commits, &revs, show_edge); if (bisect_list) { - int reaches = reaches, all = all; + int reaches, all; revs.commits = find_bisection(revs.commits, &reaches, &all, bisect_find_all); diff --git a/fast-import.c b/fast-import.c index b3ba7789249089..bc6c2e32dc1cdc 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2172,7 +2172,7 @@ static void file_change_m(struct branch *b) const char *p = command_buf.buf + 2; static struct strbuf uq = STRBUF_INIT; const char *endp; - struct object_entry *oe = oe; + struct object_entry *oe; unsigned char sha1[20]; uint16_t mode, inline_data = 0; @@ -2341,7 +2341,7 @@ static void note_change_n(struct branch *b, unsigned char old_fanout) { const char *p = command_buf.buf + 2; static struct strbuf uq = STRBUF_INIT; - struct object_entry *oe = oe; + struct object_entry *oe; struct branch *s; unsigned char sha1[20], commit_sha1[20]; char path[60]; @@ -2501,7 +2501,7 @@ static int parse_from(struct branch *b) static struct hash_list *parse_merge(unsigned int *count) { - struct hash_list *list = NULL, *n, *e = e; + struct hash_list *list = NULL, *n, *e; const char *from; struct branch *s; diff --git a/merge-recursive.c b/merge-recursive.c index 42d52cb5bc17e9..db9cd88e06c56b 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1592,7 +1592,7 @@ int merge_recursive(struct merge_options *o, { struct commit_list *iter; struct commit *merged_common_ancestors; - struct tree *mrtree = mrtree; + struct tree *mrtree; int clean; if (show(o, 4)) { diff --git a/run-command.c b/run-command.c index f91e446c86be8e..f4fb936a438286 100644 --- a/run-command.c +++ b/run-command.c @@ -139,7 +139,7 @@ int start_command(struct child_process *cmd) { int need_in, need_out, need_err; int fdin[2], fdout[2], fderr[2]; - int failed_errno = failed_errno; + int failed_errno; /* * In case of errors we must keep the promise to close FDs diff --git a/submodule.c b/submodule.c index e9f2b19e1c867b..7d027903fbe58d 100644 --- a/submodule.c +++ b/submodule.c @@ -212,7 +212,7 @@ void show_submodule_summary(FILE *f, const char *path, const char *del, const char *add, const char *reset) { struct rev_info rev; - struct commit *left = left, *right = right; + struct commit *left, *right; const char *message = NULL; struct strbuf sb = STRBUF_INIT; int fast_forward = 0, fast_backward = 0; diff --git a/wt-status.c b/wt-status.c index 123582b6cbdff9..754b7f66c8ddbf 100644 --- a/wt-status.c +++ b/wt-status.c @@ -153,7 +153,7 @@ static void wt_status_print_change_data(struct wt_status *s, { struct wt_status_change_data *d = it->util; const char *c = color(change_type, s); - int status = status; + int status; char *one_name; char *two_name; const char *one, *two; From 6c1ec266b9ada0df4ee329cfe4ac12793b9580e8 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 15:14:01 -0700 Subject: [PATCH 016/211] Guard against use of getrlimit() Don't forget to include once you implement getrlimit(). --- sha1_file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index e194f6a12862a4..c6475cff320fad 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -714,6 +714,7 @@ static int open_packed_git_1(struct packed_git *p) return error("packfile %s index unavailable", p->pack_name); if (!pack_max_fds) { + #ifndef __RELIX__ struct rlimit lim; unsigned int max_fds; @@ -726,6 +727,7 @@ static int open_packed_git_1(struct packed_git *p) if (25 < max_fds) pack_max_fds = max_fds - 25; else + #endif pack_max_fds = 1; } From 16a70bbd76875bdb32c031dca0ae5233b912765a Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 29 Nov 2009 04:14:12 -0800 Subject: [PATCH 017/211] Use C++ to initialize aggregates to dynamic values Metrowerks C won't initialize an aggregate with values undetermined at compile time, but Metrowerks C++ will, so use it instead. In some cases 'new' and 'delete' have to be defined to something else. --- archive.c | 17 +++++++++ builtin/apply.c | 8 ++++ builtin/archive.c | 9 +++++ builtin/bisect--helper.c | 9 +++++ builtin/branch.c | 9 +++++ builtin/cat-file.c | 8 ++++ builtin/checkout-index.c | 9 +++++ builtin/checkout.c | 9 +++++ builtin/clean.c | 9 +++++ builtin/count-objects.c | 9 +++++ builtin/describe.c | 9 +++++ builtin/fast-export.c | 9 +++++ builtin/fetch.c | 16 ++++++++ builtin/fmt-merge-msg.c | 9 +++++ builtin/for-each-ref.c | 8 ++++ builtin/gc.c | 8 ++++ builtin/grep.c | 9 +++++ builtin/init-db.c | 9 +++++ builtin/log.c | 16 ++++++++ builtin/ls-files.c | 9 +++++ builtin/ls-tree.c | 8 ++++ builtin/merge-base.c | 8 ++++ builtin/merge-file.c | 9 +++++ builtin/merge-index.c | 8 ++++ builtin/mktree.c | 8 ++++ builtin/mv.c | 10 +++++ builtin/name-rev.c | 9 +++++ builtin/notes.c | 71 ++++++++++++++++++++++++++++++++++++ builtin/pack-refs.c | 10 +++++ builtin/prune-packed.c | 8 ++++ builtin/push.c | 8 ++++ builtin/read-tree.c | 9 +++++ builtin/remote.c | 68 ++++++++++++++++++++++++++++++++++ builtin/replace.c | 9 +++++ builtin/rerere.c | 8 ++++ builtin/reset.c | 9 +++++ builtin/revert.c | 9 +++++ builtin/show-branch.c | 9 +++++ builtin/symbolic-ref.c | 9 +++++ builtin/tag.c | 9 +++++ builtin/update-index.c | 8 ++++ builtin/update-ref.c | 9 +++++ builtin/update-server-info.c | 9 +++++ builtin/verify-pack.c | 9 +++++ builtin/verify-tag.c | 9 +++++ builtin/write-tree.c | 9 +++++ daemon.c | 8 ++++ editor.c | 9 +++++ imap-send.c | 9 +++++ submodule.c | 8 ++++ 50 files changed, 581 insertions(+) diff --git a/archive.c b/archive.c index 1944ed4e4dc36a..8513985639b497 100644 --- a/archive.c +++ b/archive.c @@ -221,8 +221,16 @@ static int reject_entry(const unsigned char *sha1, const char *base, static int path_exists(struct tree *tree, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *pathspec[] = { path, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (read_tree_recursive(tree, "", 0, 0, pathspec, reject_entry, NULL)) return 1; return 0; @@ -305,6 +313,11 @@ static int parse_archive_args(int argc, const char **argv, int i; int list = 0; int worktree_attributes = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_GROUP(""), OPT_STRING(0, "format", &format, "fmt", "archive format"), @@ -336,6 +349,10 @@ static int parse_archive_args(int argc, const char **argv, OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, opts, archive_usage, 0); if (remote) diff --git a/builtin/apply.c b/builtin/apply.c index 36e150768ba88e..65b2de12f5de19 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3835,6 +3835,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) const char *whitespace_option = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_apply_options[] = { { OPTION_CALLBACK, 0, "exclude", NULL, "path", "don't apply changes matching the given path", @@ -3902,6 +3906,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + prefix = prefix_; prefix_length = prefix ? strlen(prefix) : 0; git_config(git_apply_config, NULL); diff --git a/builtin/archive.c b/builtin/archive.c index b14eaba1594bad..9ae7a06373d61e 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -85,6 +85,11 @@ int cmd_archive(int argc, const char **argv, const char *prefix) const char *output = NULL; const char *remote = NULL; const char *format_option = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option local_opts[] = { OPT_STRING('o', "output", &output, "file", "write the archive to this file"), @@ -95,6 +100,10 @@ int cmd_archive(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, local_opts, NULL, PARSE_OPT_KEEP_ALL); diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 5b226399e1c30b..4a25914f2232c2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -11,12 +11,21 @@ static const char * const git_bisect_helper_usage[] = { int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { int next_all = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "next-all", &next_all, "perform 'git bisect next'"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_bisect_helper_usage, 0); diff --git a/builtin/branch.c b/builtin/branch.c index 9cca1b9afc20ca..c303cfdf56c4dc 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -614,6 +614,11 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int int cmd_branch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int delete = 0, rename = 0, force_create = 0; int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0; int reflog = 0; @@ -670,6 +675,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_branch_usage, options); diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 94632dbdb400f9..cd88ed813af5b4 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -241,6 +241,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) int opt = 0, batch = 0; const char *exp_type = NULL, *obj_name = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT_GROUP(" can be one of: blob, tree, commit, tag"), OPT_SET_INT('t', NULL, &opt, "show object type", 't'), @@ -259,6 +263,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_cat_file_config, NULL); if (argc != 3 && argc != 2) diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index f1fec24745a854..222acf8f45eb09 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -214,6 +214,11 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) int read_from_stdin = 0; int prefix_length; int force = 0, quiet = 0, not_new = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_checkout_index_options[] = { OPT_BOOLEAN('a', "all", &all, "checks out all files in the index"), @@ -241,6 +246,10 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_checkout_index_usage, builtin_checkout_index_options); diff --git a/builtin/checkout.c b/builtin/checkout.c index eece5d6ac0f48a..e0741a7127fc33 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -903,6 +903,11 @@ static int parse_branchname_arg(int argc, const char **argv, int cmd_checkout(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define new new_ +#endif + struct checkout_opts opts; unsigned char rev[20]; struct branch_info new; @@ -936,6 +941,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); memset(&new, 0, sizeof(new)); diff --git a/builtin/clean.c b/builtin/clean.c index 75697f711116e4..319fd07c68c616 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -47,6 +47,11 @@ int cmd_clean(int argc, const char **argv, const char *prefix) struct string_list exclude_list = STRING_LIST_INIT_NODUP; const char *qname; char *seen = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__QUIET(&quiet, "do not print names of files removed"), OPT__DRY_RUN(&show_only, "dry run"), @@ -61,6 +66,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_clean_config, NULL); if (force < 0) force = 0; diff --git a/builtin/count-objects.c b/builtin/count-objects.c index c37cb98c31ddfa..3c8f4385ea846c 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -78,11 +78,20 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) char *path = xmalloc(len + 50); unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0; off_t loose_size = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT__VERBOSE(&verbose, "be verbose"), OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0); /* we do not take arguments other than flags for now */ if (argc) diff --git a/builtin/describe.c b/builtin/describe.c index 66fc291c8a81de..31ed5a60c84966 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -399,6 +399,11 @@ static void describe(const char *arg, int last_one) int cmd_describe(int argc, const char **argv, const char *prefix) { int contains = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "contains", &contains, "find the tag that comes after the commit"), OPT_BOOLEAN(0, "debug", &debug, "debug search strategy on stderr"), @@ -420,6 +425,10 @@ int cmd_describe(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, describe_usage, 0); if (abbrev < 0) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index daf19451ba7df5..d30b6c9e322396 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -610,6 +610,11 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) struct string_list extra_refs = STRING_LIST_INIT_NODUP; struct commit *commit; char *export_filename = NULL, *import_filename = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_INTEGER(0, "progress", &progress, "show progress after objects"), @@ -633,6 +638,10 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 1) usage_with_options (fast_export_usage, options); diff --git a/builtin/fetch.c b/builtin/fetch.c index f9c41da475289b..50c19442b2f517 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -586,11 +586,19 @@ static void find_non_local_tags(struct transport *transport, struct ref **head, struct ref ***tail) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct string_list existing_refs = STRING_LIST_INIT_NODUP; struct string_list remote_refs = STRING_LIST_INIT_NODUP; const struct ref *ref; struct string_list_item *item = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + for_each_ref(add_existing, &existing_refs); for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) { if (prefixcmp(ref->name, "refs/tags")) @@ -802,10 +810,18 @@ static int get_remote_group(const char *key, const char *value, void *priv) static int add_remote_or_group(const char *name, struct string_list *list) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int prev_nr = list->nr; struct remote_group_data g; g.name = name; g.list = list; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(get_remote_group, &g); if (list->nr == prev_nr) { struct remote *remote; diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 75816329d6153c..316f2b2feb15c4 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -318,6 +318,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) { const char *inpath = NULL; const char *message = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_INTEGER, 0, "log", &shortlog_len, "n", "populate log with at most entries from shortlog", @@ -332,6 +337,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + FILE *in = stdin; struct strbuf input = STRBUF_INIT, output = STRBUF_INIT; int ret; diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 89e75c6894e6fd..7d290a50193977 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -947,6 +947,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) struct refinfo **refs; struct grab_ref_cbdata cbdata; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT('s', "shell", "e_style, "quote placeholders suitably for shells", QUOTE_SHELL), @@ -965,6 +969,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0); if (maxcount < 0) { error("invalid --count argument: `%d'", maxcount); diff --git a/builtin/gc.c b/builtin/gc.c index ff5f73ba87b23f..de26c7da37e1ed 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -179,6 +179,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) int quiet = 0; char buf[80]; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_gc_options[] = { OPT__QUIET(&quiet, "suppress progress reporting"), { OPTION_STRING, 0, "prune", &prune_expire, "date", @@ -189,6 +193,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_gc_usage, builtin_gc_options); diff --git a/builtin/grep.c b/builtin/grep.c index 10a1f65310f28f..be325bb0c5abc3 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -753,6 +753,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix) int i; int dummy; int use_index = 1; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "cached", &cached, "search in index instead of in the work tree"), @@ -843,6 +848,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* * 'git grep -h', unlike 'git grep -h ', is a request * to show usage information and exit. diff --git a/builtin/init-db.c b/builtin/init-db.c index b7370d9bb8f235..55669682c6eae2 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -480,6 +480,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) const char *work_tree; const char *template_dir = NULL; unsigned int flags = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option init_db_options[] = { OPT_STRING(0, "template", &template_dir, "template-directory", "directory from which templates will be used"), @@ -495,6 +500,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0); if (real_git_dir && !is_absolute_path(real_git_dir)) diff --git a/builtin/log.c b/builtin/log.c index 9db43edb063bbc..103411db796657 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -977,6 +977,10 @@ static int cc_callback(const struct option *opt, const char *arg, int unset) int cmd_format_patch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct commit *commit; struct commit **list = NULL; struct rev_info rev; @@ -1053,6 +1057,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + extra_hdr.strdup_strings = 1; extra_to.strdup_strings = 1; extra_cc.strdup_strings = 1; @@ -1387,12 +1395,20 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) const char *limit = NULL; int verbose = 0, abbrev = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__ABBREV(&abbrev), OPT__VERBOSE(&verbose, "be verbose"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, cherry_usage, 0); switch (argc) { diff --git a/builtin/ls-files.c b/builtin/ls-files.c index fb2d5f4b1fb0ce..d96be787f9c6be 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -474,6 +474,11 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) int require_work_tree = 0, show_tag = 0; const char *max_prefix; struct dir_struct dir; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_ls_files_options[] = { { OPTION_CALLBACK, 'z', NULL, NULL, NULL, "paths are separated with NUL character", @@ -530,6 +535,10 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(ls_files_usage, builtin_ls_files_options); diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index f73e6bd9626a0e..eca0d5e71a1c52 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -118,6 +118,10 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen, int cmd_ls_tree(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + unsigned char sha1[20]; struct tree *tree; int full_tree = 0; @@ -145,6 +149,10 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); ls_tree_prefix = prefix; if (prefix && *prefix) diff --git a/builtin/merge-base.c b/builtin/merge-base.c index 96dd160731ce29..fda5bcbf35b09c 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -77,6 +77,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) int octopus = 0; int reduce = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('a', "all", &show_all, "output all common ancestors"), OPT_BOOLEAN(0, "octopus", &octopus, "find ancestors for a single n-way merge"), @@ -84,6 +88,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0); if (!octopus && !reduce && argc < 2) diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 237abd3c0b27b6..c3863c122286aa 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -29,6 +29,11 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) int ret = 0, i = 0, to_stdout = 0; int quiet = 0; int prefixlen = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('p', "stdout", &to_stdout, "send results to standard output"), OPT_SET_INT(0, "diff3", &xmp.style, "use a diff3 based merge", XDL_MERGE_DIFF3), @@ -46,6 +51,10 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + xmp.level = XDL_MERGE_ZEALOUS_ALNUM; xmp.style = 0; xmp.favor = 0; diff --git a/builtin/merge-index.c b/builtin/merge-index.c index 23388325879c5a..99753c51bb7026 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -7,11 +7,19 @@ static int err; static int merge_entry(int pos, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int found; const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL }; char hexbuf[4][60]; char ownbuf[4][60]; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (pos >= active_nr) die("git merge-index: %s not in the cache", path); found = 0; diff --git a/builtin/mktree.c b/builtin/mktree.c index 098395fda19326..a6dac9692a4623 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -148,6 +148,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) int is_batch_mode = 0; int got_eof = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option option[] = { OPT_SET_INT('z', NULL, &line_termination, "input is NUL terminated", '\0'), OPT_SET_INT( 0 , "missing", &allow_missing, "allow missing objects", 1), @@ -155,6 +159,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + ac = parse_options(ac, av, prefix, option, mktree_usage, 0); while (!got_eof) { diff --git a/builtin/mv.c b/builtin/mv.c index 40f33ca4d0e6d0..321cbd1675236b 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -54,12 +54,22 @@ int cmd_mv(int argc, const char **argv, const char *prefix) { int i, newfd; int verbose = 0, show_only = 0, force = 0, ignore_errors = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_mv_options[] = { OPT__DRY_RUN(&show_only, "dry run"), OPT__FORCE(&force, "force move/rename even if target exists"), OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + const char **source, **destination, **dest_path; enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes; struct stat st; diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 31f5c1c971381a..0c40b495275088 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -223,6 +223,11 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) struct object_array revs = OBJECT_ARRAY_INIT; int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0; struct name_ref_data data = { 0, 0, NULL }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BOOLEAN(0, "name-only", &data.name_only, "print only names (no SHA-1)"), OPT_BOOLEAN(0, "tags", &data.tags_only, "only use tags to name the commits"), @@ -237,6 +242,10 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0); if (!!all + !!transform_stdin + !!argc > 1) { diff --git a/builtin/notes.c b/builtin/notes.c index d6dcfcb0149ab6..cef4300ae6ae5e 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -132,12 +132,20 @@ static void write_note_data(int fd, const unsigned char *sha1) static void write_commented_object(int fd, const unsigned char *object) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[5] = {"show", "--stat", "--no-notes", sha1_to_hex(object), NULL}; struct child_process show; struct strbuf buf = STRBUF_INIT; FILE *show_out; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* Invoke "git show --stat --no-notes $object" */ memset(&show, 0, sizeof(show)); show.argv = show_args; @@ -538,6 +546,11 @@ static int add(int argc, const char **argv, const char *prefix) char logmsg[100]; const unsigned char *note; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, "msg", "note contents as a string", PARSE_OPT_NONEG, @@ -555,6 +568,10 @@ static int add(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_add_usage, 0); @@ -606,6 +623,11 @@ static int copy(int argc, const char **argv, const char *prefix) unsigned char object[20], from_obj[20]; struct notes_tree *t; const char *rewrite_cmd = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, "replace existing notes"), OPT_BOOLEAN(0, "stdin", &from_stdin, "read objects from stdin"), @@ -615,6 +637,10 @@ static int copy(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_copy_usage, 0); @@ -683,6 +709,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) char logmsg[100]; const char * const *usage; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, "msg", "note contents as a string", PARSE_OPT_NONEG, @@ -698,6 +729,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) parse_reuse_arg}, OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + int edit = !strcmp(argv[0], "edit"); usage = edit ? git_notes_edit_usage : git_notes_append_usage; @@ -768,7 +804,17 @@ static int show(int argc, const char **argv, const char *prefix) retval = error(_("No note found for object %s."), sha1_to_hex(object)); else { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[3] = {"show", sha1_to_hex(note), NULL}; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + retval = execv_git_cmd(show_args); } free_notes(t); @@ -844,6 +890,10 @@ static int merge_commit(struct notes_merge_options *o) static int merge(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct strbuf remote_ref = STRBUF_INIT, msg = STRBUF_INIT; unsigned char result_sha1[20]; struct notes_tree *t; @@ -869,6 +919,10 @@ static int merge(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_merge_usage, 0); @@ -989,6 +1043,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) static int prune(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct notes_tree *t; int show_only = 0, verbose = 0; struct option options[] = { @@ -997,6 +1055,10 @@ static int prune(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_prune_usage, 0); @@ -1034,12 +1096,21 @@ int cmd_notes(int argc, const char **argv, const char *prefix) { int result; const char *override_notes_ref = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_STRING(0, "ref", &override_notes_ref, "notes_ref", "use notes from "), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_notes_usage, PARSE_OPT_STOP_AT_NON_OPTION); diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index 39a9d89fbdf322..ca9e3b7ab01a63 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -10,11 +10,21 @@ static char const * const pack_refs_usage[] = { int cmd_pack_refs(int argc, const char **argv, const char *prefix) { unsigned int flags = PACK_REFS_PRUNE; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT(0, "all", &flags, "pack everything", PACK_REFS_ALL), OPT_BIT(0, "prune", &flags, "prune loose refs (default)", PACK_REFS_PRUNE), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0)) usage_with_options(pack_refs_usage, opts); return pack_refs(flags); diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index f9463deec2f5a5..bc506d5b306e7e 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -71,6 +71,10 @@ void prune_packed_objects(int opts) int cmd_prune_packed(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int opts = isatty(2) ? VERBOSE : 0; const struct option prune_packed_options[] = { OPT_BIT('n', "dry-run", &opts, "dry run", DRY_RUN), @@ -78,6 +82,10 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, prune_packed_options, prune_packed_usage, 0); diff --git a/builtin/push.c b/builtin/push.c index 9cebf9ea234d96..09cc19e4b9b92f 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -221,6 +221,10 @@ static int do_push(const char *repo, int flags) int cmd_push(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int flags = 0; int tags = 0; int rc; @@ -245,6 +249,10 @@ int cmd_push(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + packet_trace_identity("push"); git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, push_usage, 0); diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 93c92814cf2885..0e07b97769469d 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -103,6 +103,11 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) struct tree_desc t[MAX_UNPACK_TREES]; struct unpack_trees_options opts; int prefix_set = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option read_tree_options[] = { { OPTION_CALLBACK, 0, "index-output", NULL, "file", "write resulting index to ", @@ -137,6 +142,10 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); opts.head_idx = -1; opts.src_index = &the_index; diff --git a/builtin/remote.c b/builtin/remote.c index 8424152269e309..9ccb790ae3e5e1 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -100,11 +100,20 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not) static int fetch_remote(const char *name) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { "fetch", name, NULL, NULL }; if (verbose) { argv[1] = "-v"; argv[2] = name; } + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + printf("Updating %s\n", name); if (run_command_v_opt(argv, RUN_GIT_CMD)) return error("Could not fetch %s", name); @@ -169,6 +178,10 @@ static int add(int argc, const char **argv) const char *name, *url; int i; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('f', "fetch", &fetch, "fetch the remote branches"), OPT_SET_INT(0, "tags", &fetch_tags, @@ -185,6 +198,10 @@ static int add(int argc, const char **argv) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_add_usage, 0); @@ -1074,6 +1091,10 @@ static int show_push_info_item(struct string_list_item *item, void *cb_data) static int show(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int no_query = 0, result = 0, query_flag = 0; struct option options[] = { OPT_BOOLEAN('n', NULL, &no_query, "do not query remotes"), @@ -1083,6 +1104,10 @@ static int show(int argc, const char **argv) struct string_list info_list = STRING_LIST_INIT_NODUP; struct show_info info; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_show_usage, 0); @@ -1179,6 +1204,10 @@ static int set_head(int argc, const char **argv) struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT; char *head_name = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('a', "auto", &opt_a, "set refs/remotes//HEAD according to remote"), @@ -1186,6 +1215,11 @@ static int set_head(int argc, const char **argv) "delete refs/remotes//HEAD"), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_sethead_usage, 0); if (argc) @@ -1234,12 +1268,20 @@ static int set_head(int argc, const char **argv) static int prune(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int dry_run = 0, result = 0; struct option options[] = { OPT__DRY_RUN(&dry_run, "dry run"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_prune_usage, 0); @@ -1297,6 +1339,10 @@ static int get_remote_default(const char *key, const char *value, void *priv) static int update(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int i, prune = 0; struct option options[] = { OPT_BOOLEAN('p', "prune", &prune, @@ -1307,6 +1353,10 @@ static int update(int argc, const char **argv) int fetch_argc = 0; int default_defined = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + fetch_argv = xmalloc(sizeof(char *) * (argc+5)); argc = parse_options(argc, argv, NULL, options, builtin_remote_update_usage, @@ -1384,12 +1434,20 @@ static int set_remote_branches(const char *remotename, const char **branches, static int set_branches(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int add_mode = 0; struct option options[] = { OPT_BOOLEAN('\0', "add", &add_mode, "add branch"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_setbranches_usage, 0); if (argc == 0) { @@ -1413,6 +1471,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) const char **urlset; int urlset_nr; struct strbuf name_buf = STRBUF_INIT; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('\0', "push", &push_mode, "manipulate push URLs"), @@ -1422,6 +1485,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) "delete URLs"), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_update_usage, PARSE_OPT_KEEP_ARGV0); diff --git a/builtin/replace.c b/builtin/replace.c index fe3a647a36c9a0..bbe488fd34ef5a 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -113,6 +113,11 @@ static int replace_object(const char *object_ref, const char *replace_ref, int cmd_replace(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int list = 0, delete = 0, force = 0; struct option options[] = { OPT_BOOLEAN('l', NULL, &list, "list replace refs"), @@ -121,6 +126,10 @@ int cmd_replace(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0); if (list && delete) diff --git a/builtin/rerere.c b/builtin/rerere.c index 82358855d1da90..b97324f32d27d9 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -119,12 +119,20 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) struct string_list merge_rr = STRING_LIST_INIT_DUP; int i, fd, autoupdate = -1, flags = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_SET_INT(0, "rerere-autoupdate", &autoupdate, "register clean resolutions in index", 1), OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, rerere_usage, 0); if (autoupdate == 1) diff --git a/builtin/reset.c b/builtin/reset.c index 98bca044c1267f..818868a775cdbe 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -242,6 +242,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix) *old_orig = NULL, sha1_old_orig[20]; struct commit *commit; char *reflog_action, msg[1024]; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT__QUIET(&quiet, "be quiet, only report errors"), OPT_SET_INT(0, "mixed", &reset_type, @@ -257,6 +262,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_reset_usage, diff --git a/builtin/revert.c b/builtin/revert.c index f697e6695374d0..237442cc5430c2 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -73,6 +73,11 @@ static void parse_args(int argc, const char **argv) { const char * const * usage_str = revert_or_cherry_pick_usage(); int noop; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('n', "no-commit", &no_commit, "don't automatically commit"), OPT_BOOLEAN('e', "edit", &edit, "edit the commit message"), @@ -89,6 +94,10 @@ static void parse_args(int argc, const char **argv) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (action == CHERRY_PICK) { struct option cp_extra[] = { OPT_BOOLEAN('x', NULL, &no_replay, "append commit name"), diff --git a/builtin/show-branch.c b/builtin/show-branch.c index da695815e26c28..dddb100e35b2da 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -657,6 +657,11 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) int topics = 0; int dense = 1; const char *reflog_base = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_show_branch_options[] = { OPT_BOOLEAN('a', "all", &all_heads, "show remote-tracking and local branches"), @@ -694,6 +699,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_show_branch_config, NULL); if (showbranch_use_color == -1) diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index dea849c3c5ec0c..0fb35450054f6d 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -29,6 +29,11 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) { int quiet = 0; const char *msg = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__QUIET(&quiet, "suppress error message for non-symbolic (detached) refs"), @@ -36,6 +41,10 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_symbolic_ref_usage, 0); diff --git a/builtin/tag.c b/builtin/tag.c index b66b34a1820b3c..2362a004baf559 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -360,6 +360,11 @@ int cmd_tag(int argc, const char **argv, const char *prefix) const char *object_ref, *tag; struct ref_lock *lock; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int annotate = 0, sign = 0, force = 0, lines = -1, list = 0, delete = 0, verify = 0; const char *msgfile = NULL, *keyid = NULL; @@ -394,6 +399,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_tag_config, NULL); argc = parse_options(argc, argv, prefix, options, git_tag_usage, 0); diff --git a/builtin/update-index.c b/builtin/update-index.c index d7850c6309aec0..8defa78ea5ce2d 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -702,6 +702,10 @@ static int reupdate_callback(struct parse_opt_ctx_t *ctx, int cmd_update_index(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int newfd, entries, has_errors = 0, line_termination = '\n'; int read_from_stdin = 0; int prefix_length = prefix ? strlen(prefix) : 0; @@ -791,6 +795,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage(update_index_usage[0]); diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 76ba1d5881b3cd..6fbdaaae857e00 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -11,6 +11,11 @@ static const char * const git_update_ref_usage[] = { int cmd_update_ref(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + const char *refname, *oldval, *msg=NULL; unsigned char sha1[20], oldsha1[20]; int delete = 0, no_deref = 0, flags = 0; @@ -22,6 +27,10 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_update_ref_usage, 0); diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index b90dce6358153b..de0b3e3bdff849 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -10,11 +10,20 @@ static const char * const update_server_info_usage[] = { int cmd_update_server_info(int argc, const char **argv, const char *prefix) { int force = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, "update the info files from scratch"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, update_server_info_usage, 0); if (argc > 0) diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index b6079ae6cb03c7..9b96dc3d244d0a 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -143,6 +143,11 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) int err = 0; unsigned int flags = 0; int i; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_pack_options[] = { OPT_BIT('v', "verbose", &flags, "verbose", VERIFY_PACK_VERBOSE), @@ -151,6 +156,10 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, verify_pack_options, verify_pack_usage, 0); diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 313476604967bb..f1756c1fb5b5a0 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -86,11 +86,20 @@ static int verify_tag(const char *name, int verbose) int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_tag_options[] = { OPT__VERBOSE(&verbose, "print tag contents"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, verify_tag_options, diff --git a/builtin/write-tree.c b/builtin/write-tree.c index b223af416fee5f..c43ec0e97c8309 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -20,6 +20,11 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) const char *prefix = NULL; unsigned char sha1[20]; const char *me = "git-write-tree"; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option write_tree_options[] = { OPT_BIT(0, "missing-ok", &flags, "allow missing objects", WRITE_TREE_MISSING_OK), @@ -33,6 +38,10 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, unused_prefix, write_tree_options, write_tree_usage, 0); diff --git a/daemon.c b/daemon.c index 4c8346d5a1fe13..af031aa13112ba 100644 --- a/daemon.c +++ b/daemon.c @@ -660,10 +660,18 @@ static void check_dead_children(void) static char **cld_argv; static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process cld = { NULL }; char addrbuf[300] = "REMOTE_ADDR=", portbuf[300]; char *env[] = { addrbuf, portbuf, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (max_connections && live_children >= max_connections) { kill_some_child(); sleep(1); /* give it some time to die */ diff --git a/editor.c b/editor.c index d8340031d24828..8dbbb5eeac1fe4 100644 --- a/editor.c +++ b/editor.c @@ -36,8 +36,17 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en return error("Terminal is dumb, but EDITOR unset"); if (strcmp(editor, ":")) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *args[] = { editor, path, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (run_command_v_opt_cd_env(args, RUN_USING_SHELL, NULL, env)) return error("There was a problem with the editor '%s'.", editor); diff --git a/imap-send.c b/imap-send.c index 9adf4b98195308..fbdb3cc31c3b86 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1068,9 +1068,18 @@ static struct store *imap_open_store(struct imap_server_conf *srvc) /* open connection to IMAP server */ if (srvc->tunnel) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { srvc->tunnel, NULL }; struct child_process tunnel = {NULL}; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + imap_info("Starting tunnel '%s'... ", srvc->tunnel); tunnel.argv = argv; diff --git a/submodule.c b/submodule.c index 5294cef641ef74..3828f3c9d78c83 100644 --- a/submodule.c +++ b/submodule.c @@ -550,12 +550,20 @@ static int find_first_merges(struct object_array *result, const char *path, struct commit *commit; int contains_another; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + char merged_revision[42]; const char *rev_args[] = { "rev-list", "--merges", "--ancestry-path", "--all", merged_revision, NULL }; struct rev_info revs; struct setup_revision_opt rev_opts; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&merges, 0, sizeof(merges)); memset(result, 0, sizeof(struct object_array)); memset(&rev_opts, 0, sizeof(rev_opts)); From b78d004afa93d883259b701038c0ae34f5c9e6d2 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Thu, 2 Apr 2009 19:55:19 -0700 Subject: [PATCH 018/211] Remove extraneous ';' following empty loops Remove extra semicolons that were in fact unintended, silencing warnings. --- date.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/date.c b/date.c index 00f9eb5d0b9730..bd15417e3ee301 100644 --- a/date.c +++ b/date.c @@ -819,7 +819,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm const char *end = date; int i; - while (isalpha(*++end)); + while (isalpha(*++end)) ; for (i = 0; i < 12; i++) { From f7c18d55e30938dcd027c449e7124cb1619c4914 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Wed, 21 Jul 2010 20:58:50 -0700 Subject: [PATCH 019/211] Declare local functions static --- attr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attr.c b/attr.c index 0e28ba871f9ba0..f6b3f7e850f9fc 100644 --- a/attr.c +++ b/attr.c @@ -465,7 +465,7 @@ static void drop_attr_stack(void) } } -const char *git_etc_gitattributes(void) +static const char *git_etc_gitattributes(void) { static const char *system_wide; if (!system_wide) @@ -473,7 +473,7 @@ const char *git_etc_gitattributes(void) return system_wide; } -int git_attr_system(void) +static int git_attr_system(void) { return !git_env_bool("GIT_ATTR_NOSYSTEM", 0); } From f2600c01c43534262168cf770afdaade9f4dce42 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 7 Mar 2010 22:21:45 -0800 Subject: [PATCH 020/211] Explicitly return after calling noreturn functions Metrowerks C doesn't support the __noreturn__ attribute and doesn't know that die() and exit() don't return. --- builtin/blame.c | 3 +++ builtin/bundle.c | 3 +++ builtin/commit.c | 3 +++ builtin/fetch-pack.c | 3 +++ builtin/grep.c | 3 +++ builtin/help.c | 3 +++ builtin/mailsplit.c | 3 +++ builtin/pack-redundant.c | 3 +++ builtin/reflog.c | 3 +++ config.c | 3 +++ connect.c | 3 +++ date.c | 3 +++ diff.c | 3 +++ help.c | 3 +++ imap-send.c | 3 +++ notes-merge.c | 3 +++ object.c | 3 +++ parse-options.c | 3 +++ read-cache.c | 3 +++ remote.c | 3 +++ revision.c | 3 +++ setup.c | 3 +++ shell.c | 3 +++ submodule.c | 3 +++ transport.c | 3 +++ 25 files changed, 75 insertions(+) diff --git a/builtin/blame.c b/builtin/blame.c index f6b03f750a0b69..e51690fdadb07b 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1998,6 +1998,9 @@ static const char *parse_loc(const char *spec, regerror(reg_error, ®exp, errbuf, 1024); die("-L parameter '%s': %s", spec + 1, errbuf); } + + /* Not reached */ + return NULL; } /* diff --git a/builtin/bundle.c b/builtin/bundle.c index 81046a9cb870aa..8c41034795a88c 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -62,4 +62,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix) list_bundle_refs(&header, argc, argv); } else usage(builtin_bundle_usage); + + /* Not reached */ + return 0; } diff --git a/builtin/commit.c b/builtin/commit.c index 67757e999fba51..ad569f03f0a672 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -939,6 +939,9 @@ static const char *find_author_by_nickname(const char *name) return strbuf_detach(&buf, NULL); } die(_("No existing author found with '%s'"), name); + + /* Not reached */ + return NULL; } diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 85aff029b225c0..c1f42e77ef993b 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -208,6 +208,9 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1) } } die("git fetch_pack: expected ACK/NAK, got '%s'", line); + + /* Not reached */ + return NAK; } static void send_request(int fd, struct strbuf *buf) diff --git a/builtin/grep.c b/builtin/grep.c index 10a1f65310f28f..56fa9ccd4b978a 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -607,6 +607,9 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec, return hit; } die(_("unable to grep from object of type %s"), typename(obj->type)); + + /* Not reached */ + return 0; } static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec, diff --git a/builtin/help.c b/builtin/help.c index 61ff79839bc477..5fe5c6694cd2cf 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -55,6 +55,9 @@ static enum help_format parse_help_format(const char *format) if (!strcmp(format, "web") || !strcmp(format, "html")) return HELP_FORMAT_WEB; die("unrecognized help format '%s'", format); + + /* Not reached */ + return HELP_FORMAT_NONE; } static const char *get_man_viewer_info(const char *name) diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index 2d4327801e4f77..554bdb7410eaa9 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -98,6 +98,9 @@ static int split_one(FILE *mbox, const char *name, int allow_bare) unlink(name); fprintf(stderr, "corrupt mailbox\n"); exit(1); + + /* Not reached */ + return 0; } static int populate_maildir_list(struct string_list *list, const char *path) diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index f5c6afc5dd46c8..209f62e5c5229b 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -580,6 +580,9 @@ static struct pack_list * add_pack_file(const char *filename) p = p->next; } die("Filename %s not found in packed_git", filename); + + /* Not reached */ + return NULL; } static void load_all(void) diff --git a/builtin/reflog.c b/builtin/reflog.c index ebf610e64a267c..5d543c733e9e0a 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -779,4 +779,7 @@ int cmd_reflog(int argc, const char **argv, const char *prefix) /* Not a recognized reflog command..*/ usage(reflog_usage); + + /* Not reached */ + return 0; } diff --git a/config.c b/config.c index 0abcada9381a3e..f0fa767c5627ff 100644 --- a/config.c +++ b/config.c @@ -338,6 +338,9 @@ static int git_parse_file(config_fn_t fn, void *data) break; } die("bad config file line %d in %s", config_linenr, config_file_name); + + /* Not reached */ + return 0; } static int parse_unit_factor(const char *end, unsigned long *val) diff --git a/connect.c b/connect.c index 57dc20c43ca1ba..0e9547c8dafa0a 100644 --- a/connect.c +++ b/connect.c @@ -148,6 +148,9 @@ static enum protocol get_protocol(const char *name) if (!strcmp(name, "file")) return PROTO_LOCAL; die("I don't handle protocol '%s'", name); + + /* Not reached */ + return (enum protocol)0; } #define STR_(s) # s diff --git a/date.c b/date.c index 00f9eb5d0b9730..d43e8f6c7cee5b 100644 --- a/date.c +++ b/date.c @@ -674,6 +674,9 @@ enum date_mode parse_date_format(const char *format) return DATE_RAW; else die("unknown date format %s", format); + + /* Not reached */ + return DATE_NORMAL; } void datestamp(char *buf, int bufsize) diff --git a/diff.c b/diff.c index 9fa841010cc21b..09391500d77a78 100644 --- a/diff.c +++ b/diff.c @@ -442,6 +442,9 @@ static struct diff_tempfile *claim_diff_tempfile(void) { if (!diff_temp[i].name) return diff_temp + i; die("BUG: diff is failing to clean up its tempfiles"); + + /* Not reached */ + return NULL; } static int remove_tempfile_installed; diff --git a/help.c b/help.c index 7654f1bfd608d1..30281421c01d1a 100644 --- a/help.c +++ b/help.c @@ -392,6 +392,9 @@ const char *help_unknown_cmd(const char *cmd) } exit(1); + + /* Not reached */ + return NULL; } int cmd_version(int argc, const char **argv, const char *prefix) diff --git a/imap-send.c b/imap-send.c index 9adf4b98195308..7d9785b52ca666 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1032,6 +1032,9 @@ static char *cram(const char *challenge_64, const char *user, const char *pass) { die("If you want to use CRAM-MD5 authenticate method, " "you have to build git-imap-send with OpenSSL library."); + + /* not reached */ + return NULL; } #endif diff --git a/notes-merge.c b/notes-merge.c index 28046a998426e8..5183a3032756ae 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -462,6 +462,9 @@ static int merge_one_change(struct notes_merge_options *o, return 0; } die("Unknown strategy (%i).", o->strategy); + + /* Not reached */ + return 0; } static int merge_changes(struct notes_merge_options *o, diff --git a/object.c b/object.c index 7e1f2bbed2ad7f..a0e550efa2081f 100644 --- a/object.c +++ b/object.c @@ -41,6 +41,9 @@ int type_from_string(const char *str) if (!strcmp(str, object_type_strings[i])) return i; die("invalid object type \"%s\"", str); + + /* Not reached */ + return 0; } static unsigned int hash_obj(struct object *obj, unsigned int n) diff --git a/parse-options.c b/parse-options.c index 73bd28ad90986a..9eb02d1c04204d 100644 --- a/parse-options.c +++ b/parse-options.c @@ -147,6 +147,9 @@ static int get_value(struct parse_opt_ctx_t *p, default: die("should not happen, someone must be hit on the forehead"); } + + /* Not reached */ + return 0; } static int parse_short_opt(struct parse_opt_ctx_t *p, const struct option *options) diff --git a/read-cache.c b/read-cache.c index f38471cac3ac57..978b46dc13b789 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1360,6 +1360,9 @@ int read_index_from(struct index_state *istate, const char *path) munmap(mmap, mmap_size); errno = EINVAL; die("index file corrupt"); + + /* Not reached */ + return 0; } int is_index_unborn(struct index_state *istate) diff --git a/remote.c b/remote.c index ca42a126ad0451..e16d87265daf36 100644 --- a/remote.c +++ b/remote.c @@ -655,6 +655,9 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp return NULL; } die("Invalid refspec '%s'", refspec[i]); + + /* Not reached */ + return NULL; } int valid_fetch_refspec(const char *fetch_refspec_str) diff --git a/revision.c b/revision.c index 0f38364cf3f81a..20ed06e2076d12 100644 --- a/revision.c +++ b/revision.c @@ -250,6 +250,9 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object return NULL; } die("%s is unknown object", name); + + /* Not reached */ + return NULL; } static int everybody_uninteresting(struct commit_list *orig) diff --git a/setup.c b/setup.c index 03cd84f2fcbf9c..934a2ac2aefbd2 100644 --- a/setup.c +++ b/setup.c @@ -79,6 +79,9 @@ int check_filename(const char *prefix, const char *arg) if (errno == ENOENT || errno == ENOTDIR) return 0; /* file does not exist */ die_errno("failed to stat '%s'", arg); + + /* Not reached */ + return 0; } static void NORETURN die_verify_filename(const char *prefix, const char *arg) diff --git a/shell.c b/shell.c index dea4cfdd2c230a..df143fa00f6398 100644 --- a/shell.c +++ b/shell.c @@ -213,4 +213,7 @@ int main(int argc, char **argv) die("invalid command format '%s': %s", argv[2], split_cmdline_strerror(count)); } + + /* Not reached */ + return 0; } diff --git a/submodule.c b/submodule.c index 5294cef641ef74..cb407440f3f469 100644 --- a/submodule.c +++ b/submodule.c @@ -219,6 +219,9 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg) return RECURSE_SUBMODULES_ON_DEMAND; die("bad %s argument: %s", opt, arg); } + + /* Not reached */ + return 0; } void show_submodule_summary(FILE *f, const char *path, diff --git a/transport.c b/transport.c index a02f79aae3d91e..68d137c2f40fb3 100644 --- a/transport.c +++ b/transport.c @@ -1131,6 +1131,9 @@ int transport_connect(struct transport *transport, const char *name, return transport->connect(transport, name, exec, fd); else die("Operation not supported by protocol"); + + /* Not reached */ + return 0; } int transport_disconnect(struct transport *transport) From 01d7bce187253d271c7fca4bdb1afe9ca1ab065d Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 7 Mar 2010 21:59:16 -0800 Subject: [PATCH 021/211] Include headers for forward function declarations This avoids diagnostics when function prototypes are expected. --- builtin/index-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 31f001f1059ec5..e40451ffb4ecd3 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "builtin.h" #include "delta.h" #include "pack.h" #include "csum-file.h" From 49dc21f3878bdf62c918304cbc70b012247db755 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 17:28:54 -0700 Subject: [PATCH 022/211] Rename __LAMP__ to __RELIX__ --- run-command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run-command.c b/run-command.c index 35bbfdc302a668..2e2ce2067222a2 100644 --- a/run-command.c +++ b/run-command.c @@ -2,7 +2,7 @@ #include "run-command.h" #include "exec_cmd.h" -#ifdef __LAMP__ +#ifdef __RELIX__ #define GIT_FORK() vfork() #else #define GIT_FORK() fork() @@ -489,7 +489,7 @@ static NORETURN void die_async(const char *err, va_list params) static void run_async_proc(struct async *async, int proc_in, int proc_out) { -#ifdef __LAMP__ +#ifdef __RELIX__ (void) reexec(async->proc, proc_in, proc_out, async->data); #else exit(!!async->proc(proc_in, proc_out, async->data)); From 6b77188c604e3a69e05f09682f208a889fa4a17c Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Thu, 2 Apr 2009 20:19:40 -0700 Subject: [PATCH 023/211] Add compat/relix.h to support MacRelix Include *before* defining macros of its functions, in case it's included later (which it is, in the case of fnmatch and xdiff). Define GIT_VERSION. Define a smaller LARGE_PACKET_MAX for MacRelix due to limited local data space on 68K. Define USE_CPLUSPLUS_FOR_INIT so #pragma cplusplus will be enabled during initialization of aggregates involving values computed at runtime. Add dummy definitions of GIT_{MAN,INFO,HTML}_PATH. Declare reexec(), which when called after vfork() spawns a lightweight process, which shares memory space with the parent but has its own file descriptor set (among other things). This substitutes for fork() in start_async(). --- compat/relix.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 compat/relix.h diff --git a/compat/relix.h b/compat/relix.h new file mode 100644 index 00000000000000..8a49b289ffabf7 --- /dev/null +++ b/compat/relix.h @@ -0,0 +1,48 @@ +/* + relix.h + ------- + + MacRelix support, by Josh Juran +*/ + +// Include early so git's macros don't interfere with it later +#include + +#define GIT_VERSION "1.7.5" + +// MacRelix has small thread stacks, and 68K has a hard 32K local data limit. +#define LARGE_PACKET_MAX (16384 - 16) + +// Enable #pragma cplusplus over dynamic aggregate initializers. +#define USE_CPLUSPLUS_FOR_INIT 1 + +#define NO_CURL 1 +#define NO_EXPAT 1 +#define NO_ICONV 1 +#define NO_IPV6 1 +#define NO_NSEC 1 +#define NO_OPENSSL 1 +#define NO_PTHREADS 1 +#define NO_LIBGEN_H 1 + +#define HAVE_STRING_H 1 + +#define SHA1_HEADER "block-sha1/sha1.h" + +#define ETC_GITCONFIG "/etc/gitconfig" + +#define ETC_GITATTRIBUTES "/etc/gitattributes" + +#define GIT_EXEC_PATH "/usr/lib/git-core" + +#define GIT_MAN_PATH "man" +#define GIT_INFO_PATH "info" +#define GIT_HTML_PATH "html" + +#define PREFIX "/usr" + +#define gitmemmem memmem +#define gitstrcasestr strcasestr + +extern int reexec( void* f, ... ); + From adaa4cbd0de93e746b7a51077743d1c072ae7b52 Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Thu, 2 Apr 2009 20:19:40 -0700 Subject: [PATCH 024/211] Include "compat/relix.h" targeting MacRelix --- git-compat-util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index 40498b33c9f09e..a4a1e920a383c1 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -152,6 +152,9 @@ #ifdef _MSC_VER #include "compat/msvc.h" #endif +#ifdef __RELIX__ +#include "compat/relix.h" +#endif #ifndef NO_LIBGEN_H #include From 8e1d57953ad5ec31239aebd7c772550e22f7e4b3 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 19:23:08 -0700 Subject: [PATCH 025/211] Update GIT_VERSION to 1.7.5.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 8a49b289ffabf7..63ca44e964405d 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.5" +#define GIT_VERSION "1.7.5.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 7a925b212be9b847a67e408656bc7fd1bfffed23 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 20:37:50 -0700 Subject: [PATCH 026/211] Update GIT_VERSION to 1.7.5.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 63ca44e964405d..1af8b16d2de09a 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.5.1" +#define GIT_VERSION "1.7.5.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From dc16c5780c818a6c48a04146138b41b59842d8d7 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 20:41:34 -0700 Subject: [PATCH 027/211] Update GIT_VERSION to 1.7.5.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 1af8b16d2de09a..82000c6fb325d5 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.5.2" +#define GIT_VERSION "1.7.5.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From f2c8c7c0b7442aad2bfd3272aa43fc2c2ae3226b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 20:43:53 -0700 Subject: [PATCH 028/211] Update GIT_VERSION to 1.7.5.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 82000c6fb325d5..2eaa95aae4702b 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.5.3" +#define GIT_VERSION "1.7.5.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From e35c24a4ddd0064efbdf82b3ec8891cf103bd510 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 20:46:20 -0700 Subject: [PATCH 029/211] Update GIT_VERSION to 1.7.6 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 2eaa95aae4702b..cdedb71830c787 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.5.4" +#define GIT_VERSION "1.7.6" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 46b85a0058ecd2095436292bfda36d02b4185e8b Mon Sep 17 00:00:00 2001 From: Joshua Juran Date: Sun, 29 Nov 2009 04:14:12 -0800 Subject: [PATCH 030/211] Use C++ to initialize aggregates to dynamic values Metrowerks C won't initialize an aggregate with values undetermined at compile time, but Metrowerks C++ will, so use it instead. In some cases 'new' and 'delete' have to be defined to something else. --- archive.c | 17 ++++++++ builtin/apply.c | 8 ++++ builtin/archive.c | 9 ++++ builtin/bisect--helper.c | 9 ++++ builtin/branch.c | 9 ++++ builtin/cat-file.c | 8 ++++ builtin/checkout-index.c | 9 ++++ builtin/checkout.c | 9 ++++ builtin/clean.c | 9 ++++ builtin/count-objects.c | 9 ++++ builtin/describe.c | 9 ++++ builtin/fast-export.c | 9 ++++ builtin/fetch.c | 16 ++++++++ builtin/fmt-merge-msg.c | 9 ++++ builtin/for-each-ref.c | 8 ++++ builtin/gc.c | 8 ++++ builtin/grep.c | 8 ++++ builtin/init-db.c | 9 ++++ builtin/log.c | 24 +++++++++++ builtin/ls-files.c | 9 ++++ builtin/ls-tree.c | 8 ++++ builtin/merge-base.c | 8 ++++ builtin/merge-file.c | 9 ++++ builtin/merge-index.c | 8 ++++ builtin/mktree.c | 8 ++++ builtin/mv.c | 10 +++++ builtin/name-rev.c | 9 ++++ builtin/notes.c | 79 ++++++++++++++++++++++++++++++++++++ builtin/pack-refs.c | 10 +++++ builtin/prune-packed.c | 8 ++++ builtin/push.c | 8 ++++ builtin/read-tree.c | 9 ++++ builtin/remote.c | 68 +++++++++++++++++++++++++++++++ builtin/replace.c | 9 ++++ builtin/rerere.c | 8 ++++ builtin/reset.c | 9 ++++ builtin/revert.c | 9 ++++ builtin/show-branch.c | 9 ++++ builtin/symbolic-ref.c | 9 ++++ builtin/tag.c | 9 ++++ builtin/update-index.c | 8 ++++ builtin/update-ref.c | 9 ++++ builtin/update-server-info.c | 9 ++++ builtin/verify-pack.c | 9 ++++ builtin/verify-tag.c | 9 ++++ builtin/write-tree.c | 9 ++++ daemon.c | 8 ++++ editor.c | 9 ++++ imap-send.c | 9 ++++ sha1_file.c | 8 ++++ submodule.c | 8 ++++ 51 files changed, 604 insertions(+) diff --git a/archive.c b/archive.c index 42f2d2fdc81a7c..5c1e42b759abb8 100644 --- a/archive.c +++ b/archive.c @@ -224,6 +224,10 @@ static int reject_entry(const unsigned char *sha1, const char *base, static int path_exists(struct tree *tree, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *paths[] = { path, NULL }; struct pathspec pathspec; int ret; @@ -232,6 +236,10 @@ static int path_exists(struct tree *tree, const char *path) ret = read_tree_recursive(tree, "", 0, 0, &pathspec, reject_entry, NULL); free_pathspec(&pathspec); return ret != 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif } static void parse_pathspec_arg(const char **pathspec, @@ -311,6 +319,11 @@ static int parse_archive_args(int argc, const char **argv, int i; int list = 0; int worktree_attributes = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_GROUP(""), OPT_STRING(0, "format", &format, "fmt", "archive format"), @@ -342,6 +355,10 @@ static int parse_archive_args(int argc, const char **argv, OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, opts, archive_usage, 0); if (remote) diff --git a/builtin/apply.c b/builtin/apply.c index 530d4bb7e76da8..34e3c740e14165 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3836,6 +3836,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) const char *whitespace_option = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_apply_options[] = { { OPTION_CALLBACK, 0, "exclude", NULL, "path", "don't apply changes matching the given path", @@ -3905,6 +3909,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + prefix = prefix_; prefix_length = prefix ? strlen(prefix) : 0; git_config(git_apply_config, NULL); diff --git a/builtin/archive.c b/builtin/archive.c index b14eaba1594bad..9ae7a06373d61e 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -85,6 +85,11 @@ int cmd_archive(int argc, const char **argv, const char *prefix) const char *output = NULL; const char *remote = NULL; const char *format_option = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option local_opts[] = { OPT_STRING('o', "output", &output, "file", "write the archive to this file"), @@ -95,6 +100,10 @@ int cmd_archive(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, local_opts, NULL, PARSE_OPT_KEEP_ALL); diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 5b226399e1c30b..4a25914f2232c2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -11,12 +11,21 @@ static const char * const git_bisect_helper_usage[] = { int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { int next_all = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "next-all", &next_all, "perform 'git bisect next'"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_bisect_helper_usage, 0); diff --git a/builtin/branch.c b/builtin/branch.c index d6ab93bfbb3699..db3392642f40d1 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -612,6 +612,11 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int int cmd_branch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int delete = 0, rename = 0, force_create = 0; int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0; int reflog = 0; @@ -668,6 +673,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_branch_usage, options); diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 07bd984084fbbf..90881fefc38cfa 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -243,6 +243,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) int opt = 0, batch = 0; const char *exp_type = NULL, *obj_name = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT_GROUP(" can be one of: blob, tree, commit, tag"), OPT_SET_INT('t', NULL, &opt, "show object type", 't'), @@ -261,6 +265,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_cat_file_config, NULL); if (argc != 3 && argc != 2) diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index f1fec24745a854..222acf8f45eb09 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -214,6 +214,11 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) int read_from_stdin = 0; int prefix_length; int force = 0, quiet = 0, not_new = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_checkout_index_options[] = { OPT_BOOLEAN('a', "all", &all, "checks out all files in the index"), @@ -241,6 +246,10 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_checkout_index_usage, builtin_checkout_index_options); diff --git a/builtin/checkout.c b/builtin/checkout.c index 28cdc51b85e7d4..bb93b05c6f2c0c 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -915,6 +915,11 @@ static int parse_branchname_arg(int argc, const char **argv, int cmd_checkout(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define new new_ +#endif + struct checkout_opts opts; unsigned char rev[20]; struct branch_info new; @@ -948,6 +953,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); memset(&new, 0, sizeof(new)); diff --git a/builtin/clean.c b/builtin/clean.c index 75697f711116e4..319fd07c68c616 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -47,6 +47,11 @@ int cmd_clean(int argc, const char **argv, const char *prefix) struct string_list exclude_list = STRING_LIST_INIT_NODUP; const char *qname; char *seen = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__QUIET(&quiet, "do not print names of files removed"), OPT__DRY_RUN(&show_only, "dry run"), @@ -61,6 +66,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_clean_config, NULL); if (force < 0) force = 0; diff --git a/builtin/count-objects.c b/builtin/count-objects.c index c37cb98c31ddfa..3c8f4385ea846c 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -78,11 +78,20 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) char *path = xmalloc(len + 50); unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0; off_t loose_size = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT__VERBOSE(&verbose, "be verbose"), OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0); /* we do not take arguments other than flags for now */ if (argc) diff --git a/builtin/describe.c b/builtin/describe.c index 66fc291c8a81de..31ed5a60c84966 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -399,6 +399,11 @@ static void describe(const char *arg, int last_one) int cmd_describe(int argc, const char **argv, const char *prefix) { int contains = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "contains", &contains, "find the tag that comes after the commit"), OPT_BOOLEAN(0, "debug", &debug, "debug search strategy on stderr"), @@ -420,6 +425,10 @@ int cmd_describe(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, describe_usage, 0); if (abbrev < 0) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index daf19451ba7df5..d30b6c9e322396 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -610,6 +610,11 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) struct string_list extra_refs = STRING_LIST_INIT_NODUP; struct commit *commit; char *export_filename = NULL, *import_filename = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_INTEGER(0, "progress", &progress, "show progress after objects"), @@ -633,6 +638,10 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 1) usage_with_options (fast_export_usage, options); diff --git a/builtin/fetch.c b/builtin/fetch.c index 93c99385a95e6a..ee89ac26020702 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -586,11 +586,19 @@ static void find_non_local_tags(struct transport *transport, struct ref **head, struct ref ***tail) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct string_list existing_refs = STRING_LIST_INIT_NODUP; struct string_list remote_refs = STRING_LIST_INIT_NODUP; const struct ref *ref; struct string_list_item *item = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + for_each_ref(add_existing, &existing_refs); for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) { if (prefixcmp(ref->name, "refs/tags")) @@ -802,10 +810,18 @@ static int get_remote_group(const char *key, const char *value, void *priv) static int add_remote_or_group(const char *name, struct string_list *list) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int prev_nr = list->nr; struct remote_group_data g; g.name = name; g.list = list; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(get_remote_group, &g); if (list->nr == prev_nr) { struct remote *remote; diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 75816329d6153c..316f2b2feb15c4 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -318,6 +318,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) { const char *inpath = NULL; const char *message = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_INTEGER, 0, "log", &shortlog_len, "n", "populate log with at most entries from shortlog", @@ -332,6 +337,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + FILE *in = stdin; struct strbuf input = STRBUF_INIT, output = STRBUF_INIT; int ret; diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 89e75c6894e6fd..7d290a50193977 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -947,6 +947,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) struct refinfo **refs; struct grab_ref_cbdata cbdata; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT('s', "shell", "e_style, "quote placeholders suitably for shells", QUOTE_SHELL), @@ -965,6 +969,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0); if (maxcount < 0) { error("invalid --count argument: `%d'", maxcount); diff --git a/builtin/gc.c b/builtin/gc.c index 0498094711d1ad..7beca0f329ff0a 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -179,6 +179,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) int quiet = 0; char buf[80]; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_gc_options[] = { OPT__QUIET(&quiet, "suppress progress reporting"), { OPTION_STRING, 0, "prune", &prune_expire, "date", @@ -189,6 +193,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_gc_usage, builtin_gc_options); diff --git a/builtin/grep.c b/builtin/grep.c index 871afaa3c76ea3..7671c60e1a8bcd 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -762,6 +762,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix) }; int pattern_type = pattern_type_unspecified; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "cached", &cached, "search in index instead of in the work tree"), @@ -857,6 +861,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* * 'git grep -h', unlike 'git grep -h ', is a request * to show usage information and exit. diff --git a/builtin/init-db.c b/builtin/init-db.c index 025aa47c804e44..cacb9d2bfdb0f5 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -480,6 +480,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) const char *work_tree; const char *template_dir = NULL; unsigned int flags = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option init_db_options[] = { OPT_STRING(0, "template", &template_dir, "template-directory", "directory from which templates will be used"), @@ -495,6 +500,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0); if (real_git_dir && !is_absolute_path(real_git_dir)) diff --git a/builtin/log.c b/builtin/log.c index 5c2af590047d92..eafe13b5ff5463 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -93,6 +93,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, struct userformat_want w; int quiet = 0, source = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option builtin_log_options[] = { OPT_BOOLEAN(0, "quiet", &quiet, "suppress diff output"), OPT_BOOLEAN(0, "source", &source, "show source"), @@ -101,6 +105,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, builtin_log_options, builtin_log_usage, PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | @@ -1019,6 +1027,10 @@ static int cc_callback(const struct option *opt, const char *arg, int unset) int cmd_format_patch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct commit *commit; struct commit **list = NULL; struct rev_info rev; @@ -1098,6 +1110,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + extra_hdr.strdup_strings = 1; extra_to.strdup_strings = 1; extra_cc.strdup_strings = 1; @@ -1432,12 +1448,20 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) const char *limit = NULL; int verbose = 0, abbrev = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__ABBREV(&abbrev), OPT__VERBOSE(&verbose, "be verbose"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, cherry_usage, 0); switch (argc) { diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 15701233e29b24..7a8653b302f0f1 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -475,6 +475,11 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) int require_work_tree = 0, show_tag = 0; const char *max_prefix; struct dir_struct dir; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_ls_files_options[] = { { OPTION_CALLBACK, 'z', NULL, NULL, NULL, "paths are separated with NUL character", @@ -531,6 +536,10 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(ls_files_usage, builtin_ls_files_options); diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index f08c5b0c942eec..a7062edc626a3d 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -118,6 +118,10 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen, int cmd_ls_tree(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + unsigned char sha1[20]; struct tree *tree; int i, full_tree = 0; @@ -145,6 +149,10 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); ls_tree_prefix = prefix; if (prefix && *prefix) diff --git a/builtin/merge-base.c b/builtin/merge-base.c index 4f30f1b0c8b14e..94af60b892bd76 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -78,6 +78,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) int octopus = 0; int reduce = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('a', "all", &show_all, "output all common ancestors"), OPT_BOOLEAN(0, "octopus", &octopus, "find ancestors for a single n-way merge"), @@ -85,6 +89,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0); if (!octopus && !reduce && argc < 2) diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 237abd3c0b27b6..c3863c122286aa 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -29,6 +29,11 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) int ret = 0, i = 0, to_stdout = 0; int quiet = 0; int prefixlen = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('p', "stdout", &to_stdout, "send results to standard output"), OPT_SET_INT(0, "diff3", &xmp.style, "use a diff3 based merge", XDL_MERGE_DIFF3), @@ -46,6 +51,10 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + xmp.level = XDL_MERGE_ZEALOUS_ALNUM; xmp.style = 0; xmp.favor = 0; diff --git a/builtin/merge-index.c b/builtin/merge-index.c index 23388325879c5a..99753c51bb7026 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -7,11 +7,19 @@ static int err; static int merge_entry(int pos, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int found; const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL }; char hexbuf[4][60]; char ownbuf[4][60]; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (pos >= active_nr) die("git merge-index: %s not in the cache", path); found = 0; diff --git a/builtin/mktree.c b/builtin/mktree.c index 098395fda19326..a6dac9692a4623 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -148,6 +148,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) int is_batch_mode = 0; int got_eof = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option option[] = { OPT_SET_INT('z', NULL, &line_termination, "input is NUL terminated", '\0'), OPT_SET_INT( 0 , "missing", &allow_missing, "allow missing objects", 1), @@ -155,6 +159,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + ac = parse_options(ac, av, prefix, option, mktree_usage, 0); while (!got_eof) { diff --git a/builtin/mv.c b/builtin/mv.c index 40f33ca4d0e6d0..321cbd1675236b 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -54,12 +54,22 @@ int cmd_mv(int argc, const char **argv, const char *prefix) { int i, newfd; int verbose = 0, show_only = 0, force = 0, ignore_errors = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_mv_options[] = { OPT__DRY_RUN(&show_only, "dry run"), OPT__FORCE(&force, "force move/rename even if target exists"), OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + const char **source, **destination, **dest_path; enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes; struct stat st; diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 31f5c1c971381a..0c40b495275088 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -223,6 +223,11 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) struct object_array revs = OBJECT_ARRAY_INIT; int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0; struct name_ref_data data = { 0, 0, NULL }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BOOLEAN(0, "name-only", &data.name_only, "print only names (no SHA-1)"), OPT_BOOLEAN(0, "tags", &data.tags_only, "only use tags to name the commits"), @@ -237,6 +242,10 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0); if (!!all + !!transform_stdin + !!argc > 1) { diff --git a/builtin/notes.c b/builtin/notes.c index f8e437db015604..1277fa7583140f 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -122,12 +122,20 @@ static void write_note_data(int fd, const unsigned char *sha1) static void write_commented_object(int fd, const unsigned char *object) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[5] = {"show", "--stat", "--no-notes", sha1_to_hex(object), NULL}; struct child_process show; struct strbuf buf = STRBUF_INIT; FILE *show_out; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* Invoke "git show --stat --no-notes $object" */ memset(&show, 0, sizeof(show)); show.argv = show_args; @@ -530,6 +538,11 @@ static int add(int argc, const char **argv, const char *prefix) char logmsg[100]; const unsigned char *note; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, "msg", "note contents as a string", PARSE_OPT_NONEG, @@ -547,6 +560,10 @@ static int add(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_add_usage, PARSE_OPT_KEEP_ARGV0); @@ -610,6 +627,11 @@ static int copy(int argc, const char **argv, const char *prefix) unsigned char object[20], from_obj[20]; struct notes_tree *t; const char *rewrite_cmd = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, "replace existing notes"), OPT_BOOLEAN(0, "stdin", &from_stdin, "read objects from stdin"), @@ -619,6 +641,10 @@ static int copy(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_copy_usage, 0); @@ -687,6 +713,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) char logmsg[100]; const char * const *usage; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, "msg", "note contents as a string", PARSE_OPT_NONEG, @@ -702,6 +733,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) parse_reuse_arg}, OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + int edit = !strcmp(argv[0], "edit"); usage = edit ? git_notes_edit_usage : git_notes_append_usage; @@ -772,7 +808,17 @@ static int show(int argc, const char **argv, const char *prefix) retval = error(_("No note found for object %s."), sha1_to_hex(object)); else { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[3] = {"show", sha1_to_hex(note), NULL}; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + retval = execv_git_cmd(show_args); } free_notes(t); @@ -848,6 +894,10 @@ static int merge_commit(struct notes_merge_options *o) static int merge(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct strbuf remote_ref = STRBUF_INIT, msg = STRBUF_INIT; unsigned char result_sha1[20]; struct notes_tree *t; @@ -873,6 +923,10 @@ static int merge(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_merge_usage, 0); @@ -971,6 +1025,10 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag static int remove_cmd(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + unsigned flag = 0; int from_stdin = 0; struct option options[] = { @@ -984,6 +1042,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) struct notes_tree *t; int retval = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_remove_usage, 0); @@ -1013,6 +1075,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) static int prune(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct notes_tree *t; int show_only = 0, verbose = 0; struct option options[] = { @@ -1021,6 +1087,10 @@ static int prune(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_prune_usage, 0); @@ -1058,12 +1128,21 @@ int cmd_notes(int argc, const char **argv, const char *prefix) { int result; const char *override_notes_ref = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_STRING(0, "ref", &override_notes_ref, "notes_ref", "use notes from "), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_notes_usage, PARSE_OPT_STOP_AT_NON_OPTION); diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index 39a9d89fbdf322..ca9e3b7ab01a63 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -10,11 +10,21 @@ static char const * const pack_refs_usage[] = { int cmd_pack_refs(int argc, const char **argv, const char *prefix) { unsigned int flags = PACK_REFS_PRUNE; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT(0, "all", &flags, "pack everything", PACK_REFS_ALL), OPT_BIT(0, "prune", &flags, "prune loose refs (default)", PACK_REFS_PRUNE), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0)) usage_with_options(pack_refs_usage, opts); return pack_refs(flags); diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index f9463deec2f5a5..bc506d5b306e7e 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -71,6 +71,10 @@ void prune_packed_objects(int opts) int cmd_prune_packed(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int opts = isatty(2) ? VERBOSE : 0; const struct option prune_packed_options[] = { OPT_BIT('n', "dry-run", &opts, "dry run", DRY_RUN), @@ -78,6 +82,10 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, prune_packed_options, prune_packed_usage, 0); diff --git a/builtin/push.c b/builtin/push.c index 9cebf9ea234d96..09cc19e4b9b92f 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -221,6 +221,10 @@ static int do_push(const char *repo, int flags) int cmd_push(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int flags = 0; int tags = 0; int rc; @@ -245,6 +249,10 @@ int cmd_push(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + packet_trace_identity("push"); git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, push_usage, 0); diff --git a/builtin/read-tree.c b/builtin/read-tree.c index df6c4c8819e790..e08bedf8b8e62e 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -103,6 +103,11 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) struct tree_desc t[MAX_UNPACK_TREES]; struct unpack_trees_options opts; int prefix_set = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option read_tree_options[] = { { OPTION_CALLBACK, 0, "index-output", NULL, "file", "write resulting index to ", @@ -138,6 +143,10 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); opts.head_idx = -1; opts.src_index = &the_index; diff --git a/builtin/remote.c b/builtin/remote.c index 9ff1cac69b9fd2..d8e2c23e375fcb 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -100,11 +100,20 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not) static int fetch_remote(const char *name) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { "fetch", name, NULL, NULL }; if (verbose) { argv[1] = "-v"; argv[2] = name; } + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + printf("Updating %s\n", name); if (run_command_v_opt(argv, RUN_GIT_CMD)) return error("Could not fetch %s", name); @@ -169,6 +178,10 @@ static int add(int argc, const char **argv) const char *name, *url; int i; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('f', "fetch", &fetch, "fetch the remote branches"), OPT_SET_INT(0, "tags", &fetch_tags, @@ -185,6 +198,10 @@ static int add(int argc, const char **argv) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_add_usage, 0); @@ -1074,6 +1091,10 @@ static int show_push_info_item(struct string_list_item *item, void *cb_data) static int show(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int no_query = 0, result = 0, query_flag = 0; struct option options[] = { OPT_BOOLEAN('n', NULL, &no_query, "do not query remotes"), @@ -1083,6 +1104,10 @@ static int show(int argc, const char **argv) struct string_list info_list = STRING_LIST_INIT_NODUP; struct show_info info; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_show_usage, 0); @@ -1179,6 +1204,10 @@ static int set_head(int argc, const char **argv) struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT; char *head_name = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('a', "auto", &opt_a, "set refs/remotes//HEAD according to remote"), @@ -1186,6 +1215,11 @@ static int set_head(int argc, const char **argv) "delete refs/remotes//HEAD"), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_sethead_usage, 0); if (argc) @@ -1234,12 +1268,20 @@ static int set_head(int argc, const char **argv) static int prune(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int dry_run = 0, result = 0; struct option options[] = { OPT__DRY_RUN(&dry_run, "dry run"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_prune_usage, 0); @@ -1297,6 +1339,10 @@ static int get_remote_default(const char *key, const char *value, void *priv) static int update(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int i, prune = 0; struct option options[] = { OPT_BOOLEAN('p', "prune", &prune, @@ -1307,6 +1353,10 @@ static int update(int argc, const char **argv) int fetch_argc = 0; int default_defined = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + fetch_argv = xmalloc(sizeof(char *) * (argc+5)); argc = parse_options(argc, argv, NULL, options, builtin_remote_update_usage, @@ -1384,12 +1434,20 @@ static int set_remote_branches(const char *remotename, const char **branches, static int set_branches(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int add_mode = 0; struct option options[] = { OPT_BOOLEAN('\0', "add", &add_mode, "add branch"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_setbranches_usage, 0); if (argc == 0) { @@ -1413,6 +1471,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) const char **urlset; int urlset_nr; struct strbuf name_buf = STRBUF_INIT; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('\0', "push", &push_mode, "manipulate push URLs"), @@ -1422,6 +1485,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) "delete URLs"), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_update_usage, PARSE_OPT_KEEP_ARGV0); diff --git a/builtin/replace.c b/builtin/replace.c index fe3a647a36c9a0..bbe488fd34ef5a 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -113,6 +113,11 @@ static int replace_object(const char *object_ref, const char *replace_ref, int cmd_replace(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int list = 0, delete = 0, force = 0; struct option options[] = { OPT_BOOLEAN('l', NULL, &list, "list replace refs"), @@ -121,6 +126,10 @@ int cmd_replace(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0); if (list && delete) diff --git a/builtin/rerere.c b/builtin/rerere.c index 08213c7c0bc6fa..f7ee02f0bdce7f 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -51,12 +51,20 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) struct string_list merge_rr = STRING_LIST_INIT_DUP; int i, fd, autoupdate = -1, flags = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_SET_INT(0, "rerere-autoupdate", &autoupdate, "register clean resolutions in index", 1), OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, rerere_usage, 0); if (autoupdate == 1) diff --git a/builtin/reset.c b/builtin/reset.c index 98bca044c1267f..818868a775cdbe 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -242,6 +242,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix) *old_orig = NULL, sha1_old_orig[20]; struct commit *commit; char *reflog_action, msg[1024]; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT__QUIET(&quiet, "be quiet, only report errors"), OPT_SET_INT(0, "mixed", &reset_type, @@ -257,6 +262,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_reset_usage, diff --git a/builtin/revert.c b/builtin/revert.c index 1f27c63343904a..7aee5822338cbf 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -73,6 +73,11 @@ static void parse_args(int argc, const char **argv) { const char * const * usage_str = revert_or_cherry_pick_usage(); int noop; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('n', "no-commit", &no_commit, "don't automatically commit"), OPT_BOOLEAN('e', "edit", &edit, "edit the commit message"), @@ -89,6 +94,10 @@ static void parse_args(int argc, const char **argv) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (action == CHERRY_PICK) { struct option cp_extra[] = { OPT_BOOLEAN('x', NULL, &no_replay, "append commit name"), diff --git a/builtin/show-branch.c b/builtin/show-branch.c index facc63a79ec0c8..d7a96643280db0 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -646,6 +646,11 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) int topics = 0; int dense = 1; const char *reflog_base = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_show_branch_options[] = { OPT_BOOLEAN('a', "all", &all_heads, "show remote-tracking and local branches"), @@ -683,6 +688,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_show_branch_config, NULL); if (showbranch_use_color == -1) diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index dea849c3c5ec0c..0fb35450054f6d 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -29,6 +29,11 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) { int quiet = 0; const char *msg = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__QUIET(&quiet, "suppress error message for non-symbolic (detached) refs"), @@ -36,6 +41,10 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_symbolic_ref_usage, 0); diff --git a/builtin/tag.c b/builtin/tag.c index ec926fc8ee4512..bd0ebf1416caa9 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -371,6 +371,11 @@ int cmd_tag(int argc, const char **argv, const char *prefix) const char *object_ref, *tag; struct ref_lock *lock; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int annotate = 0, sign = 0, force = 0, lines = -1, list = 0, delete = 0, verify = 0; const char *msgfile = NULL, *keyid = NULL; @@ -405,6 +410,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_tag_config, NULL); argc = parse_options(argc, argv, prefix, options, git_tag_usage, 0); diff --git a/builtin/update-index.c b/builtin/update-index.c index a6a23fa1f3c778..4a8133774e0b02 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -705,6 +705,10 @@ static int reupdate_callback(struct parse_opt_ctx_t *ctx, int cmd_update_index(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int newfd, entries, has_errors = 0, line_termination = '\n'; int read_from_stdin = 0; int prefix_length = prefix ? strlen(prefix) : 0; @@ -794,6 +798,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage(update_index_usage[0]); diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 76ba1d5881b3cd..6fbdaaae857e00 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -11,6 +11,11 @@ static const char * const git_update_ref_usage[] = { int cmd_update_ref(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + const char *refname, *oldval, *msg=NULL; unsigned char sha1[20], oldsha1[20]; int delete = 0, no_deref = 0, flags = 0; @@ -22,6 +27,10 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_update_ref_usage, 0); diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index b90dce6358153b..de0b3e3bdff849 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -10,11 +10,20 @@ static const char * const update_server_info_usage[] = { int cmd_update_server_info(int argc, const char **argv, const char *prefix) { int force = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, "update the info files from scratch"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, update_server_info_usage, 0); if (argc > 0) diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index b6079ae6cb03c7..9b96dc3d244d0a 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -143,6 +143,11 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) int err = 0; unsigned int flags = 0; int i; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_pack_options[] = { OPT_BIT('v', "verbose", &flags, "verbose", VERIFY_PACK_VERBOSE), @@ -151,6 +156,10 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, verify_pack_options, verify_pack_usage, 0); diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 313476604967bb..f1756c1fb5b5a0 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -86,11 +86,20 @@ static int verify_tag(const char *name, int verbose) int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_tag_options[] = { OPT__VERBOSE(&verbose, "print tag contents"), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, verify_tag_options, diff --git a/builtin/write-tree.c b/builtin/write-tree.c index b223af416fee5f..c43ec0e97c8309 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -20,6 +20,11 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) const char *prefix = NULL; unsigned char sha1[20]; const char *me = "git-write-tree"; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option write_tree_options[] = { OPT_BIT(0, "missing-ok", &flags, "allow missing objects", WRITE_TREE_MISSING_OK), @@ -33,6 +38,10 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, unused_prefix, write_tree_options, write_tree_usage, 0); diff --git a/daemon.c b/daemon.c index 4c8346d5a1fe13..af031aa13112ba 100644 --- a/daemon.c +++ b/daemon.c @@ -660,10 +660,18 @@ static void check_dead_children(void) static char **cld_argv; static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process cld = { NULL }; char addrbuf[300] = "REMOTE_ADDR=", portbuf[300]; char *env[] = { addrbuf, portbuf, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (max_connections && live_children >= max_connections) { kill_some_child(); sleep(1); /* give it some time to die */ diff --git a/editor.c b/editor.c index d8340031d24828..8dbbb5eeac1fe4 100644 --- a/editor.c +++ b/editor.c @@ -36,8 +36,17 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en return error("Terminal is dumb, but EDITOR unset"); if (strcmp(editor, ":")) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *args[] = { editor, path, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (run_command_v_opt_cd_env(args, RUN_USING_SHELL, NULL, env)) return error("There was a problem with the editor '%s'.", editor); diff --git a/imap-send.c b/imap-send.c index e1ad1a48ce3b8b..3bb86ec316653f 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1068,9 +1068,18 @@ static struct store *imap_open_store(struct imap_server_conf *srvc) /* open connection to IMAP server */ if (srvc->tunnel) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { srvc->tunnel, NULL }; struct child_process tunnel = {NULL}; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + imap_info("Starting tunnel '%s'... ", srvc->tunnel); tunnel.argv = argv; diff --git a/sha1_file.c b/sha1_file.c index 064a33040812ba..7ffe31adbc62c3 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2674,6 +2674,10 @@ static int index_stream(unsigned char *sha1, int fd, size_t size, enum object_type type, const char *path, unsigned flags) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process fast_import; char export_marks[512]; const char *argv[] = { "fast-import", "--quiet", export_marks, NULL }; @@ -2682,6 +2686,10 @@ static int index_stream(unsigned char *sha1, int fd, size_t size, char buf[512]; int len, tmpfd; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + strcpy(tmpfile, git_path("hashstream_XXXXXX")); tmpfd = git_mkstemp_mode(tmpfile, 0600); if (tmpfd < 0) diff --git a/submodule.c b/submodule.c index b6dec70bd1a6b3..df6eb2f6e3a5eb 100644 --- a/submodule.c +++ b/submodule.c @@ -577,12 +577,20 @@ static int find_first_merges(struct object_array *result, const char *path, struct commit *commit; int contains_another; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + char merged_revision[42]; const char *rev_args[] = { "rev-list", "--merges", "--ancestry-path", "--all", merged_revision, NULL }; struct rev_info revs; struct setup_revision_opt rev_opts; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&merges, 0, sizeof(merges)); memset(result, 0, sizeof(struct object_array)); memset(&rev_opts, 0, sizeof(rev_opts)); From 436f4a94e87237e42cf32cbc73a0b4ecb37f31f7 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 21:12:18 -0700 Subject: [PATCH 031/211] Add sha1-array.c --- A-line.confd/Source.list | 1 + 1 file changed, 1 insertion(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 1dbbeb828e60a8..bfe0466276bd29 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -193,6 +193,7 @@ revision.c run-command.c server-info.c setup.c +sha1-array.c sha1-lookup.c sha1_file.c sha1_name.c From 44005cdb2dcb5481ce56782fa376036aaf848ab9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 21:09:13 -0700 Subject: [PATCH 032/211] Remove unrequired const in builtin_diff_combined() Metrowerks C 2.4.1 mistakes inner const for outer const and won't permit the implicit cast to void*. --- builtin/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/diff.c b/builtin/diff.c index 945e7583a8294f..ee6319805f25c0 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -169,7 +169,7 @@ static int builtin_diff_combined(struct rev_info *revs, struct object_array_entry *ent, int ents) { - const unsigned char (*parent)[20]; + unsigned char (*parent)[20]; int i; if (argc > 1) From 15f50040bf7ce13d78282988210923d5be05d7d2 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 22:16:01 -0700 Subject: [PATCH 033/211] Update GIT_VERSION to 1.7.6.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index cdedb71830c787..2ad64aaaa02b04 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.6" +#define GIT_VERSION "1.7.6.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 96dc88e7751ec92b92bdb7c82a12164ef7b391db Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 22:18:30 -0700 Subject: [PATCH 034/211] Update GIT_VERSION to 1.7.6.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 2ad64aaaa02b04..5307eaf316524c 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.6.1" +#define GIT_VERSION "1.7.6.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 409f41097c29b98a07b6eba86f7d5fdacfe5911f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 22:32:08 -0700 Subject: [PATCH 035/211] Update GIT_VERSION to 1.7.6.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 5307eaf316524c..bfbdf4aa0e9e23 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.6.2" +#define GIT_VERSION "1.7.6.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 0748c14a0cce30fa1bfef0c8a6d1aba6fc251c74 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 22:37:11 -0700 Subject: [PATCH 036/211] Update GIT_VERSION to 1.7.6.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index bfbdf4aa0e9e23..12ccd4587a6ea2 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.6.3" +#define GIT_VERSION "1.7.6.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From e72f872fd51f97306aabbc37f772bf6d74a36548 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 Aug 2012 22:39:39 -0700 Subject: [PATCH 037/211] Update GIT_VERSION to 1.7.6.5 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 12ccd4587a6ea2..9ea914d0df50a0 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.6.4" +#define GIT_VERSION "1.7.6.5" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From cbca0be286d4d18b68f2f21decb01abe610cd59d Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 6 May 2013 23:33:28 -0700 Subject: [PATCH 038/211] Define NO_MMAP for the smaller packed window size --- A-line.confd/Source.list | 1 + compat/relix.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index bfe0466276bd29..4891908d1d3314 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -114,6 +114,7 @@ compat/fnmatch/fnmatch.c compat/inet_ntop.c compat/inet_pton.c compat/memmem.c +compat/mmap.c compat/strcasestr.c config.c connect.c diff --git a/compat/relix.h b/compat/relix.h index 9ea914d0df50a0..1037d9c8066374 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -16,6 +16,9 @@ // Enable #pragma cplusplus over dynamic aggregate initializers. #define USE_CPLUSPLUS_FOR_INIT 1 +// MacRelix has mmap(), but we want the small window size +#define NO_MMAP 1 + #define NO_CURL 1 #define NO_EXPAT 1 #define NO_ICONV 1 From d21d07b073083134626ba48a4f6a85ed90ed15fa Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 6 Nov 2014 06:03:00 -0800 Subject: [PATCH 039/211] Source.list: Axe conflicting compat/inet_ntop.c MacRelix's libc provides this now. --- A-line.confd/Source.list | 1 - 1 file changed, 1 deletion(-) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 4891908d1d3314..1893c957bf1132 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -111,7 +111,6 @@ combine-diff.c commit.c compat/basename.c compat/fnmatch/fnmatch.c -compat/inet_ntop.c compat/inet_pton.c compat/memmem.c compat/mmap.c From 906e10e4610b8624839bce58fe2609f197fc4699 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 18 Jun 2021 17:23:18 -0400 Subject: [PATCH 040/211] Exit without global destruction in start_command() The environ storage is shared between parent and child of reexec() -- so it's critical not to destroy it in the child. This fixes a crash due to memory corruption when using a git alias in MacRelix that only showed up after modifying the environ storage to refrain from throwing exceptions. --- run-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-command.c b/run-command.c index 7c1bb785e0fa73..ac62487ef35a9e 100644 --- a/run-command.c +++ b/run-command.c @@ -289,7 +289,7 @@ int start_command(struct child_process *cmd) if (!cmd->silent_exec_failure) error("cannot run %s: %s", cmd->argv[0], strerror(ENOENT)); - exit(127); + _exit(127); } else { die_errno("cannot exec '%s'", cmd->argv[0]); } From 7ecd4373d4020df2c01a7ca1b8a35b84d1348a94 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 30 Jan 2023 03:04:32 -0500 Subject: [PATCH 041/211] Update GIT_VERSION to 1.7.6.6 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 9ea914d0df50a0..5c7347d7d68077 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.6.5" +#define GIT_VERSION "1.7.6.6" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 58517715eaa811bfb2e863fb024d07f5f6626eef Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 30 Jan 2023 05:01:09 -0500 Subject: [PATCH 042/211] fast-import: Silence uninited variable warning --- fast-import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast-import.c b/fast-import.c index 0b28b82034072d..2935f549affd66 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2804,7 +2804,7 @@ static void cat_blob(struct object_entry *oe, unsigned char sha1[20]) static void parse_cat_blob(void) { const char *p; - struct object_entry *oe = oe; + struct object_entry *oe; unsigned char sha1[20]; /* cat-blob SP LF */ From ebf7344e7b69fe325cca3850e0c49eab001713f0 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 17 Nov 2023 01:51:43 -0500 Subject: [PATCH 043/211] Update GIT_VERSION to 1.7.7.7 --- compat/relix.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compat/relix.h b/compat/relix.h index cc9a9b818a3562..1c98dce990a024 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.6.6" +#define GIT_VERSION "1.7.7.7" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) @@ -48,4 +48,3 @@ #define gitstrcasestr strcasestr extern int reexec( void* f, ... ); - From d813f7b7d46daaeaea67c2df5674e7b3cd2fee4f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 17 Nov 2023 01:37:53 -0500 Subject: [PATCH 044/211] Source.list: Add new v1.7.7 source files --- A-line.confd/Source.list | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 1893c957bf1132..a5c74554c18156 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -5,6 +5,7 @@ alloc.c archive-tar.c archive-zip.c archive.c +argv-array.c attr.c base85.c bisect.c @@ -114,6 +115,7 @@ compat/fnmatch/fnmatch.c compat/inet_pton.c compat/memmem.c compat/mmap.c +compat/obstack.c compat/strcasestr.c config.c connect.c @@ -153,6 +155,7 @@ http-backend.c #http.c ident.c imap-send.c +kwset.c levenshtein.c list-objects.c ll-merge.c @@ -173,6 +176,7 @@ pack-revindex.c pack-write.c pager.c parse-options.c +parse-options-cb.c patch-delta.c patch-ids.c path.c @@ -203,6 +207,7 @@ show-index.c sideband.c sigchain.c strbuf.c +streaming.c string-list.c submodule.c symlinks.c @@ -240,6 +245,7 @@ ws.c wt-status.c xdiff/xdiffi.c xdiff/xemit.c +xdiff/xhistogram.c xdiff/xmerge.c xdiff/xpatience.c xdiff/xprepare.c From 56aa25b0ca2f9a4195a1cdc3a64869e9745e3749 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 17 Nov 2023 01:09:51 -0500 Subject: [PATCH 045/211] block-sha1/sha1.h: Add missing include guard --- block-sha1/sha1.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block-sha1/sha1.h b/block-sha1/sha1.h index b864df623e3b89..bf466528a2100e 100644 --- a/block-sha1/sha1.h +++ b/block-sha1/sha1.h @@ -1,3 +1,6 @@ +#ifndef BLOCKSHA1_SHA1_H +#define BLOCKSHA1_SHA1_H + /* * SHA1 routine optimized to do word accesses rather than byte accesses, * and to avoid unnecessary copies into the context array. @@ -20,3 +23,5 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx); #define git_SHA1_Init blk_SHA1_Init #define git_SHA1_Update blk_SHA1_Update #define git_SHA1_Final blk_SHA1_Final + +#endif From 980323dabc139cf573557521d8eddef1d978b3e1 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 17 Nov 2023 01:00:29 -0500 Subject: [PATCH 046/211] Use C++ to initialize aggregates to dynamic values --- bisect.c | 8 ++++++++ builtin/checkout.c | 8 ++++++++ run-command.c | 8 ++++++++ submodule.c | 8 ++++++++ transport-helper.c | 9 +++++++++ 5 files changed, 41 insertions(+) diff --git a/bisect.c b/bisect.c index de05bf82462032..d0c83d12edf26d 100644 --- a/bisect.c +++ b/bisect.c @@ -597,9 +597,17 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix, const char *bad_format, const char *good_format, int read_paths) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct argv_array rev_argv = ARGV_ARRAY_INIT; int i; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + init_revisions(revs, prefix); revs->abbrev = 0; revs->commit_format = CMIT_FMT_UNSPECIFIED; diff --git a/builtin/checkout.c b/builtin/checkout.c index 8a70945fc2f8a1..8b421370e14158 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -678,9 +678,17 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs) */ static void orphaned_commit_warning(struct commit *commit) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct argv_array args = ARGV_ARRAY_INIT; struct rev_info revs; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argv_array_push(&args, "(internal)"); argv_array_push(&args, sha1_to_hex(commit->object.sha1)); argv_array_push(&args, "--not"); diff --git a/run-command.c b/run-command.c index c40904f1015570..ff4030f470ed62 100644 --- a/run-command.c +++ b/run-command.c @@ -620,6 +620,10 @@ int finish_async(struct async *async) int run_hook(const char *index_file, const char *name, ...) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process hook; struct argv_array argv = ARGV_ARRAY_INIT; const char *p, *env[2]; @@ -627,6 +631,10 @@ int run_hook(const char *index_file, const char *name, ...) va_list args; int ret; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (access(git_path("hooks/%s", name), X_OK) < 0) return 0; diff --git a/submodule.c b/submodule.c index 47ade1867e0474..36db59e0bc01d7 100644 --- a/submodule.c +++ b/submodule.c @@ -507,10 +507,18 @@ static void add_sha1_to_argv(const unsigned char sha1[20], void *data) static void calculate_changed_submodule_paths(void) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct rev_info rev; struct commit *commit; struct argv_array argv = ARGV_ARRAY_INIT; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* No need to check if there are no submodules configured */ if (!config_name_for_path.nr) return; diff --git a/transport-helper.c b/transport-helper.c index a591b0dd3676c3..02a8382cf97452 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -108,11 +108,20 @@ static struct child_process *get_helper(struct transport *transport) int duped; int code; char git_dir_buf[sizeof(GIT_DIR_ENVIRONMENT) + PATH_MAX + 1]; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *helper_env[] = { git_dir_buf, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (data->helper) return data->helper; From 5c99e9d1f5f7182ee6415e8626a162fdcb99a99b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 18 Nov 2023 01:30:08 -0500 Subject: [PATCH 047/211] Update GIT_VERSION to 1.7.8.6 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 1c98dce990a024..cf7d3b08a80939 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.7.7" +#define GIT_VERSION "1.7.8.6" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 32e3a15c783ff9fccdbedd46cf0f623f442dd901 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 18 Nov 2023 01:38:33 -0500 Subject: [PATCH 048/211] Source.list: Add new v1.7.8 source files --- A-line.confd/Source.list | 2 ++ 1 file changed, 2 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index a5c74554c18156..cb90a89b8607fc 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -119,6 +119,7 @@ compat/obstack.c compat/strcasestr.c config.c connect.c +connected.c convert.c copy.c csum-file.c @@ -195,6 +196,7 @@ rerere.c resolve-undo.c revision.c run-command.c +sequencer.c server-info.c setup.c sha1-array.c From 46cd354524e095777ba6aab017dbc3f5a2e2f871 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 18 Nov 2023 01:32:30 -0500 Subject: [PATCH 049/211] Use C++ to initialize aggregates to dynamic values --- builtin/revert.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/revert.c b/builtin/revert.c index b75e7160c026d9..d126ff934fde9a 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -165,10 +165,6 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), }; -#ifdef USE_CPLUSPLUS_FOR_INIT -#pragma cplusplus reset -#endif - if (opts->action == CHERRY_PICK) { struct option cp_extra[] = { OPT_BOOLEAN('x', NULL, &opts->record_origin, "append commit name"), @@ -179,6 +175,10 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) die(_("program error")); } +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, usage_str, PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN); From 016afaa1d3c4081436ec379c84c3382413fa7cad Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 18 Nov 2023 01:35:25 -0500 Subject: [PATCH 050/211] Revert "revert: Use raw message if no reencoding occurs" This change was invalidated by 708f9d96d95be7e9912eea8350fdf3f04484695f. This reverts commit 8c8975cc0bf74b15a3d6a18f804e76a1889a125d. --- builtin/revert.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/builtin/revert.c b/builtin/revert.c index d126ff934fde9a..9424dcd79dfecc 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -276,8 +276,6 @@ static int get_message(struct commit *commit, struct commit_message *out) git_commit_encoding, encoding); if (out->reencoded_message) out->message = out->reencoded_message; - else - out->message = raw_message; abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV); abbrev_len = strlen(abbrev); From c666948989f10ac84c302e862c0398c8867b0bcf Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 04:07:29 -0500 Subject: [PATCH 051/211] Silence warning when setsockopt() yields ENOSYS --- connect.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connect.c b/connect.c index 1919581ba1a068..4849b0ce1766e3 100644 --- a/connect.c +++ b/connect.c @@ -159,6 +159,9 @@ static void enable_keepalive(int sockfd) int ka = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) + #ifdef __RELIX__ + if (errno != ENOSYS) + #endif fprintf(stderr, "unable to set SO_KEEPALIVE on socket: %s\n", strerror(errno)); } From f7dbc387446c99721917b856207300f831ae1585 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 04:58:43 -0500 Subject: [PATCH 052/211] Update GIT_VERSION to 1.7.9.7 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index cf7d3b08a80939..a16900a6a0a250 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.8.6" +#define GIT_VERSION "1.7.9.7" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 4cb630ddec5d31146fee10edf9216677ee877d04 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 05:03:11 -0500 Subject: [PATCH 053/211] Define NO_GETTEXT for MacRelix --- compat/relix.h | 1 + 1 file changed, 1 insertion(+) diff --git a/compat/relix.h b/compat/relix.h index a16900a6a0a250..ffdd337bdad644 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -21,6 +21,7 @@ #define NO_CURL 1 #define NO_EXPAT 1 +#define NO_GETTEXT 1 #define NO_ICONV 1 #define NO_IPV6 1 #define NO_NSEC 1 From 5c2cff7e9a9ac873fe53028ba4c14632bd96b9ca Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 05:19:32 -0500 Subject: [PATCH 054/211] Source.list: Add new v1.7.9 source files --- A-line.confd/Source.list | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index cb90a89b8607fc..65c3ac0d802600 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -104,6 +104,7 @@ builtin/var.c builtin/verify-pack.c builtin/verify-tag.c builtin/write-tree.c +bulk-checkin.c bundle.c cache-tree.c check-racy.c @@ -117,6 +118,7 @@ compat/memmem.c compat/mmap.c compat/obstack.c compat/strcasestr.c +compat/terminal.c config.c connect.c connected.c @@ -144,6 +146,7 @@ exec_cmd.c fast-import.c fsck.c git.c +gpg-interface.c graph.c grep.c hash.c @@ -185,6 +188,7 @@ pkt-line.c preload-index.c pretty.c progress.c +prompt.c quote.c reachable.c read-cache.c From 52641ffce5c04a5013bf7bd764a267f052599d69 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 05:11:13 -0500 Subject: [PATCH 055/211] Use C++ to initialize aggregates to dynamic values --- builtin/upload-archive.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index b928beb8ed51c9..c8def2dda2457f 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -94,8 +94,16 @@ static ssize_t process_input(int child_fd, int band) int cmd_upload_archive(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process writer = { argv }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* * Set up sideband subprocess. * From 588295e7d0f53fc3c25ae08544c6cf828e253b07 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 05:09:00 -0500 Subject: [PATCH 056/211] Explicitly return after calling noreturn functions --- grep.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grep.c b/grep.c index f492d267cc157d..b2f94351005308 100644 --- a/grep.c +++ b/grep.c @@ -1337,6 +1337,9 @@ int grep_source_load(struct grep_source *gs) return gs->buf ? 0 : -1; } die("BUG: invalid grep_source type"); + + /* Not reached */ + return 0; } void grep_source_load_driver(struct grep_source *gs) From e724f6a7492636578bb990009f891a107aa8bdd4 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 06:08:50 -0500 Subject: [PATCH 057/211] Dynamically allocate large buffers --- bulk-checkin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bulk-checkin.c b/bulk-checkin.c index 6b0b6d490440cc..7bda9042e6ad1f 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -96,12 +96,15 @@ static int stream_to_pack(struct bulk_checkin_state *state, const char *path, unsigned flags) { git_zstream s; - unsigned char obuf[16384]; + unsigned char* obuf = malloc(16384 * 2); unsigned hdrlen; int status = Z_OK; int write_object = (flags & HASH_WRITE_OBJECT); off_t offset = 0; + if (!obuf) + die("*** out of memory ***"); + memset(&s, 0, sizeof(s)); git_deflate_init(&s, pack_compression_level); @@ -110,7 +113,7 @@ static int stream_to_pack(struct bulk_checkin_state *state, s.avail_out = sizeof(obuf) - hdrlen; while (status != Z_STREAM_END) { - unsigned char ibuf[16384]; + unsigned char* ibuf = obuf + 16384; if (size && !s.avail_in) { ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf); @@ -162,6 +165,7 @@ static int stream_to_pack(struct bulk_checkin_state *state, } } git_deflate_end(&s); + free(obuf); return 0; } From 38060077bd08f58ca04ee4cb4155e6187fae6204 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 30 Nov 2023 13:15:42 -0500 Subject: [PATCH 058/211] Request dlmalloc by its new, underscoreless name --- A-line.confd/git.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A-line.confd/git.conf b/A-line.confd/git.conf index d690ac9564a955..49a0588cd8829a 100644 --- a/A-line.confd/git.conf +++ b/A-line.confd/git.conf @@ -5,7 +5,7 @@ product toolkit use zlib use POSIX -use __dlmalloc +use dlmalloc? use poll_compat precompile cache.h From fff3281475c5e8f2f89b1f4d4c171918cb32adaa Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 30 Nov 2023 09:01:59 -0500 Subject: [PATCH 059/211] Update GIT_VERSION to 1.7.10.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index ffdd337bdad644..aaca9afb7eaac8 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.9.7" +#define GIT_VERSION "1.7.10.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From d74e62ee1df526ba88fde7004ab2780a912f5e96 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 15 Dec 2023 03:30:21 -0500 Subject: [PATCH 060/211] Use C++ to initialize aggregates to dynamic values --- builtin/pack-objects.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 7b07c092cc5550..4bda62804925b9 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2334,6 +2334,10 @@ static int option_parse_ulong(const struct option *opt, int cmd_pack_objects(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int use_internal_rev_list = 0; int thin = 0; int all_progress_implied = 0; @@ -2405,6 +2409,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + read_replace_refs = 0; reset_pack_idx_option(&pack_idx_opts); From 46c3460eb5f9253752ba6a762b16eee14e920e53 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 15 Dec 2023 17:17:32 -0500 Subject: [PATCH 061/211] Update GIT_VERSION to 1.7.10.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index aaca9afb7eaac8..ee99cc168f398a 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.10.1" +#define GIT_VERSION "1.7.10.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 4752e57adb0e61c1a3408271bc8d47a9bd61a8cc Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 20 Dec 2023 23:35:57 -0500 Subject: [PATCH 062/211] Avoid broken PPC optimization of collect_parents() Added in b5d887f90692515a6e9c99e7683533d12df3ade2, the collect_parents() function is miscompiled by Metrowerks C++ 2.4.1 at an optimization level of 2 or above. The optimizer fails to recognize that remoteheads (which is on the stack) can be changed by the call to commit_list_insert(), due to its address being stored in remotes (which is passed as an argument), and returns NULL (the initial value of remoteheads) instead of the value it actually has by that point. This led to unchecked NULL dereferences. Included in e78cbf8cbb61edfbdef5d33262f9b8cf02a3afca are patches for the NULL dereferences, but the underlying problem persists, yielding another issue: A simple fast-forward merge always reports "Already up-to-date." --- builtin/merge.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/merge.c b/builtin/merge.c index 470fc57c5d6cea..035a40756966ad 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1130,6 +1130,10 @@ static int default_edit_option(void) st_stdin.st_mode == st_stdout.st_mode); } +#if defined(__MWERKS__) && defined(__POWERPC__) +#pragma optimization_level 1 +#endif + static struct commit_list *collect_parents(struct commit *head_commit, int *head_subsumed, int argc, const char **argv) @@ -1164,6 +1168,10 @@ static struct commit_list *collect_parents(struct commit *head_commit, return remoteheads; } +#if defined(__MWERKS__) && defined(__POWERPC__) +#pragma optimization_level reset +#endif + int cmd_merge(int argc, const char **argv, const char *prefix) { unsigned char result_tree[20]; From ab3a657864138a62dc515d43d2d9ca2e2245bdcc Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 19 Dec 2023 22:59:50 -0500 Subject: [PATCH 063/211] Update GIT_VERSION to 1.7.10.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index ee99cc168f398a..384b64b3d3c1b8 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.10.2" +#define GIT_VERSION "1.7.10.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From f402020a45cbcfea9b7eed994ab0c53f38d2b60f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 23 Dec 2023 01:11:15 -0500 Subject: [PATCH 064/211] Update GIT_VERSION to 1.7.10.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 384b64b3d3c1b8..a30371e0ff261c 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.10.3" +#define GIT_VERSION "1.7.10.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 8f67f1eba1dea4837bb1eee79b6a831e61fe4630 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 27 Dec 2023 08:37:42 -0500 Subject: [PATCH 065/211] Update GIT_VERSION to 1.7.10.5 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index a30371e0ff261c..17c8132bb8844a 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.10.4" +#define GIT_VERSION "1.7.10.5" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From c5702058d3b6d245f47206545f7e090f7f62fb3d Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 31 Dec 2023 07:54:23 -0500 Subject: [PATCH 066/211] Update GIT_VERSION to 1.7.11 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 17c8132bb8844a..3cad1d473a1606 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.10.5" +#define GIT_VERSION "1.7.11" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 7561b5bdbc048a1c985f14d2c0064056c47ef30f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 20 Dec 2023 01:47:47 -0500 Subject: [PATCH 067/211] Source.list: Add new v1.7.11 source files --- A-line.confd/Source.list | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 65c3ac0d802600..6bf152d35035cd 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -27,6 +27,7 @@ builtin/checkout-index.c builtin/checkout.c builtin/clean.c builtin/clone.c +builtin/column.c builtin/commit-tree.c builtin/commit.c builtin/config.c @@ -109,6 +110,7 @@ bundle.c cache-tree.c check-racy.c color.c +column.c combine-diff.c commit.c compat/basename.c @@ -169,6 +171,7 @@ mailmap.c match-trees.c merge-file.c merge-recursive.c +mergesort.c name-hash.c notes.c notes-cache.c @@ -244,6 +247,7 @@ url.c usage.c userdiff.c utf8.c +varint.c walker.c wrapper.c write_or_die.c From 6aef1d85761b50e368df160a880877c22888d636 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 20 Dec 2023 01:39:14 -0500 Subject: [PATCH 068/211] Explicitly return after calling noreturn functions --- builtin/push.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/push.c b/builtin/push.c index 8c4db5cb5d4d23..ec91d50c61da91 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -111,6 +111,9 @@ static NORETURN int die_push_simple(struct branch *branch, struct remote *remote "%s"), remote->name, short_upstream, remote->name, branch->name, advice_maybe); + + /* Not reached */ + return 0; } static void setup_push_upstream(struct remote *remote, int simple) From 88235ae50639bceb5ef83ec6e38f835220c68b04 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 20 Dec 2023 01:54:35 -0500 Subject: [PATCH 069/211] Use C++ to initialize aggregates to dynamic values --- builtin/column.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/column.c b/builtin/column.c index 5ea798a7ca6a3a..6f5db1fa32d414 100644 --- a/builtin/column.c +++ b/builtin/column.c @@ -18,6 +18,10 @@ static int column_config(const char *var, const char *value, void *cb) int cmd_column(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct string_list list = STRING_LIST_INIT_DUP; struct strbuf sb = STRBUF_INIT; struct column_options copts; @@ -33,6 +37,10 @@ int cmd_column(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* This one is special and must be the first one */ if (argc > 1 && !prefixcmp(argv[1], "--command=")) { command = argv[1] + 10; From d82a133483469b4f0fb7eef370e1dfc1d4f080b6 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 31 Dec 2023 09:15:37 -0500 Subject: [PATCH 070/211] Reduce STREAM_BUFFER_SIZE to avoid stack overflow --- archive-zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archive-zip.c b/archive-zip.c index f5af81f904df08..5cc0f085e93645 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -164,7 +164,7 @@ static void set_zip_header_data_desc(struct zip_local_header *header, copy_le32(header->size, size); } -#define STREAM_BUFFER_SIZE (1024 * 16) +#define STREAM_BUFFER_SIZE (1024 * 4) static int write_zip_entry(struct archiver_args *args, const unsigned char *sha1, From 2c82b7d44ae001c15731926dfc8935f2eb630813 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 5 Jan 2024 14:19:39 -0500 Subject: [PATCH 071/211] Update GIT_VERSION to 1.7.11.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 3cad1d473a1606..fd3a3fad402dea 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11" +#define GIT_VERSION "1.7.11.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 662f0141b5b97b8f2cc6870f240cb40e236792d2 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 5 Jan 2024 14:26:53 -0500 Subject: [PATCH 072/211] Update GIT_VERSION to 1.7.11.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index fd3a3fad402dea..05b162e18e6b43 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11.1" +#define GIT_VERSION "1.7.11.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 15458b2037b6ff4cc61d6d77458a94320995ad11 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 6 Jan 2024 10:49:55 -0500 Subject: [PATCH 073/211] Update GIT_VERSION to 1.7.11.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 05b162e18e6b43..55e49b5c56a8ff 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11.2" +#define GIT_VERSION "1.7.11.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 4213ef6cc3e4447a6bf4528d996f03baf25c7570 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Jan 2024 14:10:01 -0500 Subject: [PATCH 074/211] Update GIT_VERSION to 1.7.11.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 55e49b5c56a8ff..8b90a8c7e02060 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11.3" +#define GIT_VERSION "1.7.11.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From de21914d99952553855939275022b06e7ec166c9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 30 Mar 2024 02:20:28 -0400 Subject: [PATCH 075/211] Update GIT_VERSION to 1.7.11.5 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 8b90a8c7e02060..41afd4fcc98d68 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11.4" +#define GIT_VERSION "1.7.11.5" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From df7b32d91b30e431a448cd9070a04a5c7cf6b226 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 2 Apr 2024 01:52:18 -0400 Subject: [PATCH 076/211] Update GIT_VERSION to 1.7.11.6 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 41afd4fcc98d68..9583bf4c3e5555 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11.5" +#define GIT_VERSION "1.7.11.6" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From b6a13bb065359d709307adfee491c49dd0f9201c Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 2 Apr 2024 23:09:17 -0400 Subject: [PATCH 077/211] Update GIT_VERSION to 1.7.11.7 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 9583bf4c3e5555..8bef59edeb8f0b 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11.6" +#define GIT_VERSION "1.7.11.7" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 2f6f2b19156e6a7236528ca1fd3746ee49b07199 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 04:49:03 -0400 Subject: [PATCH 078/211] Update GIT_VERSION to 1.7.12.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 8bef59edeb8f0b..5521ac6ce820d6 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.11.7" +#define GIT_VERSION "1.7.12.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From ec2178f79771a0cd89901fa88bb161967e8e51a1 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 05:12:09 -0400 Subject: [PATCH 079/211] Define GIT_USER_AGENT in terms of GIT_VERSION --- version.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/version.c b/version.c index 6106a8098c8a46..6671c9d6c68e02 100644 --- a/version.c +++ b/version.c @@ -2,6 +2,8 @@ #include "version.h" #include "strbuf.h" +#define GIT_USER_AGENT "git/" GIT_VERSION + const char git_version_string[] = GIT_VERSION; const char *git_user_agent(void) From 5e592c81f373f8d5409e01e3ac9fbb74a09b8eef Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 05:00:17 -0400 Subject: [PATCH 080/211] Guard against use of getrlimit() and sysconf() --- sha1_file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index 9152974642986d..1fe453e69ce452 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -731,6 +731,11 @@ void free_pack_by_name(const char *pack_name) } } +#ifdef __RELIX__ +#undef RLIMIT_NOFILE +#undef _SC_OPEN_MAX +#endif + static unsigned int get_max_fd_limit(void) { #ifdef RLIMIT_NOFILE From f8e9d325d67542d361410691b88cb4ad272b3d13 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 06:17:03 -0400 Subject: [PATCH 081/211] Use smaller buffers in write_large_blob_data() --- builtin/pack-objects.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c21d79986cd63d..544fa212319645 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -19,6 +19,12 @@ #include "streaming.h" #include "thread-utils.h" +#ifdef __RELIX__ +#define LARGE_BLOB_BUFFER_SIZE (1024 * 4) +#else +#define LARGE_BLOB_BUFFER_SIZE (1024 * 16) +#endif + static const char *pack_usage[] = { "git pack-objects --stdout [options...] [< ref-list | < object-list]", "git pack-objects [options...] base-name [< ref-list | < object-list]", @@ -155,8 +161,8 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct sha1fi const unsigned char *sha1) { git_zstream stream; - unsigned char ibuf[1024 * 16]; - unsigned char obuf[1024 * 16]; + unsigned char ibuf[LARGE_BLOB_BUFFER_SIZE]; + unsigned char obuf[LARGE_BLOB_BUFFER_SIZE]; unsigned long olen = 0; memset(&stream, 0, sizeof(stream)); From 850965d40c85c9c80f41f61adcddebede7dd5f68 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 05:03:13 -0400 Subject: [PATCH 082/211] Source.list: Add new v1.7.12.1 source files --- A-line.confd/Source.list | 3 +++ 1 file changed, 3 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 6bf152d35035cd..e8067b08f2ff98 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -32,6 +32,7 @@ builtin/commit-tree.c builtin/commit.c builtin/config.c builtin/count-objects.c +builtin/credential.c builtin/describe.c builtin/diff-files.c builtin/diff-index.c @@ -126,6 +127,7 @@ connect.c connected.c convert.c copy.c +credential.c csum-file.c ctype.c daemon.c @@ -248,6 +250,7 @@ usage.c userdiff.c utf8.c varint.c +version.c walker.c wrapper.c write_or_die.c From 9a16b4165e2b6d4100bfa768ad7592fae5f23c8b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 17:45:52 -0400 Subject: [PATCH 083/211] Update GIT_VERSION to 1.7.12.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 5521ac6ce820d6..af2dc3d37567bf 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.12.1" +#define GIT_VERSION "1.7.12.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 37ef3f2afaba30ef2b811bd353b072ee72fb2197 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 19:37:12 -0400 Subject: [PATCH 084/211] Update GIT_VERSION to 1.7.12.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index af2dc3d37567bf..d76fa1a2f4314d 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.12.2" +#define GIT_VERSION "1.7.12.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 5c9b91b902a52c519c528ab00afd42e2a88f3bb4 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 5 Apr 2024 22:08:08 -0400 Subject: [PATCH 085/211] Update GIT_VERSION to 1.7.12.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index d76fa1a2f4314d..8a5c5f120cdf7c 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.7.12.3" +#define GIT_VERSION "1.7.12.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 7641256a6fb1ac3342f16a3db7d6cf378fb70afb Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 10 Apr 2024 02:32:47 -0400 Subject: [PATCH 086/211] Cast to (intptr_t) by way of (char*) Required for Metrowerks C 2.4.1. --- builtin/gc.c | 2 +- builtin/grep.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 6be6c8d65b26c9..84beb72479871d 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -177,7 +177,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) OPT__QUIET(&quiet, N_("suppress progress reporting")), { OPTION_STRING, 0, "prune", &prune_expire, N_("date"), N_("prune unreferenced objects"), - PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire }, + PARSE_OPT_OPTARG, NULL, (intptr_t)(char*)prune_expire }, OPT_BOOLEAN(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")), OPT_BOOLEAN(0, "auto", &auto_gc, N_("enable auto-gc mode")), OPT_END() diff --git a/builtin/grep.c b/builtin/grep.c index 82530a61b48373..dd9b4b9ef6e82f 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -824,7 +824,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_GROUP(""), { OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager, N_("pager"), N_("show matching files in the pager"), - PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager }, + PARSE_OPT_OPTARG, NULL, (intptr_t)(char*)default_pager }, OPT_BOOLEAN(0, "ext-grep", &external_grep_allowed__ignored, N_("allow calling of grep(1) (ignored by this build)")), { OPTION_CALLBACK, 0, "help-all", &options, NULL, N_("show usage"), From 9c2e99ce6de56a836c45cb77745eaeaa2416684a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 17 Nov 2023 01:09:51 -0500 Subject: [PATCH 087/211] block-sha1/sha1.h: Add missing include guard --- block-sha1/sha1.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block-sha1/sha1.h b/block-sha1/sha1.h index b864df623e3b89..bf466528a2100e 100644 --- a/block-sha1/sha1.h +++ b/block-sha1/sha1.h @@ -1,3 +1,6 @@ +#ifndef BLOCKSHA1_SHA1_H +#define BLOCKSHA1_SHA1_H + /* * SHA1 routine optimized to do word accesses rather than byte accesses, * and to avoid unnecessary copies into the context array. @@ -20,3 +23,5 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx); #define git_SHA1_Init blk_SHA1_Init #define git_SHA1_Update blk_SHA1_Update #define git_SHA1_Final blk_SHA1_Final + +#endif From e1b31178d1fb199477f83d19c22ed834bcabdda0 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 04:07:29 -0500 Subject: [PATCH 088/211] Silence warning when setsockopt() yields ENOSYS --- connect.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connect.c b/connect.c index 49e56ba35a6453..358f75a0e8b198 100644 --- a/connect.c +++ b/connect.c @@ -218,6 +218,9 @@ static void enable_keepalive(int sockfd) int ka = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) + #ifdef __RELIX__ + if (errno != ENOSYS) + #endif fprintf(stderr, "unable to set SO_KEEPALIVE on socket: %s\n", strerror(errno)); } From 1dd01ea53ea4fd2109326217599f6ca85435cb6b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 05:00:17 -0400 Subject: [PATCH 089/211] Guard against use of getrlimit() and sysconf() --- sha1_file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index 9152974642986d..1fe453e69ce452 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -731,6 +731,11 @@ void free_pack_by_name(const char *pack_name) } } +#ifdef __RELIX__ +#undef RLIMIT_NOFILE +#undef _SC_OPEN_MAX +#endif + static unsigned int get_max_fd_limit(void) { #ifdef RLIMIT_NOFILE From da3d935dcd7cb6ab353ec3dfad4c41123ecbb433 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 31 Dec 2023 09:15:37 -0500 Subject: [PATCH 090/211] Reduce STREAM_BUFFER_SIZE to avoid stack overflow --- archive-zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archive-zip.c b/archive-zip.c index 55f66b4060c647..800fe477b34960 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -188,7 +188,7 @@ static int has_only_ascii(const char *s) } } -#define STREAM_BUFFER_SIZE (1024 * 16) +#define STREAM_BUFFER_SIZE (1024 * 4) static int write_zip_entry(struct archiver_args *args, const unsigned char *sha1, From 600d37588d4ace0af35c77e50400beb7ca1721df Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 06:17:03 -0400 Subject: [PATCH 091/211] Use smaller buffers in write_large_blob_data() --- builtin/pack-objects.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 5e140640947cd9..25f87cb838a316 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -19,6 +19,12 @@ #include "streaming.h" #include "thread-utils.h" +#ifdef __RELIX__ +#define LARGE_BLOB_BUFFER_SIZE (1024 * 4) +#else +#define LARGE_BLOB_BUFFER_SIZE (1024 * 16) +#endif + static const char *pack_usage[] = { N_("git pack-objects --stdout [options...] [< ref-list | < object-list]"), N_("git pack-objects [options...] base-name [< ref-list | < object-list]"), @@ -155,8 +161,8 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct sha1fi const unsigned char *sha1) { git_zstream stream; - unsigned char ibuf[1024 * 16]; - unsigned char obuf[1024 * 16]; + unsigned char ibuf[LARGE_BLOB_BUFFER_SIZE]; + unsigned char obuf[LARGE_BLOB_BUFFER_SIZE]; unsigned long olen = 0; memset(&stream, 0, sizeof(stream)); From e9a0d1767cc3a2e9af3d66680b5a9f7b5e9b6a2f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 20 Dec 2023 23:35:57 -0500 Subject: [PATCH 092/211] Avoid broken PPC optimization of collect_parents() Added in b5d887f90692515a6e9c99e7683533d12df3ade2, the collect_parents() function is miscompiled by Metrowerks C++ 2.4.1 at an optimization level of 2 or above. The optimizer fails to recognize that remoteheads (which is on the stack) can be changed by the call to commit_list_insert(), due to its address being stored in remotes (which is passed as an argument), and returns NULL (the initial value of remoteheads) instead of the value it actually has by that point. This led to unchecked NULL dereferences. Included in e78cbf8cbb61edfbdef5d33262f9b8cf02a3afca are patches for the NULL dereferences, but the underlying problem persists, yielding another issue: A simple fast-forward merge always reports "Already up-to-date." --- builtin/merge.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/merge.c b/builtin/merge.c index 0ec8f0d449e505..c6459ca2a9b7be 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1129,6 +1129,10 @@ static int default_edit_option(void) st_stdin.st_mode == st_stdout.st_mode); } +#if defined(__MWERKS__) && defined(__POWERPC__) +#pragma optimization_level 1 +#endif + static struct commit_list *collect_parents(struct commit *head_commit, int *head_subsumed, int argc, const char **argv) @@ -1163,6 +1167,10 @@ static struct commit_list *collect_parents(struct commit *head_commit, return remoteheads; } +#if defined(__MWERKS__) && defined(__POWERPC__) +#pragma optimization_level reset +#endif + int cmd_merge(int argc, const char **argv, const char *prefix) { unsigned char result_tree[20]; From 8fdcea759758db1a49fc953e4d1b76a0eeb6057f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 06:08:50 -0500 Subject: [PATCH 093/211] Dynamically allocate large buffers --- bulk-checkin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bulk-checkin.c b/bulk-checkin.c index 6b0b6d490440cc..7bda9042e6ad1f 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -96,12 +96,15 @@ static int stream_to_pack(struct bulk_checkin_state *state, const char *path, unsigned flags) { git_zstream s; - unsigned char obuf[16384]; + unsigned char* obuf = malloc(16384 * 2); unsigned hdrlen; int status = Z_OK; int write_object = (flags & HASH_WRITE_OBJECT); off_t offset = 0; + if (!obuf) + die("*** out of memory ***"); + memset(&s, 0, sizeof(s)); git_deflate_init(&s, pack_compression_level); @@ -110,7 +113,7 @@ static int stream_to_pack(struct bulk_checkin_state *state, s.avail_out = sizeof(obuf) - hdrlen; while (status != Z_STREAM_END) { - unsigned char ibuf[16384]; + unsigned char* ibuf = obuf + 16384; if (size && !s.avail_in) { ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf); @@ -162,6 +165,7 @@ static int stream_to_pack(struct bulk_checkin_state *state, } } git_deflate_end(&s); + free(obuf); return 0; } From 2ea024b7a0f480582bd594e7ad4a2cf7a345afe7 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 2 Apr 2009 20:19:40 -0700 Subject: [PATCH 094/211] Add compat/relix.h to support MacRelix Include *before* defining macros of its functions, in case it's included later (which it is, in the case of fnmatch and xdiff). Define GIT_VERSION. Define a smaller LARGE_PACKET_MAX for MacRelix due to limited local data space on 68K. Define USE_CPLUSPLUS_FOR_INIT so #pragma cplusplus will be enabled during initialization of aggregates involving values computed at runtime. Add dummy definitions of GIT_{MAN,INFO,HTML}_PATH. Declare reexec(), which when called after vfork() spawns a lightweight process, which shares memory space with the parent but has its own file descriptor set (among other things). This substitutes for fork() in start_async(). --- compat/relix.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 compat/relix.h diff --git a/compat/relix.h b/compat/relix.h new file mode 100644 index 00000000000000..ab24a81ec6b79d --- /dev/null +++ b/compat/relix.h @@ -0,0 +1,52 @@ +/* + relix.h + ------- + + MacRelix support, by Josh Juran +*/ + +// Include early so git's macros don't interfere with it later +#include + +#define GIT_VERSION "1.8.0" + +// MacRelix has small thread stacks, and 68K has a hard 32K local data limit. +#define LARGE_PACKET_MAX (16384 - 16) + +// Enable #pragma cplusplus over dynamic aggregate initializers. +#define USE_CPLUSPLUS_FOR_INIT 1 + +#define NO_CURL 1 +#define NO_EXPAT 1 +#define NO_GETTEXT 1 +#define NO_ICONV 1 +#define NO_IPV6 1 +// MacRelix has mmap(), but we want the small window size +#define NO_MMAP 1 +#define NO_NSEC 1 +#define NO_OPENSSL 1 +#define NO_PTHREADS 1 +#define NO_LIBGEN_H 1 + +#define HAVE_STRING_H 1 + +#define SHA1_HEADER "block-sha1/sha1.h" + +#define ETC_GITCONFIG "/etc/gitconfig" + +#define ETC_GITATTRIBUTES "/etc/gitattributes" + +#define GIT_EXEC_PATH "/usr/lib/git-core" + +#define GIT_MAN_PATH "man" +#define GIT_INFO_PATH "info" +#define GIT_HTML_PATH "html" + +#define GIT_USER_AGENT "git/" GIT_VERSION + +#define PREFIX "/usr" + +#define gitmemmem memmem +#define gitstrcasestr strcasestr + +extern int reexec( void* f, ... ); From 9118c99930e092e0bec86f31b84a356e6de23359 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 2 Apr 2009 20:19:40 -0700 Subject: [PATCH 095/211] Include "compat/relix.h" targeting MacRelix --- git-compat-util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index 2fbf1fd8b14a57..6a878620998ef4 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -167,6 +167,9 @@ typedef unsigned long uintptr_t; #define _ALL_SOURCE 1 #endif #endif +#ifdef __RELIX__ +#include "compat/relix.h" +#endif /* used on Mac OS X */ #ifdef PRECOMPOSE_UNICODE From b18fdf3205aa9ee0d82472f78697e38bede44681 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 29 Nov 2009 04:14:12 -0800 Subject: [PATCH 096/211] Use C++ to initialize aggregates to dynamic values Metrowerks C won't initialize an aggregate with values undetermined at compile time, but Metrowerks C++ will, so use it instead. In some cases 'new' and 'delete' have to be defined to something else. --- archive.c | 17 ++++++++ bisect.c | 8 ++++ builtin/apply.c | 8 ++++ builtin/archive.c | 9 ++++ builtin/bisect--helper.c | 9 ++++ builtin/branch.c | 9 ++++ builtin/cat-file.c | 8 ++++ builtin/checkout-index.c | 9 ++++ builtin/checkout.c | 9 ++++ builtin/clean.c | 9 ++++ builtin/column.c | 8 ++++ builtin/count-objects.c | 9 ++++ builtin/describe.c | 9 ++++ builtin/fast-export.c | 9 ++++ builtin/fetch.c | 16 ++++++++ builtin/fmt-merge-msg.c | 9 ++++ builtin/for-each-ref.c | 8 ++++ builtin/gc.c | 8 ++++ builtin/grep.c | 8 ++++ builtin/init-db.c | 9 ++++ builtin/log.c | 24 +++++++++++ builtin/ls-files.c | 9 ++++ builtin/ls-tree.c | 8 ++++ builtin/merge-base.c | 8 ++++ builtin/merge-file.c | 9 ++++ builtin/merge-index.c | 8 ++++ builtin/mktree.c | 8 ++++ builtin/mv.c | 10 +++++ builtin/name-rev.c | 9 ++++ builtin/notes.c | 79 ++++++++++++++++++++++++++++++++++++ builtin/pack-objects.c | 8 ++++ builtin/pack-refs.c | 10 +++++ builtin/prune-packed.c | 8 ++++ builtin/push.c | 8 ++++ builtin/read-tree.c | 9 ++++ builtin/remote.c | 68 +++++++++++++++++++++++++++++++ builtin/replace.c | 9 ++++ builtin/rerere.c | 8 ++++ builtin/reset.c | 9 ++++ builtin/revert.c | 9 ++++ builtin/show-branch.c | 9 ++++ builtin/symbolic-ref.c | 9 ++++ builtin/tag.c | 10 +++++ builtin/update-index.c | 8 ++++ builtin/update-ref.c | 9 ++++ builtin/update-server-info.c | 9 ++++ builtin/upload-archive.c | 8 ++++ builtin/verify-pack.c | 9 ++++ builtin/verify-tag.c | 9 ++++ builtin/write-tree.c | 9 ++++ daemon.c | 8 ++++ editor.c | 9 ++++ imap-send.c | 9 ++++ run-command.c | 8 ++++ submodule.c | 16 ++++++++ transport-helper.c | 9 ++++ 56 files changed, 654 insertions(+) diff --git a/archive.c b/archive.c index 466640479ecb33..de0495d6e7a39e 100644 --- a/archive.c +++ b/archive.c @@ -217,6 +217,10 @@ static int reject_entry(const unsigned char *sha1, const char *base, static int path_exists(struct tree *tree, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *paths[] = { path, NULL }; struct pathspec pathspec; int ret; @@ -225,6 +229,10 @@ static int path_exists(struct tree *tree, const char *path) ret = read_tree_recursive(tree, "", 0, 0, &pathspec, reject_entry, NULL); free_pathspec(&pathspec); return ret != 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif } static void parse_pathspec_arg(const char **pathspec, @@ -317,6 +325,11 @@ static int parse_archive_args(int argc, const char **argv, int i; int list = 0; int worktree_attributes = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_GROUP(""), OPT_STRING(0, "format", &format, N_("fmt"), N_("archive format")), @@ -348,6 +361,10 @@ static int parse_archive_args(int argc, const char **argv, OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, opts, archive_usage, 0); if (remote) diff --git a/bisect.c b/bisect.c index 1aad49b1a642a3..f969723c935d22 100644 --- a/bisect.c +++ b/bisect.c @@ -597,9 +597,17 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix, const char *bad_format, const char *good_format, int read_paths) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct argv_array rev_argv = ARGV_ARRAY_INIT; int i; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + init_revisions(revs, prefix); revs->abbrev = 0; revs->commit_format = CMIT_FMT_UNSPECIFIED; diff --git a/builtin/apply.c b/builtin/apply.c index 156b3ce3b72f51..d473b63732ee3d 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4297,6 +4297,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) const char *whitespace_option = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_apply_options[] = { { OPTION_CALLBACK, 0, "exclude", NULL, N_("path"), N_("don't apply changes matching the given path"), @@ -4364,6 +4368,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + prefix = prefix_; prefix_length = prefix ? strlen(prefix) : 0; git_config(git_apply_config, NULL); diff --git a/builtin/archive.c b/builtin/archive.c index 9a1cfd3dac0123..1e38924ecebed3 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -87,6 +87,11 @@ int cmd_archive(int argc, const char **argv, const char *prefix) const char *exec = "git-upload-archive"; const char *output = NULL; const char *remote = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option local_opts[] = { OPT_STRING('o', "output", &output, N_("file"), N_("write the archive to this file")), @@ -97,6 +102,10 @@ int cmd_archive(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, local_opts, NULL, PARSE_OPT_KEEP_ALL); diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index e3884e3bb61c7d..b5631345b27f88 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -12,6 +12,11 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { int next_all = 0; int no_checkout = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "next-all", &next_all, N_("perform 'git bisect next'")), @@ -20,6 +25,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_bisect_helper_usage, 0); diff --git a/builtin/branch.c b/builtin/branch.c index ffd26849c7ad20..0d1cd857c01319 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -711,6 +711,11 @@ static int edit_branch_description(const char *branch_name) int cmd_branch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int delete = 0, rename = 0, force_create = 0, list = 0; int verbose = 0, abbrev = -1, detached = 0; int reflog = 0, edit_description = 0; @@ -776,6 +781,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_branch_usage, options); diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 00528ddc389212..04b2011ec3a203 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -262,6 +262,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) int opt = 0, batch = 0; const char *exp_type = NULL, *obj_name = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT_GROUP(N_(" can be one of: blob, tree, commit, tag")), OPT_SET_INT('t', NULL, &opt, N_("show object type"), 't'), @@ -280,6 +284,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_cat_file_config, NULL); if (argc != 3 && argc != 2) diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index b1feda7d5ef34f..eafe311614255c 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -182,6 +182,11 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) int read_from_stdin = 0; int prefix_length; int force = 0, quiet = 0, not_new = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_checkout_index_options[] = { OPT_BOOLEAN('a', "all", &all, N_("check out all files in the index")), @@ -209,6 +214,10 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_checkout_index_usage, builtin_checkout_index_options); diff --git a/builtin/checkout.c b/builtin/checkout.c index 781295b2c9abf0..bb4cd7aea57799 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1001,6 +1001,11 @@ static int checkout_branch(struct checkout_opts *opts, int cmd_checkout(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define new new_ +#endif + struct checkout_opts opts; struct branch_info new; char *conflict_style = NULL; @@ -1032,6 +1037,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); memset(&new, 0, sizeof(new)); opts.overwrite_ignore = 1; diff --git a/builtin/clean.c b/builtin/clean.c index 69c1cda9061f24..9a85e8a2068709 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -47,6 +47,11 @@ int cmd_clean(int argc, const char **argv, const char *prefix) struct string_list exclude_list = STRING_LIST_INIT_NODUP; const char *qname; char *seen = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__QUIET(&quiet, N_("do not print names of files removed")), OPT__DRY_RUN(&show_only, N_("dry run")), @@ -61,6 +66,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_clean_config, NULL); if (force < 0) force = 0; diff --git a/builtin/column.c b/builtin/column.c index e125a55fc9de2b..479b8c49d4db6c 100644 --- a/builtin/column.c +++ b/builtin/column.c @@ -18,6 +18,10 @@ static int column_config(const char *var, const char *value, void *cb) int cmd_column(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct string_list list = STRING_LIST_INIT_DUP; struct strbuf sb = STRBUF_INIT; struct column_options copts; @@ -33,6 +37,10 @@ int cmd_column(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* This one is special and must be the first one */ if (argc > 1 && !prefixcmp(argv[1], "--command=")) { command = argv[1] + 10; diff --git a/builtin/count-objects.c b/builtin/count-objects.c index 9afaa88f776468..6ede5da5b7a85e 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -78,11 +78,20 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) char *path = xmalloc(len + 50); unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0; off_t loose_size = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT__VERBOSE(&verbose, N_("be verbose")), OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0); /* we do not take arguments other than flags for now */ if (argc) diff --git a/builtin/describe.c b/builtin/describe.c index 9fe11ed9de7b9e..3efefe9556684a 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -399,6 +399,11 @@ static void describe(const char *arg, int last_one) int cmd_describe(int argc, const char **argv, const char *prefix) { int contains = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "contains", &contains, N_("find the tag that comes after the commit")), OPT_BOOLEAN(0, "debug", &debug, N_("debug search strategy on stderr")), @@ -420,6 +425,10 @@ int cmd_describe(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, describe_usage, 0); if (abbrev < 0) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 12220ad8dac65a..f7fd3921dc238b 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -630,6 +630,11 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) struct string_list extra_refs = STRING_LIST_INIT_NODUP; struct commit *commit; char *export_filename = NULL, *import_filename = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_INTEGER(0, "progress", &progress, N_("show progress after objects")), @@ -653,6 +658,10 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 1) usage_with_options (fast_export_usage, options); diff --git a/builtin/fetch.c b/builtin/fetch.c index 4b5a89839b66f2..40b533349c8364 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -587,11 +587,19 @@ static void find_non_local_tags(struct transport *transport, struct ref **head, struct ref ***tail) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct string_list existing_refs = STRING_LIST_INIT_NODUP; struct string_list remote_refs = STRING_LIST_INIT_NODUP; const struct ref *ref; struct string_list_item *item = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + for_each_ref(add_existing, &existing_refs); for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) { if (prefixcmp(ref->name, "refs/tags/")) @@ -826,10 +834,18 @@ static int get_remote_group(const char *key, const char *value, void *priv) static int add_remote_or_group(const char *name, struct string_list *list) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int prev_nr = list->nr; struct remote_group_data g; g.name = name; g.list = list; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(get_remote_group, &g); if (list->nr == prev_nr) { struct remote *remote; diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index e2e27b2c404a1c..48aafa1d8e5574 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -648,6 +648,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) { const char *inpath = NULL; const char *message = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int shortlog_len = -1; struct option options[] = { { OPTION_INTEGER, 0, "log", &shortlog_len, N_("n"), @@ -663,6 +668,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + FILE *in = stdin; struct strbuf input = STRBUF_INIT, output = STRBUF_INIT; int ret; diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 7f059c31dfbd11..6cec8bb0aa9139 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -989,6 +989,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) struct refinfo **refs; struct grab_ref_cbdata cbdata; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT('s', "shell", "e_style, N_("quote placeholders suitably for shells"), QUOTE_SHELL), @@ -1007,6 +1011,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0); if (maxcount < 0) { error("invalid --count argument: `%d'", maxcount); diff --git a/builtin/gc.c b/builtin/gc.c index 6be6c8d65b26c9..ae525372ede941 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -173,6 +173,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) int auto_gc = 0; int quiet = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_gc_options[] = { OPT__QUIET(&quiet, N_("suppress progress reporting")), { OPTION_STRING, 0, "prune", &prune_expire, N_("date"), @@ -183,6 +187,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_gc_usage, builtin_gc_options); diff --git a/builtin/grep.c b/builtin/grep.c index 82530a61b48373..ee362f481ea7b0 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -724,6 +724,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix) int use_index = 1; int pattern_type_arg = GREP_PATTERN_TYPE_UNSPECIFIED; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "cached", &cached, N_("search in index instead of in the work tree")), @@ -832,6 +836,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* * 'git grep -h', unlike 'git grep -h ', is a request * to show usage information and exit. diff --git a/builtin/init-db.c b/builtin/init-db.c index 78aa3872dddbba..090042fa2066ab 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -481,6 +481,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) const char *work_tree; const char *template_dir = NULL; unsigned int flags = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option init_db_options[] = { OPT_STRING(0, "template", &template_dir, N_("template-directory"), N_("directory from which templates will be used")), @@ -496,6 +501,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0); if (real_git_dir && !is_absolute_path(real_git_dir)) diff --git a/builtin/log.c b/builtin/log.c index 09cf43e6d40efc..46a6ca2c5779f7 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -96,6 +96,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, struct userformat_want w; int quiet = 0, source = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option builtin_log_options[] = { OPT_BOOLEAN(0, "quiet", &quiet, N_("suppress diff output")), OPT_BOOLEAN(0, "source", &source, N_("show source")), @@ -104,6 +108,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, builtin_log_options, builtin_log_usage, PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | @@ -1038,6 +1046,10 @@ static char *find_branch_name(struct rev_info *rev) int cmd_format_patch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct commit *commit; struct commit **list = NULL; struct rev_info rev; @@ -1118,6 +1130,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + extra_hdr.strdup_strings = 1; extra_to.strdup_strings = 1; extra_cc.strdup_strings = 1; @@ -1472,12 +1488,20 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) const char *limit = NULL; int verbose = 0, abbrev = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__ABBREV(&abbrev), OPT__VERBOSE(&verbose, N_("be verbose")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, cherry_usage, 0); switch (argc) { diff --git a/builtin/ls-files.c b/builtin/ls-files.c index b5434af0c87741..693bf4e079e307 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -455,6 +455,11 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) int require_work_tree = 0, show_tag = 0; const char *max_prefix; struct dir_struct dir; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_ls_files_options[] = { { OPTION_CALLBACK, 'z', NULL, NULL, NULL, N_("paths are separated with NUL character"), @@ -511,6 +516,10 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(ls_files_usage, builtin_ls_files_options); diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index 235c17cc015acf..f363e6c5644c94 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -118,6 +118,10 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen, int cmd_ls_tree(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + unsigned char sha1[20]; struct tree *tree; int i, full_tree = 0; @@ -145,6 +149,10 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); ls_tree_prefix = prefix; if (prefix && *prefix) diff --git a/builtin/merge-base.c b/builtin/merge-base.c index 1bc79910481e6e..74c68ac1bcb8a4 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -94,6 +94,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) int reduce = 0; int is_ancestor = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('a', "all", &show_all, N_("output all common ancestors")), OPT_BOOLEAN(0, "octopus", &octopus, N_("find ancestors for a single n-way merge")), @@ -103,6 +107,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0); if (!octopus && !reduce && argc < 2) diff --git a/builtin/merge-file.c b/builtin/merge-file.c index c0570f24072a8e..2591301b2145f9 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -29,6 +29,11 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) int ret = 0, i = 0, to_stdout = 0; int quiet = 0; int prefixlen = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('p', "stdout", &to_stdout, N_("send results to standard output")), OPT_SET_INT(0, "diff3", &xmp.style, N_("use a diff3 based merge"), XDL_MERGE_DIFF3), @@ -46,6 +51,10 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + xmp.level = XDL_MERGE_ZEALOUS_ALNUM; xmp.style = 0; xmp.favor = 0; diff --git a/builtin/merge-index.c b/builtin/merge-index.c index 23388325879c5a..99753c51bb7026 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -7,11 +7,19 @@ static int err; static int merge_entry(int pos, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int found; const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL }; char hexbuf[4][60]; char ownbuf[4][60]; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (pos >= active_nr) die("git merge-index: %s not in the cache", path); found = 0; diff --git a/builtin/mktree.c b/builtin/mktree.c index f92ba404abd5ce..012202d6bce3c1 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -149,6 +149,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) int is_batch_mode = 0; int got_eof = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option option[] = { OPT_SET_INT('z', NULL, &line_termination, N_("input is NUL terminated"), '\0'), OPT_SET_INT( 0 , "missing", &allow_missing, N_("allow missing objects"), 1), @@ -156,6 +160,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + ac = parse_options(ac, av, prefix, option, mktree_usage, 0); while (!got_eof) { diff --git a/builtin/mv.c b/builtin/mv.c index 034fec92a11d79..b7578f50757e85 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -58,6 +58,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) { int i, newfd; int verbose = 0, show_only = 0, force = 0, ignore_errors = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_mv_options[] = { OPT__VERBOSE(&verbose, N_("be verbose")), OPT__DRY_RUN(&show_only, N_("dry run")), @@ -65,6 +70,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) OPT_BOOLEAN('k', NULL, &ignore_errors, N_("skip move/rename errors")), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + const char **source, **destination, **dest_path; enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes; struct stat st; diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 62382479749909..a36c50edc194ce 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -225,6 +225,11 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) struct object_array revs = OBJECT_ARRAY_INIT; int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0; struct name_ref_data data = { 0, 0, NULL }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BOOLEAN(0, "name-only", &data.name_only, N_("print only names (no SHA-1)")), OPT_BOOLEAN(0, "tags", &data.tags_only, N_("only use tags to name the commits")), @@ -239,6 +244,10 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0); if (!!all + !!transform_stdin + !!argc > 1) { diff --git a/builtin/notes.c b/builtin/notes.c index 453457adb9deda..4846dcb9fe486f 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -125,12 +125,20 @@ static void write_note_data(int fd, const unsigned char *sha1) static void write_commented_object(int fd, const unsigned char *object) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[5] = {"show", "--stat", "--no-notes", sha1_to_hex(object), NULL}; struct child_process show; struct strbuf buf = STRBUF_INIT; FILE *show_out; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* Invoke "git show --stat --no-notes $object" */ memset(&show, 0, sizeof(show)); show.argv = show_args; @@ -533,6 +541,11 @@ static int add(int argc, const char **argv, const char *prefix) char logmsg[100]; const unsigned char *note; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, N_("message"), N_("note contents as a string"), PARSE_OPT_NONEG, @@ -550,6 +563,10 @@ static int add(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_add_usage, PARSE_OPT_KEEP_ARGV0); @@ -613,6 +630,11 @@ static int copy(int argc, const char **argv, const char *prefix) unsigned char object[20], from_obj[20]; struct notes_tree *t; const char *rewrite_cmd = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, N_("replace existing notes")), OPT_BOOLEAN(0, "stdin", &from_stdin, N_("read objects from stdin")), @@ -622,6 +644,10 @@ static int copy(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_copy_usage, 0); @@ -690,6 +716,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) char logmsg[100]; const char * const *usage; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, N_("message"), N_("note contents as a string"), PARSE_OPT_NONEG, @@ -705,6 +736,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) parse_reuse_arg}, OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + int edit = !strcmp(argv[0], "edit"); usage = edit ? git_notes_edit_usage : git_notes_append_usage; @@ -775,7 +811,17 @@ static int show(int argc, const char **argv, const char *prefix) retval = error(_("No note found for object %s."), sha1_to_hex(object)); else { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[3] = {"show", sha1_to_hex(note), NULL}; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + retval = execv_git_cmd(show_args); } free_notes(t); @@ -856,6 +902,10 @@ static int merge_commit(struct notes_merge_options *o) static int merge(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct strbuf remote_ref = STRBUF_INIT, msg = STRBUF_INIT; unsigned char result_sha1[20]; struct notes_tree *t; @@ -881,6 +931,10 @@ static int merge(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_merge_usage, 0); @@ -979,6 +1033,10 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag static int remove_cmd(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + unsigned flag = 0; int from_stdin = 0; struct option options[] = { @@ -992,6 +1050,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) struct notes_tree *t; int retval = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_remove_usage, 0); @@ -1021,6 +1083,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) static int prune(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct notes_tree *t; int show_only = 0, verbose = 0; struct option options[] = { @@ -1029,6 +1095,10 @@ static int prune(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_prune_usage, 0); @@ -1066,12 +1136,21 @@ int cmd_notes(int argc, const char **argv, const char *prefix) { int result; const char *override_notes_ref = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_STRING(0, "ref", &override_notes_ref, N_("notes_ref"), N_("use notes from ")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_notes_usage, PARSE_OPT_STOP_AT_NON_OPTION); diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 5e140640947cd9..0a95fb803a7f0e 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2437,6 +2437,10 @@ static int option_parse_ulong(const struct option *opt, int cmd_pack_objects(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int use_internal_rev_list = 0; int thin = 0; int all_progress_implied = 0; @@ -2509,6 +2513,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + read_replace_refs = 0; reset_pack_idx_option(&pack_idx_opts); diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index b5a0f88eb8c564..4a43e085e52780 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -10,11 +10,21 @@ static char const * const pack_refs_usage[] = { int cmd_pack_refs(int argc, const char **argv, const char *prefix) { unsigned int flags = PACK_REFS_PRUNE; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT(0, "all", &flags, N_("pack everything"), PACK_REFS_ALL), OPT_BIT(0, "prune", &flags, N_("prune loose refs (default)"), PACK_REFS_PRUNE), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0)) usage_with_options(pack_refs_usage, opts); return pack_refs(flags); diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index 83382c1fe13e1f..2e6152e4ca82ca 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -71,6 +71,10 @@ void prune_packed_objects(int opts) int cmd_prune_packed(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int opts = isatty(2) ? VERBOSE : 0; const struct option prune_packed_options[] = { OPT_BIT('n', "dry-run", &opts, N_("dry run"), DRY_RUN), @@ -78,6 +82,10 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, prune_packed_options, prune_packed_usage, 0); diff --git a/builtin/push.c b/builtin/push.c index db9ba30b08c221..4cb04bfadc6d19 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -373,6 +373,10 @@ static int option_parse_recurse_submodules(const struct option *opt, int cmd_push(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int flags = 0; int tags = 0; int rc; @@ -402,6 +406,10 @@ int cmd_push(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + packet_trace_identity("push"); git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, push_usage, 0); diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 042ac1b84f2225..82f219792be035 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -103,6 +103,11 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) struct tree_desc t[MAX_UNPACK_TREES]; struct unpack_trees_options opts; int prefix_set = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option read_tree_options[] = { { OPTION_CALLBACK, 0, "index-output", NULL, N_("file"), N_("write resulting index to "), @@ -138,6 +143,10 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); opts.head_idx = -1; opts.src_index = &the_index; diff --git a/builtin/remote.c b/builtin/remote.c index a5a4b232310a27..df6e8c1feef7f1 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -90,11 +90,20 @@ static inline int postfixcmp(const char *string, const char *postfix) static int fetch_remote(const char *name) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { "fetch", name, NULL, NULL }; if (verbose) { argv[1] = "-v"; argv[2] = name; } + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + printf_ln(_("Updating %s"), name); if (run_command_v_opt(argv, RUN_GIT_CMD)) return error(_("Could not fetch %s"), name); @@ -159,6 +168,10 @@ static int add(int argc, const char **argv) const char *name, *url; int i; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('f', "fetch", &fetch, N_("fetch the remote branches")), OPT_SET_INT(0, "tags", &fetch_tags, @@ -175,6 +188,10 @@ static int add(int argc, const char **argv) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_add_usage, 0); @@ -1086,6 +1103,10 @@ static int show_push_info_item(struct string_list_item *item, void *cb_data) static int show(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int no_query = 0, result = 0, query_flag = 0; struct option options[] = { OPT_BOOLEAN('n', NULL, &no_query, N_("do not query remotes")), @@ -1095,6 +1116,10 @@ static int show(int argc, const char **argv) struct string_list info_list = STRING_LIST_INIT_NODUP; struct show_info info; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_show_usage, 0); @@ -1194,6 +1219,10 @@ static int set_head(int argc, const char **argv) struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT; char *head_name = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('a', "auto", &opt_a, N_("set refs/remotes//HEAD according to remote")), @@ -1201,6 +1230,11 @@ static int set_head(int argc, const char **argv) N_("delete refs/remotes//HEAD")), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_sethead_usage, 0); if (argc) @@ -1248,12 +1282,20 @@ static int set_head(int argc, const char **argv) static int prune(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int dry_run = 0, result = 0; struct option options[] = { OPT__DRY_RUN(&dry_run, N_("dry run")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_prune_usage, 0); @@ -1315,6 +1357,10 @@ static int get_remote_default(const char *key, const char *value, void *priv) static int update(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int i, prune = 0; struct option options[] = { OPT_BOOLEAN('p', "prune", &prune, @@ -1325,6 +1371,10 @@ static int update(int argc, const char **argv) int fetch_argc = 0; int default_defined = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + fetch_argv = xmalloc(sizeof(char *) * (argc+5)); argc = parse_options(argc, argv, NULL, options, builtin_remote_update_usage, @@ -1402,12 +1452,20 @@ static int set_remote_branches(const char *remotename, const char **branches, static int set_branches(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int add_mode = 0; struct option options[] = { OPT_BOOLEAN('\0', "add", &add_mode, N_("add branch")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_setbranches_usage, 0); if (argc == 0) { @@ -1431,6 +1489,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) const char **urlset; int urlset_nr; struct strbuf name_buf = STRBUF_INIT; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN('\0', "push", &push_mode, N_("manipulate push URLs")), @@ -1440,6 +1503,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) N_("delete URLs")), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_seturl_usage, PARSE_OPT_KEEP_ARGV0); diff --git a/builtin/replace.c b/builtin/replace.c index e3aaf70203d4f5..8f6bdef15debb0 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -113,6 +113,11 @@ static int replace_object(const char *object_ref, const char *replace_ref, int cmd_replace(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int list = 0, delete = 0, force = 0; struct option options[] = { OPT_BOOLEAN('l', NULL, &list, N_("list replace refs")), @@ -121,6 +126,10 @@ int cmd_replace(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0); if (list && delete) diff --git a/builtin/rerere.c b/builtin/rerere.c index dc1708e6d6de54..80bd441ba3b762 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -51,12 +51,20 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) struct string_list merge_rr = STRING_LIST_INIT_DUP; int i, fd, autoupdate = -1, flags = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_SET_INT(0, "rerere-autoupdate", &autoupdate, N_("register clean resolutions in index"), 1), OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, rerere_usage, 0); if (autoupdate == 1) diff --git a/builtin/reset.c b/builtin/reset.c index 915cc9f86f855d..f3ed4d0fdd54b8 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -234,6 +234,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix) *old_orig = NULL, sha1_old_orig[20]; struct commit *commit; struct strbuf msg = STRBUF_INIT; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT__QUIET(&quiet, N_("be quiet, only report errors")), OPT_SET_INT(0, "mixed", &reset_type, @@ -249,6 +254,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_reset_usage, diff --git a/builtin/revert.c b/builtin/revert.c index c5e36b94c08021..a3dda0ebed4f29 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -99,6 +99,11 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) int remove_state = 0; int contin = 0; int rollback = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOLEAN(0, "quit", &remove_state, N_("end revert or cherry-pick sequence")), OPT_BOOLEAN(0, "continue", &contin, N_("resume revert or cherry-pick sequence")), @@ -133,6 +138,10 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) die(_("program error")); } +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, usage_str, PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN); diff --git a/builtin/show-branch.c b/builtin/show-branch.c index d208fd6c6821c7..35d155e29a4d19 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -646,6 +646,11 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) int topics = 0; int dense = 1; const char *reflog_base = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_show_branch_options[] = { OPT_BOOLEAN('a', "all", &all_heads, N_("show remote-tracking and local branches")), @@ -683,6 +688,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_show_branch_config, NULL); /* If nothing is specified, try the default first */ diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index 9e92828b3ab02f..52674b3e592477 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -33,6 +33,11 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) { int quiet = 0; const char *msg = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__QUIET(&quiet, N_("suppress error message for non-symbolic (detached) refs")), @@ -41,6 +46,10 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_symbolic_ref_usage, 0); diff --git a/builtin/tag.c b/builtin/tag.c index 9c3e0673d5bd4e..90afafac542085 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -436,6 +436,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix) unsigned char object[20], prev[20]; const char *object_ref, *tag; struct ref_lock *lock; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + struct create_tag_options opt; char *cleanup_arg = NULL; int annotate = 0, force = 0, lines = -1, list = 0, @@ -479,6 +485,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_tag_config, NULL); memset(&opt, 0, sizeof(opt)); diff --git a/builtin/update-index.c b/builtin/update-index.c index 74986bf163d4da..9ab5475c40c2d7 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -702,6 +702,10 @@ static int reupdate_callback(struct parse_opt_ctx_t *ctx, int cmd_update_index(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int newfd, entries, has_errors = 0, line_termination = '\n'; int read_from_stdin = 0; int prefix_length = prefix ? strlen(prefix) : 0; @@ -794,6 +798,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage(update_index_usage[0]); diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 51d26848598d7f..c8363a73371d3a 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -11,6 +11,11 @@ static const char * const git_update_ref_usage[] = { int cmd_update_ref(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + const char *refname, *oldval, *msg = NULL; unsigned char sha1[20], oldsha1[20]; int delete = 0, no_deref = 0, flags = 0; @@ -22,6 +27,10 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_update_ref_usage, 0); diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index 6c8cc3edc1f5fe..c2e9c512653471 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -10,11 +10,20 @@ static const char * const update_server_info_usage[] = { int cmd_update_server_info(int argc, const char **argv, const char *prefix) { int force = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, N_("update the info files from scratch")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, update_server_info_usage, 0); diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index b928beb8ed51c9..c8def2dda2457f 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -94,8 +94,16 @@ static ssize_t process_input(int child_fd, int band) int cmd_upload_archive(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process writer = { argv }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* * Set up sideband subprocess. * diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index 66cd2df0f878d3..22286a75f975b8 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -62,6 +62,11 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) int err = 0; unsigned int flags = 0; int i; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_pack_options[] = { OPT_BIT('v', "verbose", &flags, N_("verbose"), VERIFY_PACK_VERBOSE), @@ -70,6 +75,10 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, verify_pack_options, verify_pack_usage, 0); diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index a8eee886a52819..00c6e31b7ee85b 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -69,11 +69,20 @@ static int git_verify_tag_config(const char *var, const char *value, void *cb) int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_tag_options[] = { OPT__VERBOSE(&verbose, N_("print tag contents")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_verify_tag_config, NULL); argc = parse_options(argc, argv, prefix, verify_tag_options, diff --git a/builtin/write-tree.c b/builtin/write-tree.c index 084c0df7833f29..4b25db25b46814 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -20,6 +20,11 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) const char *prefix = NULL; unsigned char sha1[20]; const char *me = "git-write-tree"; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option write_tree_options[] = { OPT_BIT(0, "missing-ok", &flags, N_("allow missing objects"), WRITE_TREE_MISSING_OK), @@ -33,6 +38,10 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, unused_prefix, write_tree_options, write_tree_usage, 0); diff --git a/daemon.c b/daemon.c index 4602b46a5c39e1..fbca339ee0761e 100644 --- a/daemon.c +++ b/daemon.c @@ -742,10 +742,18 @@ static void check_dead_children(void) static char **cld_argv; static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process cld = { NULL }; char addrbuf[300] = "REMOTE_ADDR=", portbuf[300]; char *env[] = { addrbuf, portbuf, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (max_connections && live_children >= max_connections) { kill_some_child(); sleep(1); /* give it some time to die */ diff --git a/editor.c b/editor.c index d8340031d24828..8dbbb5eeac1fe4 100644 --- a/editor.c +++ b/editor.c @@ -36,8 +36,17 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en return error("Terminal is dumb, but EDITOR unset"); if (strcmp(editor, ":")) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *args[] = { editor, path, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (run_command_v_opt_cd_env(args, RUN_USING_SHELL, NULL, env)) return error("There was a problem with the editor '%s'.", editor); diff --git a/imap-send.c b/imap-send.c index d42e4712972794..11bd3854a7b229 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1045,9 +1045,18 @@ static struct store *imap_open_store(struct imap_server_conf *srvc) /* open connection to IMAP server */ if (srvc->tunnel) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { srvc->tunnel, NULL }; struct child_process tunnel = {NULL}; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + imap_info("Starting tunnel '%s'... ", srvc->tunnel); tunnel.argv = argv; diff --git a/run-command.c b/run-command.c index 1101ef72378a50..09265b223e5e29 100644 --- a/run-command.c +++ b/run-command.c @@ -747,6 +747,10 @@ int finish_async(struct async *async) int run_hook(const char *index_file, const char *name, ...) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process hook; struct argv_array argv = ARGV_ARRAY_INIT; const char *p, *env[2]; @@ -754,6 +758,10 @@ int run_hook(const char *index_file, const char *name, ...) va_list args; int ret; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (access(git_path("hooks/%s", name), X_OK) < 0) return 0; diff --git a/submodule.c b/submodule.c index 50f213e926374e..3079406bc3a444 100644 --- a/submodule.c +++ b/submodule.c @@ -543,10 +543,18 @@ static void add_sha1_to_argv(const unsigned char sha1[20], void *data) static void calculate_changed_submodule_paths(void) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct rev_info rev; struct commit *commit; struct argv_array argv = ARGV_ARRAY_INIT; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* No need to check if there are no submodules configured */ if (!config_name_for_path.nr) return; @@ -767,12 +775,20 @@ static int find_first_merges(struct object_array *result, const char *path, struct commit *commit; int contains_another; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + char merged_revision[42]; const char *rev_args[] = { "rev-list", "--merges", "--ancestry-path", "--all", merged_revision, NULL }; struct rev_info revs; struct setup_revision_opt rev_opts; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&merges, 0, sizeof(merges)); memset(result, 0, sizeof(struct object_array)); memset(&rev_opts, 0, sizeof(rev_opts)); diff --git a/transport-helper.c b/transport-helper.c index cfe098849022fc..c347191d012646 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -109,11 +109,20 @@ static struct child_process *get_helper(struct transport *transport) int duped; int code; char git_dir_buf[sizeof(GIT_DIR_ENVIRONMENT) + PATH_MAX + 1]; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *helper_env[] = { git_dir_buf, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (data->helper) return data->helper; From 9b900ab2d6919de4145edcafc5db9261e692c42f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 13 Jan 2010 17:11:53 -0800 Subject: [PATCH 097/211] Add A-line config files for git in MacRelix Link with dlmalloc so malloc() can use temporary memory. Link with plproxy's poll_compat for poll() over select(). This is needed for git daemon. --- A-line.confd/Source.list | 267 +++++++++++++++++++++++++++++++++++++++ A-line.confd/git.conf | 33 +++++ 2 files changed, 300 insertions(+) create mode 100644 A-line.confd/Source.list create mode 100644 A-line.confd/git.conf diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list new file mode 100644 index 00000000000000..e8067b08f2ff98 --- /dev/null +++ b/A-line.confd/Source.list @@ -0,0 +1,267 @@ +abspath.c +advice.c +alias.c +alloc.c +archive-tar.c +archive-zip.c +archive.c +argv-array.c +attr.c +base85.c +bisect.c +blob.c +block-sha1/sha1.c +branch.c +builtin/add.c +builtin/annotate.c +builtin/apply.c +builtin/archive.c +builtin/bisect--helper.c +builtin/blame.c +builtin/branch.c +builtin/bundle.c +builtin/cat-file.c +builtin/check-attr.c +builtin/check-ref-format.c +builtin/checkout-index.c +builtin/checkout.c +builtin/clean.c +builtin/clone.c +builtin/column.c +builtin/commit-tree.c +builtin/commit.c +builtin/config.c +builtin/count-objects.c +builtin/credential.c +builtin/describe.c +builtin/diff-files.c +builtin/diff-index.c +builtin/diff-tree.c +builtin/diff.c +builtin/fast-export.c +builtin/fetch-pack.c +builtin/fetch.c +builtin/fmt-merge-msg.c +builtin/for-each-ref.c +builtin/fsck.c +builtin/gc.c +builtin/grep.c +builtin/hash-object.c +builtin/help.c +builtin/index-pack.c +builtin/init-db.c +builtin/log.c +builtin/ls-files.c +builtin/ls-remote.c +builtin/ls-tree.c +builtin/mailinfo.c +builtin/mailsplit.c +builtin/merge-base.c +builtin/merge-file.c +builtin/merge-index.c +builtin/merge-ours.c +builtin/merge-recursive.c +builtin/merge-tree.c +builtin/merge.c +builtin/mktag.c +builtin/mktree.c +builtin/mv.c +builtin/name-rev.c +builtin/notes.c +builtin/pack-objects.c +builtin/pack-redundant.c +builtin/pack-refs.c +builtin/patch-id.c +builtin/prune-packed.c +builtin/prune.c +builtin/push.c +builtin/read-tree.c +builtin/receive-pack.c +builtin/reflog.c +builtin/remote.c +builtin/remote-ext.c +builtin/remote-fd.c +builtin/replace.c +builtin/rerere.c +builtin/reset.c +builtin/rev-list.c +builtin/rev-parse.c +builtin/revert.c +builtin/rm.c +builtin/send-pack.c +builtin/shortlog.c +builtin/show-branch.c +builtin/show-ref.c +builtin/stripspace.c +builtin/symbolic-ref.c +builtin/tag.c +builtin/tar-tree.c +builtin/unpack-file.c +builtin/unpack-objects.c +builtin/update-index.c +builtin/update-ref.c +builtin/update-server-info.c +builtin/upload-archive.c +builtin/var.c +builtin/verify-pack.c +builtin/verify-tag.c +builtin/write-tree.c +bulk-checkin.c +bundle.c +cache-tree.c +check-racy.c +color.c +column.c +combine-diff.c +commit.c +compat/basename.c +compat/fnmatch/fnmatch.c +compat/inet_pton.c +compat/memmem.c +compat/mmap.c +compat/obstack.c +compat/strcasestr.c +compat/terminal.c +config.c +connect.c +connected.c +convert.c +copy.c +credential.c +csum-file.c +ctype.c +daemon.c +date.c +decorate.c +diff-delta.c +diff-lib.c +diff-no-index.c +diff.c +diffcore-break.c +diffcore-delta.c +diffcore-order.c +diffcore-pickaxe.c +diffcore-rename.c +dir.c +editor.c +entry.c +environment.c +exec_cmd.c +fast-import.c +fsck.c +git.c +gpg-interface.c +graph.c +grep.c +hash.c +help.c +hex.c +http-backend.c +#http-fetch.c +#http-push.c +#http-walker.c +#http.c +ident.c +imap-send.c +kwset.c +levenshtein.c +list-objects.c +ll-merge.c +lockfile.c +log-tree.c +mailmap.c +match-trees.c +merge-file.c +merge-recursive.c +mergesort.c +name-hash.c +notes.c +notes-cache.c +notes-merge.c +object.c +pack-check.c +pack-refs.c +pack-revindex.c +pack-write.c +pager.c +parse-options.c +parse-options-cb.c +patch-delta.c +patch-ids.c +path.c +pkt-line.c +preload-index.c +pretty.c +progress.c +prompt.c +quote.c +reachable.c +read-cache.c +reflog-walk.c +refs.c +remote.c +replace_object.c +rerere.c +resolve-undo.c +revision.c +run-command.c +sequencer.c +server-info.c +setup.c +sha1-array.c +sha1-lookup.c +sha1_file.c +sha1_name.c +shallow.c +shell.c +show-index.c +sideband.c +sigchain.c +strbuf.c +streaming.c +string-list.c +submodule.c +symlinks.c +tag.c +test-chmtime.c +test-ctype.c +test-date.c +test-delta.c +test-dump-cache-tree.c +test-genrandom.c +test-index-version.c +test-match-trees.c +#test-parse-options.c +test-path-utils.c +test-run-command.c +test-sha1.c +test-sigchain.c +thread-utils.c +trace.c +transport.c +transport-helper.c +tree-diff.c +tree-walk.c +tree.c +unpack-trees.c +upload-pack.c +url.c +usage.c +userdiff.c +utf8.c +varint.c +version.c +walker.c +wrapper.c +write_or_die.c +ws.c +wt-status.c +xdiff/xdiffi.c +xdiff/xemit.c +xdiff/xhistogram.c +xdiff/xmerge.c +xdiff/xpatience.c +xdiff/xprepare.c +xdiff/xutils.c +xdiff-interface.c +zlib.c diff --git a/A-line.confd/git.conf b/A-line.confd/git.conf new file mode 100644 index 00000000000000..a9b80930a259e7 --- /dev/null +++ b/A-line.confd/git.conf @@ -0,0 +1,33 @@ +product toolkit + +use dlmalloc? +use poll_compat +use POSIX +use zlib + +precompile cache.h + +tools check-racy.c +tools daemon.c +tools fast-import.c +tools git.c +tools http-backend.c +tools http-fetch.c +tools http-push.c +tools imap-send.c +tools shell.c +tools show-index.c +tools test-chmtime.c +tools test-ctype.c +tools test-date.c +tools test-delta.c +tools test-dump-cache-tree.c +tools test-genrandom.c +tools test-index-version.c +tools test-match-trees.c +tools test-parse-options.c +tools test-path-utils.c +tools test-run-command.c +tools test-sha1.c +tools test-sigchain.c +tools upload-pack.c From a0f5465420439a8680612941c85ff7c2d9d0cea7 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:53:44 -0800 Subject: [PATCH 098/211] Silence warnings of uninitialized variable use --- builtin/cat-file.c | 2 +- builtin/rev-list.c | 2 +- fast-import.c | 8 ++++---- merge-recursive.c | 2 +- run-command.c | 2 +- submodule.c | 2 +- wt-status.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 00528ddc389212..ad290007363120 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents) unsigned char sha1[20]; enum object_type type = 0; unsigned long size; - void *contents = contents; + void *contents; if (!obj_name) return 1; diff --git a/builtin/rev-list.c b/builtin/rev-list.c index ff5a38372d76cc..8372c123a00bd1 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -387,7 +387,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) mark_edges_uninteresting(revs.commits, &revs, show_edge); if (bisect_list) { - int reaches = reaches, all = all; + int reaches, all; revs.commits = find_bisection(revs.commits, &reaches, &all, bisect_find_all); diff --git a/fast-import.c b/fast-import.c index c2a814ec660862..5de75fb98a846c 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2265,7 +2265,7 @@ static void file_change_m(struct branch *b) const char *p = command_buf.buf + 2; static struct strbuf uq = STRBUF_INIT; const char *endp; - struct object_entry *oe = oe; + struct object_entry *oe; unsigned char sha1[20]; uint16_t mode, inline_data = 0; @@ -2434,7 +2434,7 @@ static void note_change_n(struct branch *b, unsigned char *old_fanout) { const char *p = command_buf.buf + 2; static struct strbuf uq = STRBUF_INIT; - struct object_entry *oe = oe; + struct object_entry *oe; struct branch *s; unsigned char sha1[20], commit_sha1[20]; char path[60]; @@ -2613,7 +2613,7 @@ static int parse_from(struct branch *b) static struct hash_list *parse_merge(unsigned int *count) { - struct hash_list *list = NULL, *n, *e = e; + struct hash_list *list = NULL, *n, *e; const char *from; struct branch *s; @@ -2914,7 +2914,7 @@ static void cat_blob(struct object_entry *oe, unsigned char sha1[20]) static void parse_cat_blob(void) { const char *p; - struct object_entry *oe = oe; + struct object_entry *oe; unsigned char sha1[20]; /* cat-blob SP LF */ diff --git a/merge-recursive.c b/merge-recursive.c index d8820604ca3535..693e6148222c42 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1883,7 +1883,7 @@ int merge_recursive(struct merge_options *o, { struct commit_list *iter; struct commit *merged_common_ancestors; - struct tree *mrtree = mrtree; + struct tree *mrtree; int clean; if (show(o, 4)) { diff --git a/run-command.c b/run-command.c index 1101ef72378a50..b19c4b58792043 100644 --- a/run-command.c +++ b/run-command.c @@ -272,7 +272,7 @@ int start_command(struct child_process *cmd) { int need_in, need_out, need_err; int fdin[2], fdout[2], fderr[2]; - int failed_errno = failed_errno; + int failed_errno; /* * In case of errors we must keep the promise to close FDs diff --git a/submodule.c b/submodule.c index 50f213e926374e..9be814019e15ac 100644 --- a/submodule.c +++ b/submodule.c @@ -262,7 +262,7 @@ void show_submodule_summary(FILE *f, const char *path, const char *del, const char *add, const char *reset) { struct rev_info rev; - struct commit *left = left, *right = right; + struct commit *left, *right; const char *message = NULL; struct strbuf sb = STRBUF_INIT; int fast_forward = 0, fast_backward = 0; diff --git a/wt-status.c b/wt-status.c index 2a9658bad4c503..92f781fa129b88 100644 --- a/wt-status.c +++ b/wt-status.c @@ -264,7 +264,7 @@ static void wt_status_print_change_data(struct wt_status *s, { struct wt_status_change_data *d = it->util; const char *c = color(change_type, s); - int status = status; + int status; char *one_name; char *two_name; const char *one, *two; From 95bd76cadc1be19d29b46eca884f9f83d20a20d2 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 23:06:36 -0800 Subject: [PATCH 099/211] Return unconditionally at the end of cmd_push() The 'else' clause is superfluous since usage_with_options() doesn't return. This avoids a warning. --- builtin/push.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/push.c b/builtin/push.c index db9ba30b08c221..8437abf7fc1e19 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -422,6 +422,5 @@ int cmd_push(int argc, const char **argv, const char *prefix) rc = do_push(repo, flags); if (rc == -1) usage_with_options(push_usage, options); - else - return rc; + return rc; } From 897cc93858f600e9184540a1da98099f431cc810 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:57:16 -0800 Subject: [PATCH 100/211] Return instead of calling exit() where equivalent Metrowerks C doesn't recognize the __noreturn__ attribute, so this avoids warnings. --- builtin/merge-ours.c | 2 +- builtin/mktree.c | 2 +- test-match-trees.c | 2 +- test-sha1.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index 684411694f64ca..522e3690295104 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -30,5 +30,5 @@ int cmd_merge_ours(int argc, const char **argv, const char *prefix) */ if (cmd_diff_index(NARGS, diff_index_args, prefix)) exit(2); - exit(0); + return 0; } diff --git a/builtin/mktree.c b/builtin/mktree.c index f92ba404abd5ce..1c6c9818985175 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -187,5 +187,5 @@ int cmd_mktree(int ac, const char **av, const char *prefix) used=0; /* reset tree entry buffer for re-use in batch mode */ } strbuf_release(&sb); - exit(0); + return 0; } diff --git a/test-match-trees.c b/test-match-trees.c index a3c4688778d9db..33e533978c016b 100644 --- a/test-match-trees.c +++ b/test-match-trees.c @@ -20,5 +20,5 @@ int main(int ac, char **av) shift_tree(one->object.sha1, two->object.sha1, shifted, -1); printf("shifted: %s\n", sha1_to_hex(shifted)); - exit(0); + return 0; } diff --git a/test-sha1.c b/test-sha1.c index 80daba980ecd85..e3b249c4f2d207 100644 --- a/test-sha1.c +++ b/test-sha1.c @@ -43,5 +43,5 @@ int main(int ac, char **av) } git_SHA1_Final(sha1, &ctx); puts(sha1_to_hex(sha1)); - exit(0); + return 0; } From a6b107afd8d94435822e220dd304e83b46924821 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 2 Apr 2009 19:55:19 -0700 Subject: [PATCH 101/211] Remove extraneous ';' following empty loops Remove extra semicolons that were in fact unintended, silencing warnings. --- date.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/date.c b/date.c index 57331ed406e239..8849cec90f7d37 100644 --- a/date.c +++ b/date.c @@ -879,7 +879,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm const char *end = date; int i; - while (isalpha(*++end)); + while (isalpha(*++end)) ; for (i = 0; i < 12; i++) { From 02997e06dd3aa41a3d0391e9ee2002dc6fb47fd8 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:49:23 -0800 Subject: [PATCH 102/211] Replace empty loop bodies with 'continue' This avoids warnings. --- builtin/mailinfo.c | 2 +- diff-delta.c | 2 +- imap-send.c | 2 +- path.c | 2 +- quote.c | 4 ++-- setup.c | 3 ++- xdiff/xdiffi.c | 26 +++++++++++++------------- xdiff/xutils.c | 2 +- 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index da231400b327b8..2bac86816c3653 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -270,7 +270,7 @@ static void cleanup_space(struct strbuf *sb) for (pos = 0; pos < sb->len; pos++) { if (isspace(sb->buf[pos])) { sb->buf[pos] = ' '; - for (cnt = 0; isspace(sb->buf[pos + cnt + 1]); cnt++); + for (cnt = 0; isspace(sb->buf[pos + cnt + 1]); cnt++) continue; strbuf_remove(sb, pos + 1, cnt); } } diff --git a/diff-delta.c b/diff-delta.c index 93385e12baa0d9..baa451aa16e74e 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -155,7 +155,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) entries = 0xfffffffeU / RABIN_WINDOW; } hsize = entries / 4; - for (i = 4; (1u << i) < hsize && i < 31; i++); + for (i = 4; (1u << i) < hsize && i < 31; i++) continue; hsize = 1 << i; hmask = hsize - 1; diff --git a/imap-send.c b/imap-send.c index d42e4712972794..3752f63ff650b4 100644 --- a/imap-send.c +++ b/imap-send.c @@ -788,7 +788,7 @@ static int parse_response_code(struct imap_store *ctx, struct imap_cmd_cb *cb, /* RFC2060 says that these messages MUST be displayed * to the user */ - for (; isspace((unsigned char)*p); p++); + for (; isspace((unsigned char)*p); p++) continue; fprintf(stderr, "*** IMAP ALERT *** %s\n", p); } else if (cb && cb->ctx && !strcmp("APPENDUID", arg)) { if (!(arg = next_arg(&s)) || !(ctx->gen.uidvalidity = atoi(arg)) || diff --git a/path.c b/path.c index cbbdf7d6ba6816..286926f15e5cfd 100644 --- a/path.c +++ b/path.c @@ -590,7 +590,7 @@ int longest_ancestor_length(const char *path, const char *prefix_list) return -1; for (colon = ceil = prefix_list; *colon; ceil = colon+1) { - for (colon = ceil; *colon && *colon != PATH_SEP; colon++); + for (colon = ceil; *colon && *colon != PATH_SEP; colon++) continue; len = colon - ceil; if (len == 0 || len > PATH_MAX || !is_absolute_path(ceil)) continue; diff --git a/quote.c b/quote.c index 911229fdf3caff..0f1a9739da1a92 100644 --- a/quote.c +++ b/quote.c @@ -186,9 +186,9 @@ static size_t next_quote_pos(const char *s, ssize_t maxlen) { size_t len; if (maxlen < 0) { - for (len = 0; !sq_must_quote(s[len]); len++); + for (len = 0; !sq_must_quote(s[len]); len++) continue; } else { - for (len = 0; len < maxlen && !sq_must_quote(s[len]); len++); + for (len = 0; len < maxlen && !sq_must_quote(s[len]); len++) continue; } return len; } diff --git a/setup.c b/setup.c index 3a1b2fd45580ca..13bf7817083556 100644 --- a/setup.c +++ b/setup.c @@ -695,7 +695,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok) return setup_bare_git_dir(cwd, offset, len, nongit_ok); offset_parent = offset; - while (--offset_parent > ceil_offset && cwd[offset_parent] != '/'); + while (--offset_parent > ceil_offset && cwd[offset_parent] != '/') + continue; if (offset_parent <= ceil_offset) return setup_nongit(cwd, nongit_ok); if (one_filesystem) { diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c index 1b7012a119ad3e..2305ab61822102 100644 --- a/xdiff/xdiffi.c +++ b/xdiff/xdiffi.c @@ -102,7 +102,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1, i1 = kvdf[d + 1]; prev1 = i1; i2 = i1 - d; - for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++); + for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++) continue; if (i1 - prev1 > xenv->snake_cnt) got_snake = 1; kvdf[d] = i1; @@ -137,7 +137,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1, i1 = kvdb[d + 1] - 1; prev1 = i1; i2 = i1 - d; - for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--); + for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--) continue; if (prev1 - i1 > xenv->snake_cnt) got_snake = 1; kvdb[d] = i1; @@ -273,8 +273,8 @@ int xdl_recs_cmp(diffdata_t *dd1, long off1, long lim1, /* * Shrink the box by walking through each diagonal snake (SW and NE). */ - for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++); - for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--); + for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++) continue; + for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--) continue; /* * If one dimension is empty, then all records on the other one must @@ -420,7 +420,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * a zero at position -1 and N. */ for (; ix < nrec && !rchg[ix]; ix++) - while (rchgo[ixo++]); + while (rchgo[ixo++]) continue; if (ix == nrec) break; @@ -430,8 +430,8 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * indexes (ix and ixo). */ ixs = ix; - for (ix++; rchg[ix]; ix++); - for (; rchgo[ixo]; ixo++); + for (ix++; rchg[ix]; ix++) continue; + for (; rchgo[ixo]; ixo++) continue; do { grpsiz = ix - ixs; @@ -452,8 +452,8 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * the start index accordingly (and so the other-file * end-of-group index). */ - for (; rchg[ixs - 1]; ixs--); - while (rchgo[--ixo]); + for (; rchg[ixs - 1]; ixs--) continue; + while (rchgo[--ixo]) continue; } /* @@ -482,7 +482,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * index in case we are shifting together with a * corresponding group of changes in the other file. */ - for (; rchg[ix]; ix++); + for (; rchg[ix]; ix++) continue; while (rchgo[++ixo]) ixref = ix; } @@ -495,7 +495,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { while (ixref < ix) { rchg[--ixs] = 1; rchg[--ix] = 0; - while (rchgo[--ixo]); + while (rchgo[--ixo]) continue; } } @@ -513,8 +513,8 @@ int xdl_build_script(xdfenv_t *xe, xdchange_t **xscr) { */ for (i1 = xe->xdf1.nrec, i2 = xe->xdf2.nrec; i1 >= 0 || i2 >= 0; i1--, i2--) if (rchg1[i1 - 1] || rchg2[i2 - 1]) { - for (l1 = i1; rchg1[i1 - 1]; i1--); - for (l2 = i2; rchg2[i2 - 1]; i2--); + for (l1 = i1; rchg1[i1 - 1]; i1--) continue; + for (l2 = i2; rchg2[i2 - 1]; i2--) continue; if (!(xch = xdl_add_change(cscr, i1, i2, l1 - i1, l2 - i2))) { xdl_free_script(cscr); diff --git a/xdiff/xutils.c b/xdiff/xutils.c index 9504eaecb8ac45..25f2f13cfb3ce5 100644 --- a/xdiff/xutils.c +++ b/xdiff/xutils.c @@ -374,7 +374,7 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) { unsigned int xdl_hashbits(unsigned int size) { unsigned int val = 1, bits = 0; - for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++); + for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++) continue; return bits ? bits: 1; } From e369edad7b91178f88961965602ffd28f15dd511 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 19 Feb 2011 16:59:33 -0800 Subject: [PATCH 103/211] Guard gitmkstemps() with NO_MKSTEMPS --- wrapper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wrapper.c b/wrapper.c index 68739aaa3b9e9e..e3737170b8d1a2 100644 --- a/wrapper.c +++ b/wrapper.c @@ -348,11 +348,15 @@ int git_mkstemp_mode(char *pattern, int mode) return git_mkstemps_mode(pattern, 0, mode); } +#ifdef NO_MKSTEMPS + int gitmkstemps(char *pattern, int suffix_len) { return git_mkstemps_mode(pattern, suffix_len, 0600); } +#endif + int xmkstemp_mode(char *template, int mode) { int fd; From 714789a9a5a58e0e2ff87d9ed56349fafb0e5dc7 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 21 Feb 2011 15:23:23 -0800 Subject: [PATCH 104/211] Guard functions with NO_PTHREADS --- thread-utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thread-utils.c b/thread-utils.c index 7f4b76a95899cc..04a12e2ef1eee2 100644 --- a/thread-utils.c +++ b/thread-utils.c @@ -18,6 +18,8 @@ # endif #endif +#ifndef NO_PTHREADS + int online_cpus(void) { #ifdef _SC_NPROCESSORS_ONLN @@ -59,3 +61,5 @@ int init_recursive_mutex(pthread_mutex_t *m) } return ret; } + +#endif From 1ec0fd3419ce9da95785c180d53f8fa9becbc95f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 21 Apr 2009 08:43:47 -0700 Subject: [PATCH 105/211] Allow a platform to override LARGE_PACKET_MAX MacRelix needs this due to small stack sizes. --- sideband.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sideband.h b/sideband.h index d72db35d1e0dc1..1f61362083d5d3 100644 --- a/sideband.h +++ b/sideband.h @@ -5,7 +5,9 @@ #define SIDEBAND_REMOTE_ERROR -1 #define DEFAULT_PACKET_MAX 1000 +#ifndef LARGE_PACKET_MAX #define LARGE_PACKET_MAX 65520 +#endif int recv_sideband(const char *me, int in_stream, int out); ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max); From ed9a891075dd084ad6a8f9a66be1fc5234d65656 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 8 Apr 2009 23:03:24 -0700 Subject: [PATCH 106/211] Undefine conflicting PREFIX macro exec_cmd.c expects PREFIX to be defined by including cache.h, whereas sideband.c expects it to be undefined. Although sideband.c doesn't explicitly include cache.h, Lamp uses cache.h as a precompiled header, automatically included by all master source files. Undefine the PREFIX macro here to avoid the conflict. --- sideband.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sideband.c b/sideband.c index d5ffa1c8919a6d..f137f45097b6c1 100644 --- a/sideband.c +++ b/sideband.c @@ -12,6 +12,7 @@ * the remote died unexpectedly. A flush() concludes the stream. */ +#undef PREFIX #define PREFIX "remote:" #define ANSI_SUFFIX "\033[K" From 704bbddcc7bf0a2337e60a154ea55dce58a81bb2 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 8 Apr 2009 01:51:04 -0700 Subject: [PATCH 107/211] Cast compare_info() args to (const foo *const *) Cast compare_info() arguments to (const struct pack_info *const *) for the benefit of Metrowerks C 2.4.1. Otherwise, it reports "illegal implicit conversion from 'const void *' to 'struct pack_info *const *'". --- server-info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-info.c b/server-info.c index 9ec744e9f2da29..f2d64dbbe12bca 100644 --- a/server-info.c +++ b/server-info.c @@ -129,8 +129,8 @@ static int read_pack_info_file(const char *infofile) static int compare_info(const void *a_, const void *b_) { - struct pack_info *const *a = a_; - struct pack_info *const *b = b_; + const struct pack_info *const *a = a_; + const struct pack_info *const *b = b_; if (0 <= (*a)->old_num && 0 <= (*b)->old_num) /* Keep the order in the original */ From 5bb934ad82a917201ce90c540e75da77cbb8494c Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 19 Feb 2011 18:46:23 -0800 Subject: [PATCH 108/211] Allocate bidirectional_transfer_state dynamically The bidirectional_transfer_state struct is over 128K, exceeding both the 68K limit of 32K and our current default stack size of 64K. Allocate the struct with malloc() instead. --- transport-helper.c | 53 +++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/transport-helper.c b/transport-helper.c index cfe098849022fc..672f2d51a21de0 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -1194,26 +1194,39 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s) */ int bidirectional_transfer_loop(int input, int output) { - struct bidirectional_transfer_state state; + int status; + + struct bidirectional_transfer_state* state; + + state = malloc( sizeof (struct bidirectional_transfer_state) ); + + if ( state == NULL ) + { + return -1; + } /* Fill the state fields. */ - state.ptg.src = input; - state.ptg.dest = 1; - state.ptg.src_is_sock = (input == output); - state.ptg.dest_is_sock = 0; - state.ptg.state = SSTATE_TRANSFERING; - state.ptg.bufuse = 0; - state.ptg.src_name = "remote input"; - state.ptg.dest_name = "stdout"; - - state.gtp.src = 0; - state.gtp.dest = output; - state.gtp.src_is_sock = 0; - state.gtp.dest_is_sock = (input == output); - state.gtp.state = SSTATE_TRANSFERING; - state.gtp.bufuse = 0; - state.gtp.src_name = "stdin"; - state.gtp.dest_name = "remote output"; - - return tloop_spawnwait_tasks(&state); + state->ptg.src = input; + state->ptg.dest = 1; + state->ptg.src_is_sock = (input == output); + state->ptg.dest_is_sock = 0; + state->ptg.state = SSTATE_TRANSFERING; + state->ptg.bufuse = 0; + state->ptg.src_name = "remote input"; + state->ptg.dest_name = "stdout"; + + state->gtp.src = 0; + state->gtp.dest = output; + state->gtp.src_is_sock = 0; + state->gtp.dest_is_sock = (input == output); + state->gtp.state = SSTATE_TRANSFERING; + state->gtp.bufuse = 0; + state->gtp.src_name = "stdin"; + state->gtp.dest_name = "remote output"; + + status = tloop_spawnwait_tasks(state); + + free( state ); + + return status; } From 779fe30a6527112138be76cf6579ba174f5936a1 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 10 Mar 2010 05:24:54 -0800 Subject: [PATCH 109/211] Add a hand-made common-cmds.h, since one isn't generated yet. --- common-cmds.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 common-cmds.h diff --git a/common-cmds.h b/common-cmds.h new file mode 100644 index 00000000000000..540bd39e8aa835 --- /dev/null +++ b/common-cmds.h @@ -0,0 +1,23 @@ +struct cmdname_help +{ + char name[16]; + char help[80]; +}; + +static struct cmdname_help common_cmds[] = +{ + { "add", "" }, + { "branch", "" }, + { "checkout", "" }, + { "clone", "" }, + { "commit", "" }, + { "diff", "" }, + { "fetch", "" }, + { "init", "" }, + { "merge", "" }, + { "remote", "" }, + { "reset", "" }, + { "shortlog", "" }, + { "status", "" } +}; + From 11834567357f45b1ddf8337d46ed2956b0c508b9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 21 Apr 2009 08:48:17 -0700 Subject: [PATCH 110/211] Use vfork() and reexec(), not fork(), in MacRelix --- run-command.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/run-command.c b/run-command.c index 1101ef72378a50..0e3509996b9661 100644 --- a/run-command.c +++ b/run-command.c @@ -4,6 +4,12 @@ #include "sigchain.h" #include "argv-array.h" +#ifdef __RELIX__ +#define GIT_FORK() vfork() +#else +#define GIT_FORK() fork() +#endif + #ifndef SHELL_PATH # define SHELL_PATH "/bin/sh" #endif @@ -335,7 +341,7 @@ int start_command(struct child_process *cmd) if (pipe(notify_pipe)) notify_pipe[0] = notify_pipe[1] = -1; - cmd->pid = fork(); + cmd->pid = GIT_FORK(); if (!cmd->pid) { /* * Redirect the channel to write syscall error messages to @@ -621,6 +627,15 @@ static NORETURN void die_async(const char *err, va_list params) } #endif +static void run_async_proc(struct async *async, int proc_in, int proc_out) +{ +#ifdef __RELIX__ + (void) reexec(async->proc, proc_in, proc_out, async->data); +#else + exit(!!async->proc(proc_in, proc_out, async->data)); +#endif +} + int start_async(struct async *async) { int need_in, need_out; @@ -667,7 +682,7 @@ int start_async(struct async *async) /* Flush stdio before fork() to avoid cloning buffers */ fflush(NULL); - async->pid = fork(); + async->pid = GIT_FORK(); if (async->pid < 0) { error("fork (async) failed: %s", strerror(errno)); goto error; @@ -677,7 +692,7 @@ int start_async(struct async *async) close(fdin[1]); if (need_out) close(fdout[0]); - exit(!!async->proc(proc_in, proc_out, async->data)); + run_async_proc(async, proc_in, proc_out); } mark_child_for_cleanup(async->pid); From 0283a68b7a701bfc59636c526bbab38704897f46 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 18 Jun 2021 17:23:18 -0400 Subject: [PATCH 111/211] Exit without global destruction in start_command() The environ storage is shared between parent and child of reexec() -- so it's critical not to destroy it in the child. This fixes a crash due to memory corruption when using a git alias in MacRelix that only showed up after modifying the environ storage to refrain from throwing exceptions. --- run-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-command.c b/run-command.c index 0e3509996b9661..99333a729a49fd 100644 --- a/run-command.c +++ b/run-command.c @@ -424,7 +424,7 @@ int start_command(struct child_process *cmd) if (!cmd->silent_exec_failure) error("cannot run %s: %s", cmd->argv[0], strerror(ENOENT)); - exit(127); + _exit(127); } else { die_errno("cannot exec '%s'", cmd->argv[0]); } From 68172d1b22507d891e0fc1c5da64a73ca6237956 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:21:45 -0800 Subject: [PATCH 112/211] Explicitly return after calling noreturn functions Metrowerks C doesn't support the __noreturn__ attribute and doesn't know that die() and exit() don't return. --- builtin/blame.c | 3 +++ builtin/bundle.c | 3 +++ builtin/commit.c | 3 +++ builtin/fetch-pack.c | 3 +++ builtin/grep.c | 6 ++++++ builtin/help.c | 3 +++ builtin/mailsplit.c | 3 +++ builtin/pack-redundant.c | 3 +++ builtin/push.c | 3 +++ config.c | 3 +++ connect.c | 3 +++ date.c | 3 +++ diff.c | 3 +++ grep.c | 3 +++ help.c | 3 +++ imap-send.c | 3 +++ notes-merge.c | 3 +++ object.c | 3 +++ parse-options.c | 3 +++ read-cache.c | 3 +++ remote.c | 3 +++ revision.c | 3 +++ setup.c | 3 +++ shell.c | 3 +++ submodule.c | 3 +++ transport.c | 3 +++ 26 files changed, 81 insertions(+) diff --git a/builtin/blame.c b/builtin/blame.c index c27ef21c2326af..8633a81040e7f3 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2024,6 +2024,9 @@ static const char *parse_loc(const char *spec, regerror(reg_error, ®exp, errbuf, 1024); die("-L parameter '%s': %s", spec + 1, errbuf); } + + /* Not reached */ + return NULL; } /* diff --git a/builtin/bundle.c b/builtin/bundle.c index 92a8a6026a9bd6..5dc32796a4d372 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -62,4 +62,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix) list_bundle_refs(&header, argc, argv); } else usage(builtin_bundle_usage); + + /* Not reached */ + return 0; } diff --git a/builtin/commit.c b/builtin/commit.c index a17a5df4494e94..ab254edd0b16a4 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -925,6 +925,9 @@ static const char *find_author_by_nickname(const char *name) return strbuf_detach(&buf, NULL); } die(_("No existing author found with '%s'"), name); + + /* Not reached */ + return NULL; } diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index e6443986b81050..e8d3795fca524f 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -244,6 +244,9 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1) } } die("git fetch_pack: expected ACK/NAK, got '%s'", line); + + /* Not reached */ + return NAK; } static void send_request(int fd, struct strbuf *buf) diff --git a/builtin/grep.c b/builtin/grep.c index 82530a61b48373..9c75bd6e3f7e79 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -274,6 +274,9 @@ static int parse_pattern_type_arg(const char *opt, const char *arg) else if (!strcmp(arg, "perl")) return GREP_PATTERN_TYPE_PCRE; die("bad %s argument: %s", opt, arg); + + /* Not reached */ + return 0; } static void grep_pattern_type_options(const int pattern_type, struct grep_opt *opt) @@ -577,6 +580,9 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec, return hit; } die(_("unable to grep from object of type %s"), typename(obj->type)); + + /* Not reached */ + return 0; } static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec, diff --git a/builtin/help.c b/builtin/help.c index bd86253d835fce..e06e8b46d9fc95 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -63,6 +63,9 @@ static enum help_format parse_help_format(const char *format) if (!strcmp(format, "web") || !strcmp(format, "html")) return HELP_FORMAT_WEB; die(_("unrecognized help format '%s'"), format); + + /* Not reached */ + return HELP_FORMAT_NONE; } static const char *get_man_viewer_info(const char *name) diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index 2d4327801e4f77..554bdb7410eaa9 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -98,6 +98,9 @@ static int split_one(FILE *mbox, const char *name, int allow_bare) unlink(name); fprintf(stderr, "corrupt mailbox\n"); exit(1); + + /* Not reached */ + return 0; } static int populate_maildir_list(struct string_list *list, const char *path) diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index f5c6afc5dd46c8..209f62e5c5229b 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -580,6 +580,9 @@ static struct pack_list * add_pack_file(const char *filename) p = p->next; } die("Filename %s not found in packed_git", filename); + + /* Not reached */ + return NULL; } static void load_all(void) diff --git a/builtin/push.c b/builtin/push.c index db9ba30b08c221..f632f228ef6318 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -111,6 +111,9 @@ static NORETURN int die_push_simple(struct branch *branch, struct remote *remote "%s"), remote->name, short_upstream, remote->name, branch->name, advice_maybe); + + /* Not reached */ + return 0; } static void setup_push_upstream(struct remote *remote, int simple) diff --git a/config.c b/config.c index 08e47e2e48a5bd..0a2f1c2135d9e7 100644 --- a/config.c +++ b/config.c @@ -403,6 +403,9 @@ static int git_parse_file(config_fn_t fn, void *data) break; } die("bad config file line %d in %s", cf->linenr, cf->name); + + /* Not reached */ + return 0; } static int parse_unit_factor(const char *end, uintmax_t *val) diff --git a/connect.c b/connect.c index 49e56ba35a6453..7e2c82afb4adaf 100644 --- a/connect.c +++ b/connect.c @@ -186,6 +186,9 @@ static enum protocol get_protocol(const char *name) if (!strcmp(name, "file")) return PROTO_LOCAL; die("I don't handle protocol '%s'", name); + + /* Not reached */ + return (enum protocol)0; } #define STR_(s) # s diff --git a/date.c b/date.c index 57331ed406e239..f87d4c32feb874 100644 --- a/date.c +++ b/date.c @@ -734,6 +734,9 @@ enum date_mode parse_date_format(const char *format) return DATE_RAW; else die("unknown date format %s", format); + + /* Not reached */ + return DATE_NORMAL; } void datestamp(char *buf, int bufsize) diff --git a/diff.c b/diff.c index 35d3f073859acf..fb44e55d0d6c44 100644 --- a/diff.c +++ b/diff.c @@ -511,6 +511,9 @@ static struct diff_tempfile *claim_diff_tempfile(void) { if (!diff_temp[i].name) return diff_temp + i; die("BUG: diff is failing to clean up its tempfiles"); + + /* Not reached */ + return NULL; } static int remove_tempfile_installed; diff --git a/grep.c b/grep.c index edc7776677ed20..1c74ead5211774 100644 --- a/grep.c +++ b/grep.c @@ -1493,6 +1493,9 @@ static int grep_source_load(struct grep_source *gs) return gs->buf ? 0 : -1; } die("BUG: invalid grep_source type"); + + /* Not reached */ + return 0; } void grep_source_load_driver(struct grep_source *gs) diff --git a/help.c b/help.c index 2a42ec6d1f312b..23c5ae777708cc 100644 --- a/help.c +++ b/help.c @@ -376,6 +376,9 @@ const char *help_unknown_cmd(const char *cmd) } exit(1); + + /* Not reached */ + return NULL; } int cmd_version(int argc, const char **argv, const char *prefix) diff --git a/imap-send.c b/imap-send.c index d42e4712972794..8acb8536adc633 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1009,6 +1009,9 @@ static char *cram(const char *challenge_64, const char *user, const char *pass) { die("If you want to use CRAM-MD5 authenticate method, " "you have to build git-imap-send with OpenSSL library."); + + /* not reached */ + return NULL; } #endif diff --git a/notes-merge.c b/notes-merge.c index 0f67bd3f9605aa..48a2db24930340 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -465,6 +465,9 @@ static int merge_one_change(struct notes_merge_options *o, return 0; } die("Unknown strategy (%i).", o->strategy); + + /* Not reached */ + return 0; } static int merge_changes(struct notes_merge_options *o, diff --git a/object.c b/object.c index 4af3451bf89471..e4fb0ec769887b 100644 --- a/object.c +++ b/object.c @@ -41,6 +41,9 @@ int type_from_string(const char *str) if (!strcmp(str, object_type_strings[i])) return i; die("invalid object type \"%s\"", str); + + /* Not reached */ + return 0; } static unsigned int hash_obj(struct object *obj, unsigned int n) diff --git a/parse-options.c b/parse-options.c index c1c66bd408c506..ef604ccd25840d 100644 --- a/parse-options.c +++ b/parse-options.c @@ -147,6 +147,9 @@ static int get_value(struct parse_opt_ctx_t *p, default: die("should not happen, someone must be hit on the forehead"); } + + /* Not reached */ + return 0; } static int parse_short_opt(struct parse_opt_ctx_t *p, const struct option *options) diff --git a/read-cache.c b/read-cache.c index fda78bc353afcf..66978f5cdd8c82 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1493,6 +1493,9 @@ int read_index_from(struct index_state *istate, const char *path) unmap: munmap(mmap, mmap_size); die("index file corrupt"); + + /* Not reached */ + return 0; } int is_index_unborn(struct index_state *istate) diff --git a/remote.c b/remote.c index 04fd9ea4bd2f99..dfd2a77c9eeb74 100644 --- a/remote.c +++ b/remote.c @@ -633,6 +633,9 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp return NULL; } die("Invalid refspec '%s'", refspec[i]); + + /* Not reached */ + return NULL; } int valid_fetch_refspec(const char *fetch_refspec_str) diff --git a/revision.c b/revision.c index a09e60bedbbbf2..2a4db89e25aec2 100644 --- a/revision.c +++ b/revision.c @@ -316,6 +316,9 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object return NULL; } die("%s is unknown object", name); + + /* Not reached */ + return NULL; } static int everybody_uninteresting(struct commit_list *orig) diff --git a/setup.c b/setup.c index 3a1b2fd45580ca..8ee0703ec8323e 100644 --- a/setup.c +++ b/setup.c @@ -71,6 +71,9 @@ int check_filename(const char *prefix, const char *arg) if (errno == ENOENT || errno == ENOTDIR) return 0; /* file does not exist */ die_errno("failed to stat '%s'", arg); + + /* Not reached */ + return 0; } static void NORETURN die_verify_filename(const char *prefix, diff --git a/shell.c b/shell.c index 84b237fef352e2..c82ca292bb3ab0 100644 --- a/shell.c +++ b/shell.c @@ -217,4 +217,7 @@ int main(int argc, char **argv) die("invalid command format '%s': %s", argv[2], split_cmdline_strerror(count)); } + + /* Not reached */ + return 0; } diff --git a/submodule.c b/submodule.c index 50f213e926374e..36dd2eeb0655ce 100644 --- a/submodule.c +++ b/submodule.c @@ -254,6 +254,9 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg) return RECURSE_SUBMODULES_ON_DEMAND; die("bad %s argument: %s", opt, arg); } + + /* Not reached */ + return 0; } void show_submodule_summary(FILE *f, const char *path, diff --git a/transport.c b/transport.c index 9932f402dfee26..60bb65600fa4d2 100644 --- a/transport.c +++ b/transport.c @@ -1182,6 +1182,9 @@ int transport_connect(struct transport *transport, const char *name, return transport->connect(transport, name, exec, fd); else die("Operation not supported by protocol"); + + /* Not reached */ + return 0; } int transport_disconnect(struct transport *transport) From 17244926ecdeb1b67eb93e24dc9c7f6a7b54ff1d Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 10 Apr 2024 18:53:42 -0400 Subject: [PATCH 113/211] Update GIT_VERSION to 1.8.0.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index ab24a81ec6b79d..7900a94fd5f95e 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.0" +#define GIT_VERSION "1.8.0.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From f27ece9c1b8eef2cc852825b176f0e5a5f714045 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 11 Apr 2024 05:06:32 -0400 Subject: [PATCH 114/211] Update GIT_VERSION to 1.8.0.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 7900a94fd5f95e..04a2d6902daa0a 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.0.1" +#define GIT_VERSION "1.8.0.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From dcbae5f563f0f2453ec02fa58bb906c5ad6875bc Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 12 Apr 2024 15:15:07 -0400 Subject: [PATCH 115/211] Update GIT_VERSION to 1.8.0.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 04a2d6902daa0a..a4c4702d14c733 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.0.2" +#define GIT_VERSION "1.8.0.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From f117b1dac215ddaf3a651484815e22202d8eaf99 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 12 Apr 2024 22:56:01 -0400 Subject: [PATCH 116/211] Source.list: Add new v1.8.1 source files --- A-line.confd/Source.list | 3 +++ 1 file changed, 3 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index e8067b08f2ff98..feec70ff6a8252 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -148,6 +148,7 @@ entry.c environment.c exec_cmd.c fast-import.c +fetch-pack.c fsck.c git.c gpg-interface.c @@ -171,6 +172,7 @@ lockfile.c log-tree.c mailmap.c match-trees.c +merge.c merge-file.c merge-recursive.c mergesort.c @@ -205,6 +207,7 @@ rerere.c resolve-undo.c revision.c run-command.c +send-pack.c sequencer.c server-info.c setup.c From 5d4570759e5c19f9de7b6a240161eef2dd4e8ac6 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 12 Apr 2024 22:59:52 -0400 Subject: [PATCH 117/211] Explicitly return after calling noreturn function --- fetch-pack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fetch-pack.c b/fetch-pack.c index 099ff4ddffecee..2d9df8e0c96efd 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -236,6 +236,9 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1) } } die("git fetch_pack: expected ACK/NAK, got '%s'", line); + + /* Not reached */ + return NAK; } static void send_request(struct fetch_pack_args *args, From 4bcf4586fc1f09ecd6a2ca86a3ca1078e9b08be5 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 12 Apr 2024 22:49:58 -0400 Subject: [PATCH 118/211] Redefine `delete` to `delete_` for C++ initializer --- builtin/symbolic-ref.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index 9aabda05af9343..6703382425be7c 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -33,13 +33,14 @@ static int check_symref(const char *HEAD, int quiet, int shorten, int print) int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) { - int quiet = 0, delete = 0, shorten = 0, ret = 0; - const char *msg = NULL; - #ifdef USE_CPLUSPLUS_FOR_INIT #pragma cplusplus on +#define delete delete_ #endif + int quiet = 0, delete = 0, shorten = 0, ret = 0; + const char *msg = NULL; + struct option options[] = { OPT__QUIET(&quiet, N_("suppress error message for non-symbolic (detached) refs")), From 3e121f952bea443a4d01c790c0716bb497063777 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 12 Apr 2024 23:04:35 -0400 Subject: [PATCH 119/211] Update GIT_VERSION to 1.8.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index a4c4702d14c733..d1209e3d1f377a 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.0.3" +#define GIT_VERSION "1.8.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 4233ed1c357287cb7eaf57bb4642f08d1e69751b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 14 Apr 2024 03:12:56 -0400 Subject: [PATCH 120/211] Update GIT_VERSION to 1.8.1.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index d1209e3d1f377a..70afb08cd6194e 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.1" +#define GIT_VERSION "1.8.1.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 5ddf5b3b1163387adef03894cc6a981a67ec3945 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 16 Apr 2024 04:55:02 -0400 Subject: [PATCH 121/211] Update GIT_VERSION to 1.8.1.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 70afb08cd6194e..ce905645de1f38 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.1.1" +#define GIT_VERSION "1.8.1.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From a7dc4ae02287dd0832a194578562dda195433022 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 17 Apr 2024 02:29:42 -0400 Subject: [PATCH 122/211] Source.list: Rename merge-file.c to merge-blobs.c --- A-line.confd/Source.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index feec70ff6a8252..fd91ba2865f28d 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -173,7 +173,7 @@ log-tree.c mailmap.c match-trees.c merge.c -merge-file.c +merge-blobs.c merge-recursive.c mergesort.c name-hash.c From 9276e3418da6c481c32f9e98e2c2d3887cd54ba0 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 17 Apr 2024 02:27:17 -0400 Subject: [PATCH 123/211] Update GIT_VERSION to 1.8.1.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index ce905645de1f38..5e0cc56dd90d63 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.1.2" +#define GIT_VERSION "1.8.1.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 7d69f68bdffdcd23f198740f8c15f8034d9355cb Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 20 Apr 2024 22:19:32 -0400 Subject: [PATCH 124/211] Update GIT_VERSION to 1.8.1.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 5e0cc56dd90d63..bb174ba8e0dcfa 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.1.3" +#define GIT_VERSION "1.8.1.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From bcb248eff28643c9029a3117bdb794631713ea73 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 21 Apr 2024 01:45:24 -0400 Subject: [PATCH 125/211] Update GIT_VERSION to 1.8.1.5 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index bb174ba8e0dcfa..7ad58e3bf72596 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.1.4" +#define GIT_VERSION "1.8.1.5" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From cb8ecece48d0b466174ff8b8b8a6b55567375cf6 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 21 Apr 2024 11:21:14 -0400 Subject: [PATCH 126/211] object.c: Explicitly return after calling die() --- object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/object.c b/object.c index e714310d9ccf96..f15c7bb1845d1b 100644 --- a/object.c +++ b/object.c @@ -196,6 +196,8 @@ struct object *parse_object_or_die(const unsigned char *sha1, return o; die(_("unable to parse object: %s"), name ? name : sha1_to_hex(sha1)); + + return o; } struct object *parse_object(const unsigned char *sha1) From 3469b9a247377519edd3810879175d5548ec4564 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 21 Apr 2024 11:10:36 -0400 Subject: [PATCH 127/211] Update GIT_VERSION to 1.8.1.6 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 7ad58e3bf72596..6ef98e2c12f112 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.1.5" +#define GIT_VERSION "1.8.1.6" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From ce9d7f4ea3285e30c66787f93dbfb96c0c463ed3 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 00:36:51 -0400 Subject: [PATCH 128/211] dir.c: Define git_fnmatch() extern, not inline --- dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dir.c b/dir.c index 1e42b2b1509e2c..20472b81456373 100644 --- a/dir.c +++ b/dir.c @@ -37,7 +37,7 @@ int fnmatch_icase(const char *pattern, const char *string, int flags) return fnmatch(pattern, string, flags | (ignore_case ? FNM_CASEFOLD : 0)); } -inline int git_fnmatch(const char *pattern, const char *string, +int git_fnmatch(const char *pattern, const char *string, int flags, int prefix) { int fnm_flags = 0; From 3f41f7f6e6f29d580e02d9d54298f46ed3e158ab Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 00:36:17 -0400 Subject: [PATCH 129/211] Source.list: Add new v1.8.2 source files --- A-line.confd/Source.list | 3 +++ 1 file changed, 3 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index fd91ba2865f28d..3ad24d82b49176 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -22,6 +22,7 @@ builtin/branch.c builtin/bundle.c builtin/cat-file.c builtin/check-attr.c +builtin/check-ignore.c builtin/check-ref-format.c builtin/checkout-index.c builtin/checkout.c @@ -191,6 +192,7 @@ parse-options-cb.c patch-delta.c patch-ids.c path.c +pathspec.c pkt-line.c preload-index.c pretty.c @@ -255,6 +257,7 @@ utf8.c varint.c version.c walker.c +wildmatch.c wrapper.c write_or_die.c ws.c From eda2002758403fda11a505c916a83fc204dfc46a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 00:21:19 -0400 Subject: [PATCH 130/211] Update GIT_VERSION to 1.8.2.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 6ef98e2c12f112..a5bb9f247bcdd3 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.1.6" +#define GIT_VERSION "1.8.2.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 3e7416ea3e821741cfa83058b0fc1a191afd85e7 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 02:01:05 -0400 Subject: [PATCH 131/211] combine-diff.c: Add `continue` to empty loop body --- combine-diff.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/combine-diff.c b/combine-diff.c index 6288485965b5f7..2c937f6b1ff1c4 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -128,8 +128,8 @@ static int match_string_spaces(const char *line1, int len1, long flags) { if (flags & XDF_WHITESPACE_FLAGS) { - for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--); - for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--); + for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--) continue; + for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--) continue; } if (!(flags & (XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_CHANGE))) @@ -143,8 +143,8 @@ static int match_string_spaces(const char *line1, int len1, (!XDL_ISSPACE(line1[len1]) || !XDL_ISSPACE(line2[len2]))) return 0; - for (; len1 > 0 && XDL_ISSPACE(line1[len1]); len1--); - for (; len2 > 0 && XDL_ISSPACE(line2[len2]); len2--); + for (; len1 > 0 && XDL_ISSPACE(line1[len1]); len1--) continue; + for (; len2 > 0 && XDL_ISSPACE(line2[len2]); len2--) continue; } if (line1[len1] != line2[len2]) return 0; @@ -152,8 +152,8 @@ static int match_string_spaces(const char *line1, int len1, if (flags & XDF_IGNORE_WHITESPACE) { /* Consume remaining spaces */ - for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--); - for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--); + for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--) continue; + for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--) continue; } /* We matched full line1 and line2 */ From e560b50f9454eb3def10cc90b1315576a736ebe1 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 01:51:55 -0400 Subject: [PATCH 132/211] Update GIT_VERSION to 1.8.2.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index a5bb9f247bcdd3..78a854ea2279ba 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.2.1" +#define GIT_VERSION "1.8.2.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From de06bdfd4a180bb0fd2781e5d32cc0de719c185f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 02:47:47 -0400 Subject: [PATCH 133/211] Update GIT_VERSION to 1.8.2.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 78a854ea2279ba..f864288871d024 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.2.2" +#define GIT_VERSION "1.8.2.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 226303782e96c13dc775547f24c47ccac14f3319 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 07:42:09 -0400 Subject: [PATCH 134/211] pretty.c: Silence uninitialized variable warning --- pretty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pretty.c b/pretty.c index 9e431545d8e6c1..55769b92612a7b 100644 --- a/pretty.c +++ b/pretty.c @@ -1501,7 +1501,7 @@ void format_commit_message(const struct commit *commit, } if (output_enc) { - int outsz; + int outsz = 0; char *out = reencode_string_len(sb->buf, sb->len, output_enc, utf8, &outsz); if (out) From eb8b8366fa806bd101af86a36311eef6b37be91a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 03:37:10 -0400 Subject: [PATCH 135/211] Update GIT_VERSION to 1.8.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index f864288871d024..b0c42b5c36ea98 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.2.3" +#define GIT_VERSION "1.8.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 7ee81729865a1410aae581fbb792eb27f460be5b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 08:56:29 -0400 Subject: [PATCH 136/211] Update GIT_VERSION to 1.8.3.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index b0c42b5c36ea98..b67cd48d994877 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.3" +#define GIT_VERSION "1.8.3.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 45955707932fab961738c036b4f0d2b413de671a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 23 Apr 2024 00:24:44 -0400 Subject: [PATCH 137/211] Update GIT_VERSION to 1.8.3.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index b67cd48d994877..c322543b27e59a 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.3.1" +#define GIT_VERSION "1.8.3.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 26370be4e83f185d154637c084807d3a0b87a4ec Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 23 Apr 2024 10:19:49 -0400 Subject: [PATCH 138/211] Update GIT_VERSION to 1.8.3.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index c322543b27e59a..c07b9ab486c501 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.3.2" +#define GIT_VERSION "1.8.3.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From ad270b0c40da81fa53776df3f5ebef92e63ff646 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 23 Apr 2024 11:16:31 -0400 Subject: [PATCH 139/211] Update GIT_VERSION to 1.8.3.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index c07b9ab486c501..9dc44c59793b00 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.3.3" +#define GIT_VERSION "1.8.3.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 06c6cf4ece8ddf05e32d090325475b1cc58cacc9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 23 Apr 2024 13:57:54 -0400 Subject: [PATCH 140/211] Source.list: Update v1.8.4 source file set --- A-line.confd/Source.list | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 3ad24d82b49176..27e7c155628b6b 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -23,6 +23,7 @@ builtin/bundle.c builtin/cat-file.c builtin/check-attr.c builtin/check-ignore.c +builtin/check-mailmap.c builtin/check-ref-format.c builtin/checkout-index.c builtin/checkout.c @@ -167,6 +168,8 @@ ident.c imap-send.c kwset.c levenshtein.c +line-log.c +line-range.c list-objects.c ll-merge.c lockfile.c @@ -181,9 +184,9 @@ name-hash.c notes.c notes-cache.c notes-merge.c +notes-utils.c object.c pack-check.c -pack-refs.c pack-revindex.c pack-write.c pager.c @@ -196,6 +199,7 @@ pathspec.c pkt-line.c preload-index.c pretty.c +prio-queue.c progress.c prompt.c quote.c From 0cb7e510b018727fd8022a95b2b11a7023037269 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 23 Apr 2024 13:44:28 -0400 Subject: [PATCH 141/211] Update GIT_VERSION to 1.8.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 9dc44c59793b00..fe79404b1fc76e 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.3.4" +#define GIT_VERSION "1.8.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From c136f5da2ce2252059e1a663f8e8d4d126165c8f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 00:21:58 -0400 Subject: [PATCH 142/211] Update GIT_VERSION to 1.8.4.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index fe79404b1fc76e..9651ccc7542ab1 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.4" +#define GIT_VERSION "1.8.4.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From bd4ed0d9535995e17066d51f7211524c97a008a6 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 01:01:59 -0400 Subject: [PATCH 143/211] Update GIT_VERSION to 1.8.4.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 9651ccc7542ab1..bca5e2bd115676 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.4.1" +#define GIT_VERSION "1.8.4.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From b65dfd6f574145b8a879f9836163840445bd441a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 04:48:26 -0400 Subject: [PATCH 144/211] Update GIT_VERSION to 1.8.4.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index bca5e2bd115676..5543570a85e76e 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.4.2" +#define GIT_VERSION "1.8.4.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 381607afa18938096aac1d0a6283c5e97b70127b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 13:31:43 -0400 Subject: [PATCH 145/211] Update GIT_VERSION to 1.8.4.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 5543570a85e76e..91edc6219ac801 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.4.3" +#define GIT_VERSION "1.8.4.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 0ee52a69fef1fa267984c0d83fff0f6c1f35c69c Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 14:48:58 -0400 Subject: [PATCH 146/211] Use C++ to initialize aggregates to dynamic values --- builtin/repack.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/repack.c b/builtin/repack.c index a0ff5c704f4e21..c3f004880194e6 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -138,6 +138,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix) int quiet = 0; int local = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_repack_options[] = { OPT_BIT('a', NULL, &pack_everything, N_("pack everything in a single pack"), ALL_INTO_ONE), @@ -168,6 +172,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(repack_config, NULL); argc = parse_options(argc, argv, prefix, builtin_repack_options, From 22308b9e5909b795fa4172724d50ba26d60b76db Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 14:46:47 -0400 Subject: [PATCH 147/211] Source.list: Add new v1.8.5 source files --- A-line.confd/Source.list | 2 ++ 1 file changed, 2 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 27e7c155628b6b..fd42ee06602834 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -83,6 +83,7 @@ builtin/reflog.c builtin/remote.c builtin/remote-ext.c builtin/remote-fd.c +builtin/repack.c builtin/replace.c builtin/rerere.c builtin/reset.c @@ -255,6 +256,7 @@ tree.c unpack-trees.c upload-pack.c url.c +urlmatch.c usage.c userdiff.c utf8.c From ba42aa2f4f778656bce117223b38f54225b7e86a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 14:39:52 -0400 Subject: [PATCH 148/211] Update GIT_VERSION to 1.8.5 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 91edc6219ac801..c477cb7d54ee46 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.4.4" +#define GIT_VERSION "1.8.5" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From e90b68d56e6dedceb778f6342c02784f61ac576f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 15:57:21 -0400 Subject: [PATCH 149/211] Update GIT_VERSION to 1.8.5.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index c477cb7d54ee46..01f231260a17d1 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.5" +#define GIT_VERSION "1.8.5.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 733026b7c2b12d80568eced1ad4ff4a47525b68f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 16:00:27 -0400 Subject: [PATCH 150/211] Update GIT_VERSION to 1.8.5.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 01f231260a17d1..2ae5725e04e184 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.5.1" +#define GIT_VERSION "1.8.5.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 60e837290cc865886cb87a6c481a8ed5a5b59f2c Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 16:11:20 -0400 Subject: [PATCH 151/211] Update GIT_VERSION to 1.8.5.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 2ae5725e04e184..77927043d47372 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.5.2" +#define GIT_VERSION "1.8.5.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 99dc19c8596d433eded1baa761b97fd961b6bad2 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 24 Apr 2024 16:56:22 -0400 Subject: [PATCH 152/211] Update GIT_VERSION to 1.8.5.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 77927043d47372..ae767a3c06cdb2 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.5.3" +#define GIT_VERSION "1.8.5.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 48c871e4da407f0660d7fa77ffc71e350bead4dd Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 00:04:17 -0400 Subject: [PATCH 153/211] Update GIT_VERSION to 1.8.5.5 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index ae767a3c06cdb2..66848e98ff05a4 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.5.4" +#define GIT_VERSION "1.8.5.5" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 37f0ffdee0c9ac0f6ae8b92f677e4b369102f18d Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 01:30:02 -0400 Subject: [PATCH 154/211] Source.list: Update v1.9.0 source file set --- A-line.confd/Source.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index fd42ee06602834..a2aaae0d94ec0f 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -47,6 +47,7 @@ builtin/fmt-merge-msg.c builtin/for-each-ref.c builtin/fsck.c builtin/gc.c +builtin/get-tar-commit-id.c builtin/grep.c builtin/hash-object.c builtin/help.c @@ -98,7 +99,6 @@ builtin/show-ref.c builtin/stripspace.c builtin/symbolic-ref.c builtin/tag.c -builtin/tar-tree.c builtin/unpack-file.c builtin/unpack-objects.c builtin/update-index.c From a9caff811e20c11e25bec17aa938f6f744b2cf3c Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 01:19:50 -0400 Subject: [PATCH 155/211] Update GIT_VERSION to 1.9.0 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 66848e98ff05a4..cde09e5d9abb29 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.8.5.5" +#define GIT_VERSION "1.9.0" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 8a067b6151c41e5f1fa9690e964696ff53ad5d3f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 02:46:46 -0400 Subject: [PATCH 156/211] Update GIT_VERSION to 1.9.1 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index cde09e5d9abb29..328251810b8880 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.9.0" +#define GIT_VERSION "1.9.1" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From f060723447e47a62eb549b4a8df86e42708cba5a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 10:04:21 -0400 Subject: [PATCH 157/211] wt-status.c: Explicitly return after calling die() --- wt-status.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wt-status.c b/wt-status.c index 9bf96c3af064bc..c0ffbb2d04eefa 100644 --- a/wt-status.c +++ b/wt-status.c @@ -265,6 +265,9 @@ static const char *wt_status_unmerged_status_string(int stagemask) default: die(_("bug: unhandled unmerged status %x"), stagemask); } + + /* Not reached */ + return NULL; } static const char *wt_status_diff_status_string(int status) From d4b9178968988c11d2c31d64b342379f29b7e2c4 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 09:35:09 -0400 Subject: [PATCH 158/211] Update GIT_VERSION to 1.9.2 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 328251810b8880..359f7ed5ef624d 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.9.1" +#define GIT_VERSION "1.9.2" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From f0e27184bcbe79393a887c858592057446a9bc2b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 10:17:40 -0400 Subject: [PATCH 159/211] Update GIT_VERSION to 1.9.3 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 359f7ed5ef624d..7d06066dc9c791 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.9.2" +#define GIT_VERSION "1.9.3" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 266a317d31d05b036948cf8d07294717a920bf19 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 25 Apr 2024 10:23:44 -0400 Subject: [PATCH 160/211] Update GIT_VERSION to 1.9.4 --- compat/relix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/relix.h b/compat/relix.h index 7d06066dc9c791..305cd75a44fe32 100644 --- a/compat/relix.h +++ b/compat/relix.h @@ -8,7 +8,7 @@ // Include early so git's macros don't interfere with it later #include -#define GIT_VERSION "1.9.3" +#define GIT_VERSION "1.9.4" // MacRelix has small thread stacks, and 68K has a hard 32K local data limit. #define LARGE_PACKET_MAX (16384 - 16) From 6320bbe5578528d78ef505511f595ea1cd4afb8d Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 20 Dec 2023 23:35:57 -0500 Subject: [PATCH 161/211] Avoid broken PPC optimization of collect_parents() Added in b5d887f90692515a6e9c99e7683533d12df3ade2, the collect_parents() function is miscompiled by Metrowerks C++ 2.4.1 at an optimization level of 2 or above. The optimizer fails to recognize that remoteheads (which is on the stack) can be changed by the call to commit_list_insert(), due to its address being stored in remotes (which is passed as an argument), and returns NULL (the initial value of remoteheads) instead of the value it actually has by that point. This led to unchecked NULL dereferences. Included in e78cbf8cbb61edfbdef5d33262f9b8cf02a3afca are patches for the NULL dereferences, but the underlying problem persists, yielding another issue: A simple fast-forward merge always reports "Already up-to-date." --- builtin/merge.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/merge.c b/builtin/merge.c index 66d8843301b22a..3f0a8d3c76ea93 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1051,6 +1051,10 @@ static int default_edit_option(void) st_stdin.st_mode == st_stdout.st_mode); } +#if defined(__MWERKS__) && defined(__POWERPC__) +#pragma optimization_level 1 +#endif + static struct commit_list *collect_parents(struct commit *head_commit, int *head_subsumed, int argc, const char **argv) @@ -1086,6 +1090,10 @@ static struct commit_list *collect_parents(struct commit *head_commit, return remoteheads; } +#if defined(__MWERKS__) && defined(__POWERPC__) +#pragma optimization_level reset +#endif + int cmd_merge(int argc, const char **argv, const char *prefix) { unsigned char result_tree[20]; From 175f94e954fe5f7459150446961ce4273da4253d Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 29 Nov 2009 04:14:12 -0800 Subject: [PATCH 162/211] Use C++ to initialize aggregates to dynamic values Metrowerks C won't initialize an aggregate with values undetermined at compile time, but Metrowerks C++ will, so use it instead. In some cases 'new' and 'delete' have to be defined to something else. --- archive.c | 17 ++++++++ bisect.c | 8 ++++ builtin/apply.c | 8 ++++ builtin/archive.c | 9 ++++ builtin/bisect--helper.c | 9 ++++ builtin/branch.c | 9 ++++ builtin/cat-file.c | 8 ++++ builtin/checkout-index.c | 9 ++++ builtin/checkout.c | 9 ++++ builtin/clean.c | 9 ++++ builtin/column.c | 8 ++++ builtin/count-objects.c | 9 ++++ builtin/describe.c | 9 ++++ builtin/fast-export.c | 9 ++++ builtin/fetch.c | 8 ++++ builtin/fmt-merge-msg.c | 9 ++++ builtin/for-each-ref.c | 8 ++++ builtin/gc.c | 8 ++++ builtin/grep.c | 8 ++++ builtin/init-db.c | 9 ++++ builtin/log.c | 24 +++++++++++ builtin/ls-files.c | 9 ++++ builtin/ls-tree.c | 8 ++++ builtin/merge-base.c | 8 ++++ builtin/merge-file.c | 9 ++++ builtin/merge-index.c | 8 ++++ builtin/mktree.c | 8 ++++ builtin/mv.c | 10 +++++ builtin/name-rev.c | 9 ++++ builtin/notes.c | 79 ++++++++++++++++++++++++++++++++++++ builtin/pack-objects.c | 8 ++++ builtin/pack-refs.c | 10 +++++ builtin/prune-packed.c | 8 ++++ builtin/push.c | 8 ++++ builtin/read-tree.c | 9 ++++ builtin/remote.c | 68 +++++++++++++++++++++++++++++++ builtin/repack.c | 12 ++++++ builtin/replace.c | 9 ++++ builtin/rerere.c | 8 ++++ builtin/reset.c | 9 ++++ builtin/revert.c | 9 ++++ builtin/show-branch.c | 9 ++++ builtin/symbolic-ref.c | 10 +++++ builtin/tag.c | 10 +++++ builtin/update-index.c | 8 ++++ builtin/update-ref.c | 9 ++++ builtin/update-server-info.c | 9 ++++ builtin/upload-archive.c | 8 ++++ builtin/verify-pack.c | 9 ++++ builtin/verify-tag.c | 9 ++++ builtin/write-tree.c | 9 ++++ daemon.c | 8 ++++ editor.c | 9 ++++ imap-send.c | 9 ++++ run-command.c | 8 ++++ submodule.c | 16 ++++++++ transport-helper.c | 9 ++++ 57 files changed, 659 insertions(+) diff --git a/archive.c b/archive.c index 3fc0fb2928f100..0d7fdbddc40ffc 100644 --- a/archive.c +++ b/archive.c @@ -216,6 +216,10 @@ static int reject_entry(const unsigned char *sha1, const char *base, static int path_exists(struct tree *tree, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *paths[] = { path, NULL }; struct pathspec pathspec; int ret; @@ -224,6 +228,10 @@ static int path_exists(struct tree *tree, const char *path) ret = read_tree_recursive(tree, "", 0, 0, &pathspec, reject_entry, NULL); free_pathspec(&pathspec); return ret != 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif } static void parse_pathspec_arg(const char **pathspec, @@ -323,6 +331,11 @@ static int parse_archive_args(int argc, const char **argv, int i; int list = 0; int worktree_attributes = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_GROUP(""), OPT_STRING(0, "format", &format, N_("fmt"), N_("archive format")), @@ -354,6 +367,10 @@ static int parse_archive_args(int argc, const char **argv, OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, opts, archive_usage, 0); if (remote) diff --git a/bisect.c b/bisect.c index d6e851d783c354..39664e9b161a89 100644 --- a/bisect.c +++ b/bisect.c @@ -597,9 +597,17 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix, const char *bad_format, const char *good_format, int read_paths) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct argv_array rev_argv = ARGV_ARRAY_INIT; int i; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + init_revisions(revs, prefix); revs->abbrev = 0; revs->commit_format = CMIT_FMT_UNSPECIFIED; diff --git a/builtin/apply.c b/builtin/apply.c index 9c5724eaccfaee..5518dd41d22185 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4355,6 +4355,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) const char *whitespace_option = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_apply_options[] = { { OPTION_CALLBACK, 0, "exclude", NULL, N_("path"), N_("don't apply changes matching the given path"), @@ -4422,6 +4426,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + prefix = prefix_; prefix_length = prefix ? strlen(prefix) : 0; git_config(git_apply_config, NULL); diff --git a/builtin/archive.c b/builtin/archive.c index a1e3b940c25ac2..f3840efa974150 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -84,6 +84,11 @@ int cmd_archive(int argc, const char **argv, const char *prefix) const char *exec = "git-upload-archive"; const char *output = NULL; const char *remote = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option local_opts[] = { OPT_STRING('o', "output", &output, N_("file"), N_("write the archive to this file")), @@ -94,6 +99,10 @@ int cmd_archive(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, local_opts, NULL, PARSE_OPT_KEEP_ALL); diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 3324229025300f..3ae8977c8ef02d 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -12,6 +12,11 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { int next_all = 0; int no_checkout = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL(0, "next-all", &next_all, N_("perform 'git bisect next'")), @@ -20,6 +25,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_bisect_helper_usage, 0); diff --git a/builtin/branch.c b/builtin/branch.c index 652b1d2d148403..3d287aac4ea104 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -790,6 +790,11 @@ static int edit_branch_description(const char *branch_name) int cmd_branch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int delete = 0, rename = 0, force_create = 0, list = 0; int verbose = 0, abbrev = -1, detached = 0; int reflog = 0, edit_description = 0; @@ -855,6 +860,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_branch_usage, options); diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 707330499fad66..fdeb8ccc1ad996 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -365,6 +365,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) const char *exp_type = NULL, *obj_name = NULL; struct batch_options batch = {0}; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT_GROUP(N_(" can be one of: blob, tree, commit, tag")), OPT_SET_INT('t', NULL, &opt, N_("show object type"), 't'), @@ -383,6 +387,10 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_cat_file_config, NULL); if (argc != 3 && argc != 2) diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 61e75eb60c992e..2e18fd7322d519 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -182,6 +182,11 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) int read_from_stdin = 0; int prefix_length; int force = 0, quiet = 0, not_new = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_checkout_index_options[] = { OPT_BOOL('a', "all", &all, N_("check out all files in the index")), @@ -209,6 +214,10 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_checkout_index_usage, builtin_checkout_index_options); diff --git a/builtin/checkout.c b/builtin/checkout.c index 07cf55530918e8..ca58d810681403 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1081,6 +1081,11 @@ static int checkout_branch(struct checkout_opts *opts, int cmd_checkout(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define new new_ +#endif + struct checkout_opts opts; struct branch_info new; char *conflict_style = NULL; @@ -1113,6 +1118,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); memset(&new, 0, sizeof(new)); opts.overwrite_ignore = 1; diff --git a/builtin/clean.c b/builtin/clean.c index 9a9151575d3a8d..e2d78ba03676ac 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -871,6 +871,11 @@ int cmd_clean(int argc, const char **argv, const char *prefix) struct exclude_list *el; struct string_list_item *item; const char *qname; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__QUIET(&quiet, N_("do not print names of files removed")), OPT__DRY_RUN(&dry_run, N_("dry run")), @@ -886,6 +891,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_clean_config, NULL); if (force < 0) force = 0; diff --git a/builtin/column.c b/builtin/column.c index 75818520e1b74d..f5b48706e1732b 100644 --- a/builtin/column.c +++ b/builtin/column.c @@ -18,6 +18,10 @@ static int column_config(const char *var, const char *value, void *cb) int cmd_column(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct string_list list = STRING_LIST_INIT_DUP; struct strbuf sb = STRBUF_INIT; struct column_options copts; @@ -33,6 +37,10 @@ int cmd_column(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* This one is special and must be the first one */ if (argc > 1 && starts_with(argv[1], "--command=")) { command = argv[1] + 10; diff --git a/builtin/count-objects.c b/builtin/count-objects.c index a7f70cb858e657..586a7b8078248a 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -91,6 +91,11 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) char *path = xmalloc(len + 50); unsigned long loose = 0, packed = 0, packed_loose = 0; off_t loose_size = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT__VERBOSE(&verbose, N_("be verbose")), OPT_BOOL('H', "human-readable", &human_readable, @@ -98,6 +103,10 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0); /* we do not take arguments other than flags for now */ if (argc) diff --git a/builtin/describe.c b/builtin/describe.c index 24d740c8b1705f..c1566eef0a3016 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -400,6 +400,11 @@ static void describe(const char *arg, int last_one) int cmd_describe(int argc, const char **argv, const char *prefix) { int contains = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL(0, "contains", &contains, N_("find the tag that comes after the commit")), OPT_BOOL(0, "debug", &debug, N_("debug search strategy on stderr")), @@ -422,6 +427,10 @@ int cmd_describe(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, describe_usage, 0); if (abbrev < 0) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index b8d8a3aaf9ee82..f88aeb5912dcec 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -668,6 +668,11 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) struct commit *commit; char *export_filename = NULL, *import_filename = NULL; uint32_t lastimportid; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_INTEGER(0, "progress", &progress, N_("show progress after objects")), @@ -691,6 +696,10 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 1) usage_with_options (fast_export_usage, options); diff --git a/builtin/fetch.c b/builtin/fetch.c index 55f457c04f5c72..2bac8e69ae46d7 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -950,10 +950,18 @@ static int get_remote_group(const char *key, const char *value, void *priv) static int add_remote_or_group(const char *name, struct string_list *list) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int prev_nr = list->nr; struct remote_group_data g; g.name = name; g.list = list; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(get_remote_group, &g); if (list->nr == prev_nr) { struct remote *remote; diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 3906eda87712ea..f092daac34beaa 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -658,6 +658,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) { const char *inpath = NULL; const char *message = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int shortlog_len = -1; struct option options[] = { { OPTION_INTEGER, 0, "log", &shortlog_len, N_("n"), @@ -673,6 +678,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + FILE *in = stdin; struct strbuf input = STRBUF_INIT, output = STRBUF_INIT; int ret; diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 3e1d5c3334e500..56cc7967542381 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -1073,6 +1073,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) struct refinfo **refs; struct grab_ref_cbdata cbdata; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT('s', "shell", "e_style, N_("quote placeholders suitably for shells"), QUOTE_SHELL), @@ -1091,6 +1095,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0); if (maxcount < 0) { error("invalid --count argument: `%d'", maxcount); diff --git a/builtin/gc.c b/builtin/gc.c index 8d219d8c42cb4d..d32724675c1b3a 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -281,6 +281,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) const char *name; pid_t pid; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_gc_options[] = { OPT__QUIET(&quiet, N_("suppress progress reporting")), { OPTION_STRING, 0, "prune", &prune_expire, N_("date"), @@ -292,6 +296,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_gc_usage, builtin_gc_options); diff --git a/builtin/grep.c b/builtin/grep.c index b8d440d0e09954..f4c5ef0d17afbb 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -635,6 +635,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix) int use_index = 1; int pattern_type_arg = GREP_PATTERN_TYPE_UNSPECIFIED; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL(0, "cached", &cached, N_("search in index instead of in the work tree")), @@ -745,6 +749,10 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* * 'git grep -h', unlike 'git grep -h ', is a request * to show usage information and exit. diff --git a/builtin/init-db.c b/builtin/init-db.c index 56f85e239ae0d2..8821b443a0eca0 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -479,6 +479,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) const char *work_tree; const char *template_dir = NULL; unsigned int flags = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option init_db_options[] = { OPT_STRING(0, "template", &template_dir, N_("template-directory"), N_("directory from which templates will be used")), @@ -494,6 +499,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0); if (real_git_dir && !is_absolute_path(real_git_dir)) diff --git a/builtin/log.c b/builtin/log.c index 3b6a6bbaddc879..33e29681962b2f 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -121,6 +121,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, int quiet = 0, source = 0, mailmap = 0; static struct line_opt_callback_data line_cb = {NULL, NULL, STRING_LIST_INIT_DUP}; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option builtin_log_options[] = { OPT__QUIET(&quiet, N_("suppress diff output")), OPT_BOOL(0, "source", &source, N_("show source")), @@ -133,6 +137,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + line_cb.rev = rev; line_cb.prefix = prefix; @@ -1145,6 +1153,10 @@ static int from_callback(const struct option *opt, const char *arg, int unset) int cmd_format_patch(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct commit *commit; struct commit **list = NULL; struct rev_info rev; @@ -1230,6 +1242,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + extra_hdr.strdup_strings = 1; extra_to.strdup_strings = 1; extra_cc.strdup_strings = 1; @@ -1583,12 +1599,20 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) const char *limit = NULL; int verbose = 0, abbrev = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__ABBREV(&abbrev), OPT__VERBOSE(&verbose, N_("be verbose")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, cherry_usage, 0); switch (argc) { diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 47c38808a26a46..e46eaa85709e36 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -450,6 +450,11 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) struct dir_struct dir; struct exclude_list *el; struct string_list exclude_list = STRING_LIST_INIT_NODUP; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_ls_files_options[] = { { OPTION_CALLBACK, 'z', NULL, NULL, NULL, N_("paths are separated with NUL character"), @@ -506,6 +511,10 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(ls_files_usage, builtin_ls_files_options); diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index 51184dfa2efa46..bf4b7b410fb664 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -119,6 +119,10 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen, int cmd_ls_tree(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + unsigned char sha1[20]; struct tree *tree; int i, full_tree = 0; @@ -146,6 +150,10 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); ls_tree_prefix = prefix; if (prefix && *prefix) diff --git a/builtin/merge-base.c b/builtin/merge-base.c index 0ecde8da306159..0eb0cf655eb44c 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -210,6 +210,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) int show_all = 0; int cmdmode = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL('a', "all", &show_all, N_("output all common ancestors")), OPT_CMDMODE(0, "octopus", &cmdmode, @@ -223,6 +227,10 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0); diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 844f84f40bf0f8..c01838c23f1403 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -29,6 +29,11 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) int ret = 0, i = 0, to_stdout = 0; int quiet = 0; int prefixlen = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL('p', "stdout", &to_stdout, N_("send results to standard output")), OPT_SET_INT(0, "diff3", &xmp.style, N_("use a diff3 based merge"), XDL_MERGE_DIFF3), @@ -46,6 +51,10 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + xmp.level = XDL_MERGE_ZEALOUS_ALNUM; xmp.style = 0; xmp.favor = 0; diff --git a/builtin/merge-index.c b/builtin/merge-index.c index b416d928492c43..8a6e74b87f35dc 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -7,11 +7,19 @@ static int err; static int merge_entry(int pos, const char *path) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int found; const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL }; char hexbuf[4][60]; char ownbuf[4][60]; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (pos >= active_nr) die("git merge-index: %s not in the cache", path); found = 0; diff --git a/builtin/mktree.c b/builtin/mktree.c index a964d6be521c09..5c9fd05648a63b 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -146,6 +146,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) int is_batch_mode = 0; int got_eof = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option option[] = { OPT_SET_INT('z', NULL, &line_termination, N_("input is NUL terminated"), '\0'), OPT_SET_INT( 0 , "missing", &allow_missing, N_("allow missing objects"), 1), @@ -153,6 +157,10 @@ int cmd_mktree(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + ac = parse_options(ac, av, prefix, option, mktree_usage, 0); while (!got_eof) { diff --git a/builtin/mv.c b/builtin/mv.c index 180ef99127d47d..eb7c561255ba7f 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -65,6 +65,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) { int i, newfd, gitmodules_modified = 0; int verbose = 0, show_only = 0, force = 0, ignore_errors = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_mv_options[] = { OPT__VERBOSE(&verbose, N_("be verbose")), OPT__DRY_RUN(&show_only, N_("dry run")), @@ -72,6 +77,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) OPT_BOOL('k', NULL, &ignore_errors, N_("skip move/rename errors")), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + const char **source, **destination, **dest_path, **submodule_gitfile; enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes; struct stat st; diff --git a/builtin/name-rev.c b/builtin/name-rev.c index c824d4ec5f1c07..c9a44692403e3e 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -308,6 +308,11 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) struct object_array revs = OBJECT_ARRAY_INIT; int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0; struct name_ref_data data = { 0, 0, NULL }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BOOL(0, "name-only", &data.name_only, N_("print only names (no SHA-1)")), OPT_BOOL(0, "tags", &data.tags_only, N_("only use tags to name the commits")), @@ -328,6 +333,10 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0); if (all + transform_stdin + !!argc > 1) { diff --git a/builtin/notes.c b/builtin/notes.c index 39c8573cde00bc..29d939d0563d92 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -120,12 +120,20 @@ static void write_note_data(int fd, const unsigned char *sha1) static void write_commented_object(int fd, const unsigned char *object) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[5] = {"show", "--stat", "--no-notes", sha1_to_hex(object), NULL}; struct child_process show; struct strbuf buf = STRBUF_INIT; struct strbuf cbuf = STRBUF_INIT; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* Invoke "git show --stat --no-notes $object" */ memset(&show, 0, sizeof(show)); show.argv = show_args; @@ -405,6 +413,11 @@ static int add(int argc, const char **argv, const char *prefix) char logmsg[100]; const unsigned char *note; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, N_("message"), N_("note contents as a string"), PARSE_OPT_NONEG, @@ -422,6 +435,10 @@ static int add(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_add_usage, PARSE_OPT_KEEP_ARGV0); @@ -485,6 +502,11 @@ static int copy(int argc, const char **argv, const char *prefix) unsigned char object[20], from_obj[20]; struct notes_tree *t; const char *rewrite_cmd = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, N_("replace existing notes")), OPT_BOOL(0, "stdin", &from_stdin, N_("read objects from stdin")), @@ -494,6 +516,10 @@ static int copy(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_copy_usage, 0); @@ -562,6 +588,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) char logmsg[100]; const char * const *usage; struct msg_arg msg = { 0, 0, STRBUF_INIT }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { { OPTION_CALLBACK, 'm', "message", &msg, N_("message"), N_("note contents as a string"), PARSE_OPT_NONEG, @@ -577,6 +608,11 @@ static int append_edit(int argc, const char **argv, const char *prefix) parse_reuse_arg}, OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + int edit = !strcmp(argv[0], "edit"); usage = edit ? git_notes_edit_usage : git_notes_append_usage; @@ -647,7 +683,17 @@ static int show(int argc, const char **argv, const char *prefix) retval = error(_("No note found for object %s."), sha1_to_hex(object)); else { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *show_args[3] = {"show", sha1_to_hex(note), NULL}; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + retval = execv_git_cmd(show_args); } free_notes(t); @@ -728,6 +774,10 @@ static int merge_commit(struct notes_merge_options *o) static int merge(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct strbuf remote_ref = STRBUF_INIT, msg = STRBUF_INIT; unsigned char result_sha1[20]; struct notes_tree *t; @@ -753,6 +803,10 @@ static int merge(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_merge_usage, 0); @@ -851,6 +905,10 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag static int remove_cmd(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + unsigned flag = 0; int from_stdin = 0; struct option options[] = { @@ -864,6 +922,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) struct notes_tree *t; int retval = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_remove_usage, 0); @@ -893,6 +955,10 @@ static int remove_cmd(int argc, const char **argv, const char *prefix) static int prune(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct notes_tree *t; int show_only = 0, verbose = 0; struct option options[] = { @@ -901,6 +967,10 @@ static int prune(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_notes_prune_usage, 0); @@ -938,12 +1008,21 @@ int cmd_notes(int argc, const char **argv, const char *prefix) { int result; const char *override_notes_ref = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_STRING(0, "ref", &override_notes_ref, N_("notes-ref"), N_("use notes from ")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_notes_usage, PARSE_OPT_STOP_AT_NON_OPTION); diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index de36c60ca11d24..388335b0192300 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2569,6 +2569,10 @@ static int option_parse_ulong(const struct option *opt, int cmd_pack_objects(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int use_internal_rev_list = 0; int thin = 0; int all_progress_implied = 0; @@ -2645,6 +2649,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + check_replace_refs = 0; reset_pack_idx_option(&pack_idx_opts); diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index b20b1ec4c117f7..c25021168f9328 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -10,11 +10,21 @@ static char const * const pack_refs_usage[] = { int cmd_pack_refs(int argc, const char **argv, const char *prefix) { unsigned int flags = PACK_REFS_PRUNE; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option opts[] = { OPT_BIT(0, "all", &flags, N_("pack everything"), PACK_REFS_ALL), OPT_BIT(0, "prune", &flags, N_("prune loose refs (default)"), PACK_REFS_PRUNE), OPT_END(), }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0)) usage_with_options(pack_refs_usage, opts); return pack_refs(flags); diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index 6879468c46a7ba..0d043c81f0a237 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -72,6 +72,10 @@ void prune_packed_objects(int opts) int cmd_prune_packed(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int opts = isatty(2) ? PRUNE_PACKED_VERBOSE : 0; const struct option prune_packed_options[] = { OPT_BIT('n', "dry-run", &opts, N_("dry run"), @@ -81,6 +85,10 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, prune_packed_options, prune_packed_usage, 0); diff --git a/builtin/push.c b/builtin/push.c index f8dfea41e1ad8b..826a5da50346d5 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -474,6 +474,10 @@ static int option_parse_recurse_submodules(const struct option *opt, int cmd_push(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int flags = 0; int tags = 0; int rc; @@ -510,6 +514,10 @@ int cmd_push(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + packet_trace_identity("push"); git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, push_usage, 0); diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 0d7ef847a70581..fc964085e0e76f 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -104,6 +104,11 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) struct tree_desc t[MAX_UNPACK_TREES]; struct unpack_trees_options opts; int prefix_set = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option read_tree_options[] = { { OPTION_CALLBACK, 0, "index-output", NULL, N_("file"), N_("write resulting index to "), @@ -139,6 +144,10 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&opts, 0, sizeof(opts)); opts.head_idx = -1; opts.src_index = &the_index; diff --git a/builtin/remote.c b/builtin/remote.c index 9b3e368983570b..62e6e2d4dbe3d1 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -80,11 +80,20 @@ static int verbose; static int fetch_remote(const char *name) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { "fetch", name, NULL, NULL }; if (verbose) { argv[1] = "-v"; argv[2] = name; } + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + printf_ln(_("Updating %s"), name); if (run_command_v_opt(argv, RUN_GIT_CMD)) return error(_("Could not fetch %s"), name); @@ -149,6 +158,10 @@ static int add(int argc, const char **argv) const char *name, *url; int i; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL('f', "fetch", &fetch, N_("fetch the remote branches")), OPT_SET_INT(0, "tags", &fetch_tags, @@ -165,6 +178,10 @@ static int add(int argc, const char **argv) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_add_usage, 0); @@ -1149,6 +1166,10 @@ static int show_all(void) static int show(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int no_query = 0, result = 0, query_flag = 0; struct option options[] = { OPT_BOOL('n', NULL, &no_query, N_("do not query remotes")), @@ -1158,6 +1179,10 @@ static int show(int argc, const char **argv) struct string_list info_list = STRING_LIST_INIT_NODUP; struct show_info info; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_show_usage, 0); @@ -1257,6 +1282,10 @@ static int set_head(int argc, const char **argv) struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT; char *head_name = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL('a', "auto", &opt_a, N_("set refs/remotes//HEAD according to remote")), @@ -1264,6 +1293,11 @@ static int set_head(int argc, const char **argv) N_("delete refs/remotes//HEAD")), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_sethead_usage, 0); if (argc) @@ -1362,12 +1396,20 @@ static int prune_remote(const char *remote, int dry_run) static int prune(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int dry_run = 0, result = 0; struct option options[] = { OPT__DRY_RUN(&dry_run, N_("dry run")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_prune_usage, 0); @@ -1391,6 +1433,10 @@ static int get_remote_default(const char *key, const char *value, void *priv) static int update(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int i, prune = -1; struct option options[] = { OPT_BOOL('p', "prune", &prune, @@ -1401,6 +1447,10 @@ static int update(int argc, const char **argv) int default_defined = 0; int retval; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_update_usage, PARSE_OPT_KEEP_ARGV0); @@ -1478,12 +1528,20 @@ static int set_remote_branches(const char *remotename, const char **branches, static int set_branches(int argc, const char **argv) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int add_mode = 0; struct option options[] = { OPT_BOOL('\0', "add", &add_mode, N_("add branch")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_setbranches_usage, 0); if (argc == 0) { @@ -1507,6 +1565,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) const char **urlset; int urlset_nr; struct strbuf name_buf = STRBUF_INIT; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_BOOL('\0', "push", &push_mode, N_("manipulate push URLs")), @@ -1516,6 +1579,11 @@ static int set_url(http://github.com/int%20argc,%20const%20char%20**argv) N_("delete URLs")), OPT_END() }; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, builtin_remote_seturl_usage, PARSE_OPT_KEEP_ARGV0); diff --git a/builtin/repack.c b/builtin/repack.c index 6b0b62dcb2687e..820ed4a9046eeb 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -151,6 +151,14 @@ int cmd_repack(int argc, const char **argv, const char *prefix) int local = 0; int write_bitmap = -1; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_repack_options[] = { OPT_BIT('a', NULL, &pack_everything, N_("pack everything in a single pack"), ALL_INTO_ONE), @@ -185,6 +193,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(repack_config, NULL); argc = parse_options(argc, argv, prefix, builtin_repack_options, diff --git a/builtin/replace.c b/builtin/replace.c index b62420a01af820..b3ceb6346ae350 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -168,6 +168,11 @@ static int replace_object(const char *object_ref, const char *replace_ref, int cmd_replace(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int list = 0, delete = 0, force = 0; const char *format = NULL; struct option options[] = { @@ -178,6 +183,10 @@ int cmd_replace(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + check_replace_refs = 0; argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0); diff --git a/builtin/rerere.c b/builtin/rerere.c index 98eb8c5404914e..6348470dc07b64 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -52,12 +52,20 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) struct string_list merge_rr = STRING_LIST_INIT_DUP; int i, fd, autoupdate = -1, flags = 0; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_SET_INT(0, "rerere-autoupdate", &autoupdate, N_("register clean resolutions in index"), 1), OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, rerere_usage, 0); git_config(git_xmerge_config, NULL); diff --git a/builtin/reset.c b/builtin/reset.c index f4e087596b6337..bb67813a5812a2 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -269,6 +269,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix) unsigned char sha1[20]; struct pathspec pathspec; int intent_to_add = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option options[] = { OPT__QUIET(&quiet, N_("be quiet, only report errors")), OPT_SET_INT(0, "mixed", &reset_type, @@ -286,6 +291,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_reset_usage, diff --git a/builtin/revert.c b/builtin/revert.c index f9ed5bd5d03675..693ba698bc3d16 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -76,6 +76,11 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) const char * const * usage_str = revert_or_cherry_pick_usage(opts); const char *me = action_name(opts); int cmd = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick sequence"), 'q'), OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or cherry-pick sequence"), 'c'), @@ -112,6 +117,10 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) die(_("program error")); } +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, options, usage_str, PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN); diff --git a/builtin/show-branch.c b/builtin/show-branch.c index d87317290c0bbf..d07d4631a5362d 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -644,6 +644,11 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) int topics = 0; int dense = 1; const char *reflog_base = NULL; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option builtin_show_branch_options[] = { OPT_BOOL('a', "all", &all_heads, N_("show remote-tracking and local branches")), @@ -683,6 +688,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_show_branch_config, NULL); /* If nothing is specified, try the default first */ diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index b6a711d3191a72..3f24032f3db72e 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -33,8 +33,14 @@ static int check_symref(const char *HEAD, int quiet, int shorten, int print) int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + int quiet = 0, delete = 0, shorten = 0, ret = 0; const char *msg = NULL; + struct option options[] = { OPT__QUIET(&quiet, N_("suppress error message for non-symbolic (detached) refs")), @@ -44,6 +50,10 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_symbolic_ref_usage, 0); diff --git a/builtin/tag.c b/builtin/tag.c index 6c7c6bde9de9cb..5c8c04863f8d37 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -489,6 +489,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix) unsigned char object[20], prev[20]; const char *object_ref, *tag; struct ref_lock *lock; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + struct create_tag_options opt; char *cleanup_arg = NULL; int annotate = 0, force = 0, lines = -1; @@ -542,6 +548,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_tag_config, NULL); memset(&opt, 0, sizeof(opt)); diff --git a/builtin/update-index.c b/builtin/update-index.c index ebea285e1b6863..d1869036835d46 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -736,6 +736,10 @@ static int reupdate_callback(struct parse_opt_ctx_t *ctx, int cmd_update_index(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int newfd, entries, has_errors = 0, line_termination = '\n'; int read_from_stdin = 0; int prefix_length = prefix ? strlen(prefix) : 0; @@ -828,6 +832,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(update_index_usage, options); diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 5c208bb1fc4f6c..b659b28f46b463 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -248,6 +248,11 @@ static void update_refs_stdin(void) int cmd_update_ref(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#define delete delete_ +#endif + const char *refname, *oldval, *msg = NULL; unsigned char sha1[20], oldsha1[20]; int delete = 0, no_deref = 0, read_stdin = 0, end_null = 0, flags = 0; @@ -261,6 +266,10 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) OPT_END(), }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_update_ref_usage, 0); diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index 6c8cc3edc1f5fe..c2e9c512653471 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -10,11 +10,20 @@ static const char * const update_server_info_usage[] = { int cmd_update_server_info(int argc, const char **argv, const char *prefix) { int force = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option options[] = { OPT__FORCE(&force, N_("update the info files from scratch")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, update_server_info_usage, 0); diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index 32ab94cd06b43c..9dd34d66b199b6 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -75,8 +75,16 @@ static ssize_t process_input(int child_fd, int band) int cmd_upload_archive(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process writer = { argv }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* * Set up sideband subprocess. * diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index 66cd2df0f878d3..22286a75f975b8 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -62,6 +62,11 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) int err = 0; unsigned int flags = 0; int i; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_pack_options[] = { OPT_BIT('v', "verbose", &flags, N_("verbose"), VERIFY_PACK_VERBOSE), @@ -70,6 +75,10 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, verify_pack_options, verify_pack_usage, 0); diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 9cdf332333b95b..348c6de0f9c602 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -69,11 +69,20 @@ static int git_verify_tag_config(const char *var, const char *value, void *cb) int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const struct option verify_tag_options[] = { OPT__VERBOSE(&verbose, N_("print tag contents")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_verify_tag_config, NULL); argc = parse_options(argc, argv, prefix, verify_tag_options, diff --git a/builtin/write-tree.c b/builtin/write-tree.c index 084c0df7833f29..4b25db25b46814 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -20,6 +20,11 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) const char *prefix = NULL; unsigned char sha1[20]; const char *me = "git-write-tree"; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct option write_tree_options[] = { OPT_BIT(0, "missing-ok", &flags, N_("allow missing objects"), WRITE_TREE_MISSING_OK), @@ -33,6 +38,10 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_default_config, NULL); argc = parse_options(argc, argv, unused_prefix, write_tree_options, write_tree_usage, 0); diff --git a/daemon.c b/daemon.c index eba12556848e97..ca63522fdec2fb 100644 --- a/daemon.c +++ b/daemon.c @@ -738,10 +738,18 @@ static void check_dead_children(void) static char **cld_argv; static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process cld = { NULL }; char addrbuf[300] = "REMOTE_ADDR=", portbuf[300]; char *env[] = { addrbuf, portbuf, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (max_connections && live_children >= max_connections) { kill_some_child(); sleep(1); /* give it some time to die */ diff --git a/editor.c b/editor.c index 0abbd8dc3a0ec9..b98bcb57ff47b8 100644 --- a/editor.c +++ b/editor.c @@ -37,10 +37,19 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en return error("Terminal is dumb, but EDITOR unset"); if (strcmp(editor, ":")) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *args[] = { editor, real_path(path), NULL }; struct child_process p; int ret, sig; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(&p, 0, sizeof(p)); p.argv = args; p.env = env; diff --git a/imap-send.c b/imap-send.c index 0bc6f7fae151ea..fe30cd56816a78 100644 --- a/imap-send.c +++ b/imap-send.c @@ -960,9 +960,18 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc) /* open connection to IMAP server */ if (srvc->tunnel) { + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *argv[] = { srvc->tunnel, NULL }; struct child_process tunnel = {NULL}; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + imap_info("Starting tunnel '%s'... ", srvc->tunnel); tunnel.argv = argv; diff --git a/run-command.c b/run-command.c index 75abc478c6da75..215d6ce75a0b28 100644 --- a/run-command.c +++ b/run-command.c @@ -762,11 +762,19 @@ char *find_hook(const char *name) int run_hook_ve(const char *const *env, const char *name, va_list args) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct child_process hook; struct argv_array argv = ARGV_ARRAY_INIT; const char *p; int ret; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + p = find_hook(name); if (!p) return 0; diff --git a/submodule.c b/submodule.c index b80ecacf60dc87..4a41580158363a 100644 --- a/submodule.c +++ b/submodule.c @@ -648,10 +648,18 @@ static void add_sha1_to_argv(const unsigned char sha1[20], void *data) static void calculate_changed_submodule_paths(void) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + struct rev_info rev; struct commit *commit; struct argv_array argv = ARGV_ARRAY_INIT; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + /* No need to check if there are no submodules configured */ if (!config_name_for_path.nr) return; @@ -951,12 +959,20 @@ static int find_first_merges(struct object_array *result, const char *path, struct commit *commit; int contains_another; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + char merged_revision[42]; const char *rev_args[] = { "rev-list", "--merges", "--ancestry-path", "--all", merged_revision, NULL }; struct rev_info revs; struct setup_revision_opt rev_opts; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + memset(result, 0, sizeof(struct object_array)); memset(&rev_opts, 0, sizeof(rev_opts)); diff --git a/transport-helper.c b/transport-helper.c index b468e4f88e730f..4708d72546a684 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -110,11 +110,20 @@ static struct child_process *get_helper(struct transport *transport) int duped; int code; char git_dir_buf[sizeof(GIT_DIR_ENVIRONMENT) + PATH_MAX + 1]; + +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + const char *helper_env[] = { git_dir_buf, NULL }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + if (data->helper) return data->helper; From bc18960e8469614ead076b8959153226198a119f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 8 Apr 2009 01:51:04 -0700 Subject: [PATCH 163/211] Cast compare_info() args to (const foo *const *) Cast compare_info() arguments to (const struct pack_info *const *) for the benefit of Metrowerks C 2.4.1. Otherwise, it reports "illegal implicit conversion from 'const void *' to 'struct pack_info *const *'". --- server-info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-info.c b/server-info.c index 9ec744e9f2da29..f2d64dbbe12bca 100644 --- a/server-info.c +++ b/server-info.c @@ -129,8 +129,8 @@ static int read_pack_info_file(const char *infofile) static int compare_info(const void *a_, const void *b_) { - struct pack_info *const *a = a_; - struct pack_info *const *b = b_; + const struct pack_info *const *a = a_; + const struct pack_info *const *b = b_; if (0 <= (*a)->old_num && 0 <= (*b)->old_num) /* Keep the order in the original */ From 59c79996c0d6373e4ba46a71217809638e12faca Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 17 Nov 2023 01:09:51 -0500 Subject: [PATCH 164/211] block-sha1/sha1.h: Add missing include guard --- block-sha1/sha1.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block-sha1/sha1.h b/block-sha1/sha1.h index b864df623e3b89..bf466528a2100e 100644 --- a/block-sha1/sha1.h +++ b/block-sha1/sha1.h @@ -1,3 +1,6 @@ +#ifndef BLOCKSHA1_SHA1_H +#define BLOCKSHA1_SHA1_H + /* * SHA1 routine optimized to do word accesses rather than byte accesses, * and to avoid unnecessary copies into the context array. @@ -20,3 +23,5 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx); #define git_SHA1_Init blk_SHA1_Init #define git_SHA1_Update blk_SHA1_Update #define git_SHA1_Final blk_SHA1_Final + +#endif From e752813c9575cf47553f104f59e67986217d9b90 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 10 Apr 2024 02:32:47 -0400 Subject: [PATCH 165/211] Cast to (intptr_t) by way of (char*) Required for Metrowerks C 2.4.1. --- builtin/gc.c | 2 +- builtin/grep.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 8d219d8c42cb4d..fcbd2fe0920c62 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -285,7 +285,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) OPT__QUIET(&quiet, N_("suppress progress reporting")), { OPTION_STRING, 0, "prune", &prune_expire, N_("date"), N_("prune unreferenced objects"), - PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire }, + PARSE_OPT_OPTARG, NULL, (intptr_t)(char*)prune_expire }, OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")), OPT_BOOL(0, "auto", &auto_gc, N_("enable auto-gc mode")), OPT_BOOL(0, "force", &force, N_("force running gc even if there may be another gc running")), diff --git a/builtin/grep.c b/builtin/grep.c index b8d440d0e09954..348d1e8c5bc956 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -737,7 +737,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_GROUP(""), { OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager, N_("pager"), N_("show matching files in the pager"), - PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager }, + PARSE_OPT_OPTARG, NULL, (intptr_t)(char*)default_pager }, OPT_BOOL(0, "ext-grep", &external_grep_allowed__ignored, N_("allow calling of grep(1) (ignored by this build)")), { OPTION_CALLBACK, 0, "help-all", &options, NULL, N_("show usage"), From f381bce97925be412340cf6140074a533dbc23ab Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 05:00:17 -0400 Subject: [PATCH 166/211] Guard against use of getrlimit() and sysconf() --- sha1_file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index 34d527f6708fe2..0e8d0276ebd85c 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -820,6 +820,11 @@ void free_pack_by_name(const char *pack_name) } } +#ifdef __RELIX__ +#undef RLIMIT_NOFILE +#undef _SC_OPEN_MAX +#endif + static unsigned int get_max_fd_limit(void) { #ifdef RLIMIT_NOFILE From 1e238e58a8b08ec620c89bfbd4f90680d0c04e86 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 26 Apr 2024 02:50:47 -0400 Subject: [PATCH 167/211] xdiff/xpatience.c: Remap hashmap to xdiff_hashmap Otherwise, it conflicts with the struct hashmap definition in hashmap.h. --- xdiff/xpatience.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c index 04e1a1ab2a8638..f4d79276ea1da8 100644 --- a/xdiff/xpatience.c +++ b/xdiff/xpatience.c @@ -42,6 +42,8 @@ #define NON_UNIQUE ULONG_MAX +#define hashmap xdiff_hashmap + /* * This is a hash mapping from line hash to line numbers in the first and * second file. From c48ee103e7294387856e8f04b923ce21411f69e9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 8 Apr 2009 23:03:24 -0700 Subject: [PATCH 168/211] Undefine conflicting PREFIX macro exec_cmd.c expects PREFIX to be defined by inclusion of cache.h, whereas sideband.c expects it to be undefined. Although sideband.c doesn't explicitly include cache.h, MacRelix uses it as a precompiled header, effectively prepended to each translation unit. Undefine the PREFIX macro here to avoid the conflict. --- sideband.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sideband.c b/sideband.c index 7f9dc229fbc82d..49407276434854 100644 --- a/sideband.c +++ b/sideband.c @@ -13,6 +13,7 @@ * the remote died unexpectedly. A flush() concludes the stream. */ +#undef PREFIX #define PREFIX "remote:" #define ANSI_SUFFIX "\033[K" From 3d03dc068f388ef110d3902fff68606bddadd854 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 21 Apr 2009 08:43:47 -0700 Subject: [PATCH 169/211] Allow a platform to override LARGE_PACKET_MAX MacRelix needs this due to small stack sizes. --- pkt-line.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkt-line.h b/pkt-line.h index 3cb9d91baaa5bb..f9253e9aae655f 100644 --- a/pkt-line.h +++ b/pkt-line.h @@ -76,7 +76,9 @@ char *packet_read_line(int fd, int *size); char *packet_read_line_buf(char **src_buf, size_t *src_len, int *size); #define DEFAULT_PACKET_MAX 1000 +#ifndef LARGE_PACKET_MAX #define LARGE_PACKET_MAX 65520 +#endif extern char packet_buffer[LARGE_PACKET_MAX]; #endif From 7a56e856e2a55d855f8925726c7e0b575420fd79 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 31 Dec 2023 09:15:37 -0500 Subject: [PATCH 170/211] Reduce STREAM_BUFFER_SIZE to avoid stack overflow --- archive-zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archive-zip.c b/archive-zip.c index 4bde019bce6327..e98b45a8eb7b34 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -189,7 +189,7 @@ static int has_only_ascii(const char *s) } } -#define STREAM_BUFFER_SIZE (1024 * 16) +#define STREAM_BUFFER_SIZE (1024 * 4) static int write_zip_entry(struct archiver_args *args, const unsigned char *sha1, From 20e7c31ea8a5d62ffe5e6ce1319702c63164c8d5 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sat, 19 Feb 2011 18:46:23 -0800 Subject: [PATCH 171/211] Allocate bidirectional_transfer_state dynamically The bidirectional_transfer_state struct is over 128K, exceeding both the 68K limit of 32K and our current default stack size of 64K. Allocate the struct with malloc() instead. --- transport-helper.c | 53 +++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/transport-helper.c b/transport-helper.c index b468e4f88e730f..4dbf8b433e592c 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -1330,26 +1330,39 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s) */ int bidirectional_transfer_loop(int input, int output) { - struct bidirectional_transfer_state state; + int status; + + struct bidirectional_transfer_state* state; + + state = malloc( sizeof (struct bidirectional_transfer_state) ); + + if ( state == NULL ) + { + return -1; + } /* Fill the state fields. */ - state.ptg.src = input; - state.ptg.dest = 1; - state.ptg.src_is_sock = (input == output); - state.ptg.dest_is_sock = 0; - state.ptg.state = SSTATE_TRANSFERING; - state.ptg.bufuse = 0; - state.ptg.src_name = "remote input"; - state.ptg.dest_name = "stdout"; - - state.gtp.src = 0; - state.gtp.dest = output; - state.gtp.src_is_sock = 0; - state.gtp.dest_is_sock = (input == output); - state.gtp.state = SSTATE_TRANSFERING; - state.gtp.bufuse = 0; - state.gtp.src_name = "stdin"; - state.gtp.dest_name = "remote output"; - - return tloop_spawnwait_tasks(&state); + state->ptg.src = input; + state->ptg.dest = 1; + state->ptg.src_is_sock = (input == output); + state->ptg.dest_is_sock = 0; + state->ptg.state = SSTATE_TRANSFERING; + state->ptg.bufuse = 0; + state->ptg.src_name = "remote input"; + state->ptg.dest_name = "stdout"; + + state->gtp.src = 0; + state->gtp.dest = output; + state->gtp.src_is_sock = 0; + state->gtp.dest_is_sock = (input == output); + state->gtp.state = SSTATE_TRANSFERING; + state->gtp.bufuse = 0; + state->gtp.src_name = "stdin"; + state->gtp.dest_name = "remote output"; + + status = tloop_spawnwait_tasks(state); + + free( state ); + + return status; } From 138ecfc03566829fc60bef3449d6c6fc3c3b3e90 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 4 Apr 2024 06:17:03 -0400 Subject: [PATCH 172/211] Use smaller buffers in write_large_blob_data() --- builtin/pack-objects.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index de36c60ca11d24..b054ddb954780c 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -21,6 +21,12 @@ #include "thread-utils.h" #include "pack-bitmap.h" +#ifdef __RELIX__ +#define LARGE_BLOB_BUFFER_SIZE (1024 * 4) +#else +#define LARGE_BLOB_BUFFER_SIZE (1024 * 16) +#endif + static const char *pack_usage[] = { N_("git pack-objects --stdout [options...] [< ref-list | < object-list]"), N_("git pack-objects [options...] base-name [< ref-list | < object-list]"), @@ -147,8 +153,8 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct sha1fi const unsigned char *sha1) { git_zstream stream; - unsigned char ibuf[1024 * 16]; - unsigned char obuf[1024 * 16]; + unsigned char ibuf[LARGE_BLOB_BUFFER_SIZE]; + unsigned char obuf[LARGE_BLOB_BUFFER_SIZE]; unsigned long olen = 0; memset(&stream, 0, sizeof(stream)); From e4bf3a8b62063b15692ec29b9fbfd96d8b1d761b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 06:08:50 -0500 Subject: [PATCH 173/211] Dynamically allocate large buffers --- bulk-checkin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bulk-checkin.c b/bulk-checkin.c index 98e651c284254b..90da54bc2971bd 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -98,12 +98,15 @@ static int stream_to_pack(struct bulk_checkin_state *state, const char *path, unsigned flags) { git_zstream s; - unsigned char obuf[16384]; + unsigned char* obuf = malloc(16384 * 2); unsigned hdrlen; int status = Z_OK; int write_object = (flags & HASH_WRITE_OBJECT); off_t offset = 0; + if (!obuf) + die("*** out of memory ***"); + memset(&s, 0, sizeof(s)); git_deflate_init(&s, pack_compression_level); @@ -112,7 +115,7 @@ static int stream_to_pack(struct bulk_checkin_state *state, s.avail_out = sizeof(obuf) - hdrlen; while (status != Z_STREAM_END) { - unsigned char ibuf[16384]; + unsigned char* ibuf = obuf + 16384; if (size && !s.avail_in) { ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf); @@ -164,6 +167,7 @@ static int stream_to_pack(struct bulk_checkin_state *state, } } git_deflate_end(&s); + free(obuf); return 0; } From 9350d5286ec79f6a90f2470a319ab155fbda0461 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 21 Apr 2009 08:48:17 -0700 Subject: [PATCH 174/211] Use vfork() and reexec(), not fork(), in MacRelix --- run-command.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/run-command.c b/run-command.c index 75abc478c6da75..a69ef92d4bbdd9 100644 --- a/run-command.c +++ b/run-command.c @@ -4,6 +4,12 @@ #include "sigchain.h" #include "argv-array.h" +#ifdef __RELIX__ +#define GIT_FORK() vfork() +#else +#define GIT_FORK() fork() +#endif + #ifndef SHELL_PATH # define SHELL_PATH "/bin/sh" #endif @@ -343,7 +349,7 @@ int start_command(struct child_process *cmd) if (pipe(notify_pipe)) notify_pipe[0] = notify_pipe[1] = -1; - cmd->pid = fork(); + cmd->pid = GIT_FORK(); failed_errno = errno; if (!cmd->pid) { /* @@ -625,6 +631,15 @@ static int async_die_is_recursing(void) #endif +static void run_async_proc(struct async *async, int proc_in, int proc_out) +{ +#ifdef __RELIX__ + (void) reexec(async->proc, proc_in, proc_out, async->data); +#else + exit(!!async->proc(proc_in, proc_out, async->data)); +#endif +} + int start_async(struct async *async) { int need_in, need_out; @@ -671,7 +686,7 @@ int start_async(struct async *async) /* Flush stdio before fork() to avoid cloning buffers */ fflush(NULL); - async->pid = fork(); + async->pid = GIT_FORK(); if (async->pid < 0) { error("fork (async) failed: %s", strerror(errno)); goto error; @@ -681,7 +696,7 @@ int start_async(struct async *async) close(fdin[1]); if (need_out) close(fdout[0]); - exit(!!async->proc(proc_in, proc_out, async->data)); + run_async_proc(async, proc_in, proc_out); } mark_child_for_cleanup(async->pid); From 4a3dd1a6f075ba54c8bac2cced7833e4da7edb08 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 18 Jun 2021 17:23:18 -0400 Subject: [PATCH 175/211] Exit without global destruction in start_command() The environ storage is shared between parent and child of reexec() -- so it's critical not to destroy it in the child. This fixes a crash due to memory corruption when using a git alias in MacRelix that only showed up after modifying the environ storage to refrain from throwing exceptions. --- run-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-command.c b/run-command.c index a69ef92d4bbdd9..f3abff39a6142f 100644 --- a/run-command.c +++ b/run-command.c @@ -422,7 +422,7 @@ int start_command(struct child_process *cmd) if (!cmd->silent_exec_failure) error("cannot run %s: %s", cmd->argv[0], strerror(ENOENT)); - exit(127); + _exit(127); } else { die_errno("cannot exec '%s'", cmd->argv[0]); } From 4545e36b13a785b90196b9a7e08b96fe320cc391 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 10 Mar 2010 05:24:54 -0800 Subject: [PATCH 176/211] Add a hand-made common-cmds.h, since one isn't generated yet. --- common-cmds.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 common-cmds.h diff --git a/common-cmds.h b/common-cmds.h new file mode 100644 index 00000000000000..540bd39e8aa835 --- /dev/null +++ b/common-cmds.h @@ -0,0 +1,23 @@ +struct cmdname_help +{ + char name[16]; + char help[80]; +}; + +static struct cmdname_help common_cmds[] = +{ + { "add", "" }, + { "branch", "" }, + { "checkout", "" }, + { "clone", "" }, + { "commit", "" }, + { "diff", "" }, + { "fetch", "" }, + { "init", "" }, + { "merge", "" }, + { "remote", "" }, + { "reset", "" }, + { "shortlog", "" }, + { "status", "" } +}; + From 9c17e35c6991b7263b826d30f98d56b4de75372f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 21 Feb 2011 15:23:23 -0800 Subject: [PATCH 177/211] Guard functions with NO_PTHREADS --- thread-utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thread-utils.c b/thread-utils.c index 97396a75ae4fc3..0900c9a7b8510c 100644 --- a/thread-utils.c +++ b/thread-utils.c @@ -18,6 +18,8 @@ # endif #endif +#ifndef NO_PTHREADS + int online_cpus(void) { #ifdef _SC_NPROCESSORS_ONLN @@ -59,3 +61,5 @@ int init_recursive_mutex(pthread_mutex_t *m) } return ret; } + +#endif From 5c8cdccfd9ed4175c6d1b22521ecbbfa70319681 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:49:23 -0800 Subject: [PATCH 178/211] Replace empty loop bodies with 'continue' This avoids warnings. --- builtin/mailinfo.c | 2 +- combine-diff.c | 12 ++++++------ diff-delta.c | 2 +- imap-send.c | 2 +- quote.c | 4 ++-- setup.c | 3 ++- xdiff/xdiffi.c | 26 +++++++++++++------------- xdiff/xutils.c | 2 +- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index cf11c8d6071dd7..b7f606f3b49979 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -270,7 +270,7 @@ static void cleanup_space(struct strbuf *sb) for (pos = 0; pos < sb->len; pos++) { if (isspace(sb->buf[pos])) { sb->buf[pos] = ' '; - for (cnt = 0; isspace(sb->buf[pos + cnt + 1]); cnt++); + for (cnt = 0; isspace(sb->buf[pos + cnt + 1]); cnt++) continue; strbuf_remove(sb, pos + 1, cnt); } } diff --git a/combine-diff.c b/combine-diff.c index fd6d63c703062e..7666bba36df6ae 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -113,8 +113,8 @@ static int match_string_spaces(const char *line1, int len1, long flags) { if (flags & XDF_WHITESPACE_FLAGS) { - for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--); - for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--); + for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--) continue; + for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--) continue; } if (!(flags & (XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_CHANGE))) @@ -128,8 +128,8 @@ static int match_string_spaces(const char *line1, int len1, (!XDL_ISSPACE(line1[len1]) || !XDL_ISSPACE(line2[len2]))) return 0; - for (; len1 > 0 && XDL_ISSPACE(line1[len1]); len1--); - for (; len2 > 0 && XDL_ISSPACE(line2[len2]); len2--); + for (; len1 > 0 && XDL_ISSPACE(line1[len1]); len1--) continue; + for (; len2 > 0 && XDL_ISSPACE(line2[len2]); len2--) continue; } if (line1[len1] != line2[len2]) return 0; @@ -137,8 +137,8 @@ static int match_string_spaces(const char *line1, int len1, if (flags & XDF_IGNORE_WHITESPACE) { /* Consume remaining spaces */ - for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--); - for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--); + for (; len1 > 0 && XDL_ISSPACE(line1[len1 - 1]); len1--) continue; + for (; len2 > 0 && XDL_ISSPACE(line2[len2 - 1]); len2--) continue; } /* We matched full line1 and line2 */ diff --git a/diff-delta.c b/diff-delta.c index 3797ce6041981d..1f92bbe226355d 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -155,7 +155,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) entries = 0xfffffffeU / RABIN_WINDOW; } hsize = entries / 4; - for (i = 4; (1u << i) < hsize; i++); + for (i = 4; (1u << i) < hsize; i++) continue; hsize = 1 << i; hmask = hsize - 1; diff --git a/imap-send.c b/imap-send.c index 0bc6f7fae151ea..5f2ecaca92f30a 100644 --- a/imap-send.c +++ b/imap-send.c @@ -699,7 +699,7 @@ static int parse_response_code(struct imap_store *ctx, struct imap_cmd_cb *cb, /* RFC2060 says that these messages MUST be displayed * to the user */ - for (; isspace((unsigned char)*p); p++); + for (; isspace((unsigned char)*p); p++) continue; fprintf(stderr, "*** IMAP ALERT *** %s\n", p); } else if (cb && cb->ctx && !strcmp("APPENDUID", arg)) { if (!(arg = next_arg(&s)) || !(ctx->uidvalidity = atoi(arg)) || diff --git a/quote.c b/quote.c index 45e3db12d514dd..d9e7f4afb2a73b 100644 --- a/quote.c +++ b/quote.c @@ -169,9 +169,9 @@ static size_t next_quote_pos(const char *s, ssize_t maxlen) { size_t len; if (maxlen < 0) { - for (len = 0; !sq_must_quote(s[len]); len++); + for (len = 0; !sq_must_quote(s[len]); len++) continue; } else { - for (len = 0; len < maxlen && !sq_must_quote(s[len]); len++); + for (len = 0; len < maxlen && !sq_must_quote(s[len]); len++) continue; } return len; } diff --git a/setup.c b/setup.c index 0a22f8bd1d631f..941faa6b090c57 100644 --- a/setup.c +++ b/setup.c @@ -694,7 +694,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok) return setup_bare_git_dir(cwd, offset, len, nongit_ok); offset_parent = offset; - while (--offset_parent > ceil_offset && cwd[offset_parent] != '/'); + while (--offset_parent > ceil_offset && cwd[offset_parent] != '/') + continue; if (offset_parent <= ceil_offset) return setup_nongit(cwd, nongit_ok); if (one_filesystem) { diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c index 2358a2d6326e54..ab2478bc6ac974 100644 --- a/xdiff/xdiffi.c +++ b/xdiff/xdiffi.c @@ -102,7 +102,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1, i1 = kvdf[d + 1]; prev1 = i1; i2 = i1 - d; - for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++); + for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++) continue; if (i1 - prev1 > xenv->snake_cnt) got_snake = 1; kvdf[d] = i1; @@ -137,7 +137,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1, i1 = kvdb[d + 1] - 1; prev1 = i1; i2 = i1 - d; - for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--); + for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--) continue; if (prev1 - i1 > xenv->snake_cnt) got_snake = 1; kvdb[d] = i1; @@ -273,8 +273,8 @@ int xdl_recs_cmp(diffdata_t *dd1, long off1, long lim1, /* * Shrink the box by walking through each diagonal snake (SW and NE). */ - for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++); - for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--); + for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++) continue; + for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--) continue; /* * If one dimension is empty, then all records on the other one must @@ -421,7 +421,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * a zero at position -1 and N. */ for (; ix < nrec && !rchg[ix]; ix++) - while (rchgo[ixo++]); + while (rchgo[ixo++]) continue; if (ix == nrec) break; @@ -431,8 +431,8 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * indexes (ix and ixo). */ ixs = ix; - for (ix++; rchg[ix]; ix++); - for (; rchgo[ixo]; ixo++); + for (ix++; rchg[ix]; ix++) continue; + for (; rchgo[ixo]; ixo++) continue; do { grpsiz = ix - ixs; @@ -453,8 +453,8 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * the start index accordingly (and so the other-file * end-of-group index). */ - for (; rchg[ixs - 1]; ixs--); - while (rchgo[--ixo]); + for (; rchg[ixs - 1]; ixs--) continue; + while (rchgo[--ixo]) continue; } /* @@ -483,7 +483,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { * index in case we are shifting together with a * corresponding group of changes in the other file. */ - for (; rchg[ix]; ix++); + for (; rchg[ix]; ix++) continue; while (rchgo[++ixo]) ixref = ix; } @@ -496,7 +496,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) { while (ixref < ix) { rchg[--ixs] = 1; rchg[--ix] = 0; - while (rchgo[--ixo]); + while (rchgo[--ixo]) continue; } } @@ -514,8 +514,8 @@ int xdl_build_script(xdfenv_t *xe, xdchange_t **xscr) { */ for (i1 = xe->xdf1.nrec, i2 = xe->xdf2.nrec; i1 >= 0 || i2 >= 0; i1--, i2--) if (rchg1[i1 - 1] || rchg2[i2 - 1]) { - for (l1 = i1; rchg1[i1 - 1]; i1--); - for (l2 = i2; rchg2[i2 - 1]; i2--); + for (l1 = i1; rchg1[i1 - 1]; i1--) continue; + for (l2 = i2; rchg2[i2 - 1]; i2--) continue; if (!(xch = xdl_add_change(cscr, i1, i2, l1 - i1, l2 - i2))) { xdl_free_script(cscr); diff --git a/xdiff/xutils.c b/xdiff/xutils.c index 62cb23dfd37743..26c7e1db3c833f 100644 --- a/xdiff/xutils.c +++ b/xdiff/xutils.c @@ -387,7 +387,7 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) { unsigned int xdl_hashbits(unsigned int size) { unsigned int val = 1, bits = 0; - for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++); + for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++) continue; return bits ? bits: 1; } From 7dbe8adc657621611b2f53ce744b7119dfb05317 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:21:45 -0800 Subject: [PATCH 179/211] Explicitly return after calling noreturn functions Metrowerks C doesn't support the __noreturn__ attribute and doesn't know that die() and exit() don't return. --- builtin/bundle.c | 3 +++ builtin/commit.c | 3 +++ builtin/grep.c | 3 +++ builtin/help.c | 3 +++ builtin/mailsplit.c | 3 +++ builtin/pack-redundant.c | 3 +++ builtin/push.c | 3 +++ config.c | 4 ++-- connect.c | 3 +++ date.c | 3 +++ diff.c | 3 +++ fetch-pack.c | 3 +++ grep.c | 6 ++++++ help.c | 3 +++ imap-send.c | 3 +++ line-range.c | 3 +++ notes-merge.c | 3 +++ object.c | 5 +++++ parse-options.c | 3 +++ read-cache.c | 3 +++ remote.c | 3 +++ revision.c | 3 +++ setup.c | 3 +++ shell.c | 3 +++ submodule.c | 3 +++ transport.c | 3 +++ wt-status.c | 3 +++ 27 files changed, 85 insertions(+), 2 deletions(-) diff --git a/builtin/bundle.c b/builtin/bundle.c index 92a8a6026a9bd6..5dc32796a4d372 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -62,4 +62,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix) list_bundle_refs(&header, argc, argv); } else usage(builtin_bundle_usage); + + /* Not reached */ + return 0; } diff --git a/builtin/commit.c b/builtin/commit.c index 12afc42d197bfa..74730778b9a3c2 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1000,6 +1000,9 @@ static const char *find_author_by_nickname(const char *name) return strbuf_detach(&buf, NULL); } die(_("No existing author found with '%s'"), name); + + /* Not reached */ + return NULL; } diff --git a/builtin/grep.c b/builtin/grep.c index b8d440d0e09954..89cdc3894f7b27 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -491,6 +491,9 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec, return hit; } die(_("unable to grep from object of type %s"), typename(obj->type)); + + /* Not reached */ + return 0; } static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec, diff --git a/builtin/help.c b/builtin/help.c index 1fdefeb6867cdd..d0eaf8d7bc4263 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -62,6 +62,9 @@ static enum help_format parse_help_format(const char *format) if (!strcmp(format, "web") || !strcmp(format, "html")) return HELP_FORMAT_WEB; die(_("unrecognized help format '%s'"), format); + + /* Not reached */ + return HELP_FORMAT_NONE; } static const char *get_man_viewer_info(const char *name) diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index 06296d4bdf6074..691659a51055c4 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -98,6 +98,9 @@ static int split_one(FILE *mbox, const char *name, int allow_bare) unlink(name); fprintf(stderr, "corrupt mailbox\n"); exit(1); + + /* Not reached */ + return 0; } static int populate_maildir_list(struct string_list *list, const char *path) diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index 649c3aaa93ccda..752af17902becd 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -580,6 +580,9 @@ static struct pack_list * add_pack_file(const char *filename) p = p->next; } die("Filename %s not found in packed_git", filename); + + /* Not reached */ + return NULL; } static void load_all(void) diff --git a/builtin/push.c b/builtin/push.c index f8dfea41e1ad8b..6573f010de0105 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -152,6 +152,9 @@ static NORETURN int die_push_simple(struct branch *branch, struct remote *remote "%s"), remote->name, short_upstream, remote->name, branch->name, advice_maybe); + + /* Not reached */ + return 0; } static const char message_detached_head_die[] = diff --git a/config.c b/config.c index 5272fc6f0b0c38..1a0470d6666b0a 100644 --- a/config.c +++ b/config.c @@ -450,8 +450,8 @@ static int git_parse_source(config_fn_t fn, void *data) } if (cf->die_on_error) die("bad config file line %d in %s", cf->linenr, cf->name); - else - return error("bad config file line %d in %s", cf->linenr, cf->name); + + return error("bad config file line %d in %s", cf->linenr, cf->name); } static int parse_unit_factor(const char *end, uintmax_t *val) diff --git a/connect.c b/connect.c index a983d061a90f0b..c3fa9c181ee7ea 100644 --- a/connect.c +++ b/connect.c @@ -277,6 +277,9 @@ static enum protocol get_protocol(const char *name) if (!strcmp(name, "file")) return PROTO_FILE; die("I don't handle protocol '%s'", name); + + /* Not reached */ + return (enum protocol)0; } #define STR_(s) # s diff --git a/date.c b/date.c index 782de95d90c6ac..086c9adcfdd8b3 100644 --- a/date.c +++ b/date.c @@ -764,6 +764,9 @@ enum date_mode parse_date_format(const char *format) return DATE_RAW; else die("unknown date format %s", format); + + /* Not reached */ + return DATE_NORMAL; } void datestamp(char *buf, int bufsize) diff --git a/diff.c b/diff.c index 68bb8c5a849350..99858311d8b23a 100644 --- a/diff.c +++ b/diff.c @@ -560,6 +560,9 @@ static struct diff_tempfile *claim_diff_tempfile(void) { if (!diff_temp[i].name) return diff_temp + i; die("BUG: diff is failing to clean up its tempfiles"); + + /* Not reached */ + return NULL; } static int remove_tempfile_installed; diff --git a/fetch-pack.c b/fetch-pack.c index eeee2bb7e08a21..3c3ac2ffe1d5a5 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -208,6 +208,9 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1) } } die("git fetch_pack: expected ACK/NAK, got '%s'", line); + + /* Not reached */ + return NAK; } static void send_request(struct fetch_pack_args *args, diff --git a/grep.c b/grep.c index 4aef0a69d084de..16b6702e4234c3 100644 --- a/grep.c +++ b/grep.c @@ -54,6 +54,9 @@ static int parse_pattern_type_arg(const char *opt, const char *arg) else if (!strcmp(arg, "perl")) return GREP_PATTERN_TYPE_PCRE; die("bad %s argument: %s", opt, arg); + + /* Not reached */ + return 0; } /* @@ -1750,6 +1753,9 @@ static int grep_source_load(struct grep_source *gs) return gs->buf ? 0 : -1; } die("BUG: invalid grep_source type"); + + /* Not reached */ + return 0; } void grep_source_load_driver(struct grep_source *gs) diff --git a/help.c b/help.c index b266b09320c067..3b7bbb71360b29 100644 --- a/help.c +++ b/help.c @@ -390,6 +390,9 @@ const char *help_unknown_cmd(const char *cmd) } exit(1); + + /* Not reached */ + return NULL; } int cmd_version(int argc, const char **argv, const char *prefix) diff --git a/imap-send.c b/imap-send.c index 0bc6f7fae151ea..848e476821aa33 100644 --- a/imap-send.c +++ b/imap-send.c @@ -924,6 +924,9 @@ static char *cram(const char *challenge_64, const char *user, const char *pass) { die("If you want to use CRAM-MD5 authenticate method, " "you have to build git-imap-send with OpenSSL library."); + + /* not reached */ + return NULL; } #endif diff --git a/line-range.c b/line-range.c index de4e32f9424fbc..0b0360452241f2 100644 --- a/line-range.c +++ b/line-range.c @@ -113,6 +113,9 @@ static const char *parse_loc(const char *spec, nth_line_fn_t nth_line, die("-L parameter '%s' starting at line %ld: %s", spec + 1, begin + 1, errbuf); } + + /* Not reached */ + return NULL; } static int match_funcname(xdemitconf_t *xecfg, const char *bol, const char *eol) diff --git a/notes-merge.c b/notes-merge.c index 94a1a8ae466733..32d27174d69803 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -466,6 +466,9 @@ static int merge_one_change(struct notes_merge_options *o, return 0; } die("Unknown strategy (%i).", o->strategy); + + /* Not reached */ + return 0; } static int merge_changes(struct notes_merge_options *o, diff --git a/object.c b/object.c index 57a0890a87b66e..7d515000fb895f 100644 --- a/object.c +++ b/object.c @@ -41,6 +41,9 @@ int type_from_string(const char *str) if (!strcmp(str, object_type_strings[i])) return i; die("invalid object type \"%s\"", str); + + /* Not reached */ + return 0; } /* @@ -227,6 +230,8 @@ struct object *parse_object_or_die(const unsigned char *sha1, return o; die(_("unable to parse object: %s"), name ? name : sha1_to_hex(sha1)); + + return o; } struct object *parse_object(const unsigned char *sha1) diff --git a/parse-options.c b/parse-options.c index b536896f2689de..a99a65414ae862 100644 --- a/parse-options.c +++ b/parse-options.c @@ -179,6 +179,9 @@ static int get_value(struct parse_opt_ctx_t *p, default: die("should not happen, someone must be hit on the forehead"); } + + /* Not reached */ + return 0; } static int parse_short_opt(struct parse_opt_ctx_t *p, const struct option *options) diff --git a/read-cache.c b/read-cache.c index 7f5645e74546e4..9d8f6195f8c5f5 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1529,6 +1529,9 @@ int read_index_from(struct index_state *istate, const char *path) unmap: munmap(mmap, mmap_size); die("index file corrupt"); + + /* Not reached */ + return 0; } int is_index_unborn(struct index_state *istate) diff --git a/remote.c b/remote.c index eea2c8de45052e..1e256ef2fc1050 100644 --- a/remote.c +++ b/remote.c @@ -637,6 +637,9 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp return NULL; } die("Invalid refspec '%s'", refspec[i]); + + /* Not reached */ + return NULL; } int valid_fetch_refspec(const char *fetch_refspec_str) diff --git a/revision.c b/revision.c index 8351e794df943e..665c509384bffa 100644 --- a/revision.c +++ b/revision.c @@ -332,6 +332,9 @@ static struct commit *handle_commit(struct rev_info *revs, return NULL; } die("%s is unknown object", name); + + /* Not reached */ + return NULL; } static int everybody_uninteresting(struct commit_list *orig) diff --git a/setup.c b/setup.c index 0a22f8bd1d631f..b026469ae63a3e 100644 --- a/setup.c +++ b/setup.c @@ -149,6 +149,9 @@ int check_filename(const char *prefix, const char *arg) if (errno == ENOENT || errno == ENOTDIR) return 0; /* file does not exist */ die_errno("failed to stat '%s'", arg); + + /* Not reached */ + return 0; } static void NORETURN die_verify_filename(const char *prefix, diff --git a/shell.c b/shell.c index 5c0d47a5cc1ae8..5e037d08d20514 100644 --- a/shell.c +++ b/shell.c @@ -224,4 +224,7 @@ int main(int argc, char **argv) die("invalid command format '%s': %s", argv[2], split_cmdline_strerror(count)); } + + /* Not reached */ + return 0; } diff --git a/submodule.c b/submodule.c index b80ecacf60dc87..8da47b19c7c0ae 100644 --- a/submodule.c +++ b/submodule.c @@ -357,6 +357,9 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg) return RECURSE_SUBMODULES_ON_DEMAND; die("bad %s argument: %s", opt, arg); } + + /* Not reached */ + return 0; } void show_submodule_summary(FILE *f, const char *path, diff --git a/transport.c b/transport.c index 325f03e1eef97d..e6ec67b746438a 100644 --- a/transport.c +++ b/transport.c @@ -1287,6 +1287,9 @@ int transport_connect(struct transport *transport, const char *name, return transport->connect(transport, name, exec, fd); else die("Operation not supported by protocol"); + + /* Not reached */ + return 0; } int transport_disconnect(struct transport *transport) diff --git a/wt-status.c b/wt-status.c index 86fec8986f3c22..4111fa225d73e0 100644 --- a/wt-status.c +++ b/wt-status.c @@ -265,6 +265,9 @@ static const char *wt_status_unmerged_status_string(int stagemask) default: die(_("bug: unhandled unmerged status %x"), stagemask); } + + /* Not reached */ + return NULL; } static const char *wt_status_diff_status_string(int status) From 2d7430d743c336810d667975a218bac2743d1c9a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:57:16 -0800 Subject: [PATCH 180/211] Return instead of calling exit() where equivalent Metrowerks C doesn't recognize the __noreturn__ attribute, so this avoids warnings. --- builtin/merge-ours.c | 2 +- builtin/mktree.c | 2 +- test-match-trees.c | 2 +- test-sha1.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index 684411694f64ca..522e3690295104 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -30,5 +30,5 @@ int cmd_merge_ours(int argc, const char **argv, const char *prefix) */ if (cmd_diff_index(NARGS, diff_index_args, prefix)) exit(2); - exit(0); + return 0; } diff --git a/builtin/mktree.c b/builtin/mktree.c index a964d6be521c09..6cbf10c3c44031 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -184,5 +184,5 @@ int cmd_mktree(int ac, const char **av, const char *prefix) used=0; /* reset tree entry buffer for re-use in batch mode */ } strbuf_release(&sb); - exit(0); + return 0; } diff --git a/test-match-trees.c b/test-match-trees.c index 2ef725e5ff94c4..a7aa6b16f725f0 100644 --- a/test-match-trees.c +++ b/test-match-trees.c @@ -20,5 +20,5 @@ int main(int ac, char **av) shift_tree(one->object.sha1, two->object.sha1, shifted, -1); printf("shifted: %s\n", sha1_to_hex(shifted)); - exit(0); + return 0; } diff --git a/test-sha1.c b/test-sha1.c index e57eae10bf73ba..50e6a71e9d44cc 100644 --- a/test-sha1.c +++ b/test-sha1.c @@ -52,5 +52,5 @@ int main(int ac, char **av) fwrite(sha1, 1, 20, stdout); else puts(sha1_to_hex(sha1)); - exit(0); + return 0; } From f6a19b9222593c33018ec626d4cad4be5f14e517 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 23:06:36 -0800 Subject: [PATCH 181/211] Return unconditionally at the end of cmd_push() The 'else' clause is superfluous since usage_with_options() doesn't return. This avoids a warning. --- builtin/push.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/push.c b/builtin/push.c index f8dfea41e1ad8b..f034c48e3bf99d 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -530,6 +530,5 @@ int cmd_push(int argc, const char **argv, const char *prefix) rc = do_push(repo, flags); if (rc == -1) usage_with_options(push_usage, options); - else - return rc; + return rc; } From eee60b3ad32f72f20ebd0298063f5f41eb74d6ee Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 7 Mar 2010 22:53:44 -0800 Subject: [PATCH 182/211] Silence warnings of uninitialized variable use --- builtin/rev-list.c | 2 +- fast-import.c | 2 +- merge-recursive.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 9f92905379d180..8627b3b1316e06 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -378,7 +378,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) mark_edges_uninteresting(&revs, show_edge); if (bisect_list) { - int reaches = reaches, all = all; + int reaches, all; revs.commits = find_bisection(revs.commits, &reaches, &all, bisect_find_all); diff --git a/fast-import.c b/fast-import.c index fb4738d373a5a1..9c9496ad39dff3 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2921,7 +2921,7 @@ static void cat_blob(struct object_entry *oe, unsigned char sha1[20]) static void parse_cat_blob(void) { const char *p; - struct object_entry *oe = oe; + struct object_entry *oe; unsigned char sha1[20]; /* cat-blob SP LF */ diff --git a/merge-recursive.c b/merge-recursive.c index cab16fafb5c2b7..a2b2b5002c24b3 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1892,7 +1892,7 @@ int merge_recursive(struct merge_options *o, { struct commit_list *iter; struct commit *merged_common_ancestors; - struct tree *mrtree = mrtree; + struct tree *mrtree; int clean; if (show(o, 4)) { From 19416ada8f471d4443dd28594c0f4cc326e42700 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 22 Apr 2024 07:42:09 -0400 Subject: [PATCH 183/211] pretty.c: Silence uninitialized variable warning --- pretty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pretty.c b/pretty.c index c9cf67ea7c8501..fc77efaf793f47 100644 --- a/pretty.c +++ b/pretty.c @@ -1528,7 +1528,7 @@ void format_commit_message(const struct commit *commit, } if (output_enc) { - int outsz; + int outsz = 0; char *out = reencode_string_len(sb->buf, sb->len, output_enc, utf8, &outsz); if (out) From fc98575d5115e64d248875933a6c655c26aaf39f Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Sun, 19 Nov 2023 04:07:29 -0500 Subject: [PATCH 184/211] Silence warning when setsockopt() yields ENOSYS --- connect.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connect.c b/connect.c index a983d061a90f0b..ec58c60935bf68 100644 --- a/connect.c +++ b/connect.c @@ -309,6 +309,9 @@ static void enable_keepalive(int sockfd) int ka = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) + #ifdef __RELIX__ + if (errno != ENOSYS) + #endif fprintf(stderr, "unable to set SO_KEEPALIVE on socket: %s\n", strerror(errno)); } From 983eaac12c2d2cd66c71c3de89f897b28fa0d848 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 13 Jan 2010 17:11:53 -0800 Subject: [PATCH 185/211] Add A-line config files for git in MacRelix Link with dlmalloc so malloc() can use temporary memory. Link with plproxy's poll_compat for poll() over select(). This is needed for git-daemon. --- A-line.confd/Source.list | 286 +++++++++++++++++++++++++++++++++++++++ A-line.confd/git.conf | 33 +++++ 2 files changed, 319 insertions(+) create mode 100644 A-line.confd/Source.list create mode 100644 A-line.confd/git.conf diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list new file mode 100644 index 00000000000000..40cbd855f52d49 --- /dev/null +++ b/A-line.confd/Source.list @@ -0,0 +1,286 @@ +abspath.c +advice.c +alias.c +alloc.c +archive-tar.c +archive-zip.c +archive.c +argv-array.c +attr.c +base85.c +bisect.c +blob.c +block-sha1/sha1.c +branch.c +builtin/add.c +builtin/annotate.c +builtin/apply.c +builtin/archive.c +builtin/bisect--helper.c +builtin/blame.c +builtin/branch.c +builtin/bundle.c +builtin/cat-file.c +builtin/check-attr.c +builtin/check-ignore.c +builtin/check-mailmap.c +builtin/check-ref-format.c +builtin/checkout-index.c +builtin/checkout.c +builtin/clean.c +builtin/clone.c +builtin/column.c +builtin/commit-tree.c +builtin/commit.c +builtin/config.c +builtin/count-objects.c +builtin/credential.c +builtin/describe.c +builtin/diff-files.c +builtin/diff-index.c +builtin/diff-tree.c +builtin/diff.c +builtin/fast-export.c +builtin/fetch-pack.c +builtin/fetch.c +builtin/fmt-merge-msg.c +builtin/for-each-ref.c +builtin/fsck.c +builtin/gc.c +builtin/get-tar-commit-id.c +builtin/grep.c +builtin/hash-object.c +builtin/help.c +builtin/index-pack.c +builtin/init-db.c +builtin/log.c +builtin/ls-files.c +builtin/ls-remote.c +builtin/ls-tree.c +builtin/mailinfo.c +builtin/mailsplit.c +builtin/merge-base.c +builtin/merge-file.c +builtin/merge-index.c +builtin/merge-ours.c +builtin/merge-recursive.c +builtin/merge-tree.c +builtin/merge.c +builtin/mktag.c +builtin/mktree.c +builtin/mv.c +builtin/name-rev.c +builtin/notes.c +builtin/pack-objects.c +builtin/pack-redundant.c +builtin/pack-refs.c +builtin/patch-id.c +builtin/prune-packed.c +builtin/prune.c +builtin/push.c +builtin/read-tree.c +builtin/receive-pack.c +builtin/reflog.c +builtin/remote.c +builtin/remote-ext.c +builtin/remote-fd.c +builtin/repack.c +builtin/replace.c +builtin/rerere.c +builtin/reset.c +builtin/rev-list.c +builtin/rev-parse.c +builtin/revert.c +builtin/rm.c +builtin/send-pack.c +builtin/shortlog.c +builtin/show-branch.c +builtin/show-ref.c +builtin/stripspace.c +builtin/symbolic-ref.c +builtin/tag.c +builtin/unpack-file.c +builtin/unpack-objects.c +builtin/update-index.c +builtin/update-ref.c +builtin/update-server-info.c +builtin/upload-archive.c +builtin/var.c +builtin/verify-pack.c +builtin/verify-tag.c +builtin/write-tree.c +bulk-checkin.c +bundle.c +cache-tree.c +check-racy.c +color.c +column.c +combine-diff.c +commit.c +compat/basename.c +compat/inet_pton.c +compat/memmem.c +compat/mmap.c +compat/obstack.c +compat/strcasestr.c +compat/terminal.c +config.c +connect.c +connected.c +convert.c +copy.c +credential.c +csum-file.c +ctype.c +daemon.c +date.c +decorate.c +diff-delta.c +diff-lib.c +diff-no-index.c +diff.c +diffcore-break.c +diffcore-delta.c +diffcore-order.c +diffcore-pickaxe.c +diffcore-rename.c +dir.c +editor.c +entry.c +environment.c +ewah/bitmap.c +ewah/ewah_bitmap.c +ewah/ewah_io.c +ewah/ewah_rlw.c +exec_cmd.c +fast-import.c +fetch-pack.c +fsck.c +git.c +gpg-interface.c +graph.c +grep.c +hashmap.c +help.c +hex.c +http-backend.c +#http-fetch.c +#http-push.c +#http-walker.c +#http.c +ident.c +imap-send.c +kwset.c +levenshtein.c +line-log.c +line-range.c +list-objects.c +ll-merge.c +lockfile.c +log-tree.c +mailmap.c +match-trees.c +merge.c +merge-blobs.c +merge-recursive.c +mergesort.c +name-hash.c +notes.c +notes-cache.c +notes-merge.c +notes-utils.c +object.c +pack-bitmap.c +pack-bitmap-write.c +pack-check.c +pack-objects.c +pack-revindex.c +pack-write.c +pager.c +parse-options.c +parse-options-cb.c +patch-delta.c +patch-ids.c +path.c +pathspec.c +pkt-line.c +preload-index.c +pretty.c +prio-queue.c +progress.c +prompt.c +quote.c +reachable.c +read-cache.c +reflog-walk.c +refs.c +remote.c +replace_object.c +rerere.c +resolve-undo.c +revision.c +run-command.c +send-pack.c +sequencer.c +server-info.c +setup.c +sha1-array.c +sha1-lookup.c +sha1_file.c +sha1_name.c +shallow.c +shell.c +show-index.c +sideband.c +sigchain.c +strbuf.c +streaming.c +string-list.c +submodule.c +symlinks.c +tag.c +test-chmtime.c +test-ctype.c +test-date.c +test-delta.c +test-dump-cache-tree.c +test-genrandom.c +test-index-version.c +test-match-trees.c +#test-parse-options.c +test-path-utils.c +test-run-command.c +test-sha1.c +test-sigchain.c +thread-utils.c +trace.c +transport.c +transport-helper.c +tree-diff.c +tree-walk.c +tree.c +unpack-trees.c +upload-pack.c +url.c +urlmatch.c +usage.c +userdiff.c +utf8.c +varint.c +version.c +versioncmp.c +walker.c +wildmatch.c +wrapper.c +write_or_die.c +ws.c +wt-status.c +xdiff/xdiffi.c +xdiff/xemit.c +xdiff/xhistogram.c +xdiff/xmerge.c +xdiff/xpatience.c +xdiff/xprepare.c +xdiff/xutils.c +xdiff-interface.c +zlib.c diff --git a/A-line.confd/git.conf b/A-line.confd/git.conf new file mode 100644 index 00000000000000..a9b80930a259e7 --- /dev/null +++ b/A-line.confd/git.conf @@ -0,0 +1,33 @@ +product toolkit + +use dlmalloc? +use poll_compat +use POSIX +use zlib + +precompile cache.h + +tools check-racy.c +tools daemon.c +tools fast-import.c +tools git.c +tools http-backend.c +tools http-fetch.c +tools http-push.c +tools imap-send.c +tools shell.c +tools show-index.c +tools test-chmtime.c +tools test-ctype.c +tools test-date.c +tools test-delta.c +tools test-dump-cache-tree.c +tools test-genrandom.c +tools test-index-version.c +tools test-match-trees.c +tools test-parse-options.c +tools test-path-utils.c +tools test-run-command.c +tools test-sha1.c +tools test-sigchain.c +tools upload-pack.c From 10cc4873d1bd5e535032e5041c397228185106e0 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 26 Apr 2024 01:40:57 -0400 Subject: [PATCH 186/211] version.c: Define GIT_VERSION and GIT_USER_AGENT --- version.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/version.c b/version.c index 6106a8098c8a46..1f7b1a47b2af3e 100644 --- a/version.c +++ b/version.c @@ -2,6 +2,12 @@ #include "version.h" #include "strbuf.h" + +#define GIT_VERSION "2.0.1" + +#define GIT_USER_AGENT "git/" GIT_VERSION + + const char git_version_string[] = GIT_VERSION; const char *git_user_agent(void) From f503daf83c28b26c4b78182fc1f0dd49212ed51a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Fri, 26 Apr 2024 01:41:35 -0400 Subject: [PATCH 187/211] exec_cmd.c: Define PREFIX --- exec_cmd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exec_cmd.c b/exec_cmd.c index 125fa6fabf503d..70ffd03bad15d5 100644 --- a/exec_cmd.c +++ b/exec_cmd.c @@ -3,6 +3,10 @@ #include "quote.h" #define MAX_ARGS 32 + +#define PREFIX "/usr" + + static const char *argv_exec_path; static const char *argv0_path; From 942466730c89c0d9495c9018e4239e432064f923 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 2 Apr 2009 20:19:40 -0700 Subject: [PATCH 188/211] Add compat/relix.h to support MacRelix Include *before* defining macros of its functions, in case it's included later (which it is, in the case of fnmatch and xdiff). Define a smaller LARGE_PACKET_MAX for MacRelix due to limited local data space on 68K. Define USE_CPLUSPLUS_FOR_INIT so #pragma cplusplus will be enabled during initialization of aggregates involving values computed at runtime. Add dummy definitions of GIT_{MAN,INFO,HTML}_PATH. Declare reexec(), which when called after vfork() spawns a lightweight process, which shares memory space with the parent but has its own file descriptor set (among other things). This substitutes for fork() in start_async(). --- compat/relix.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 compat/relix.h diff --git a/compat/relix.h b/compat/relix.h new file mode 100644 index 00000000000000..dbe355eaeacfda --- /dev/null +++ b/compat/relix.h @@ -0,0 +1,58 @@ +/* + relix.h + ------- + + MacRelix support, by Josh Juran +*/ + +// Include early so git's macros don't interfere with it later +#include + +// MacRelix has small thread stacks, and 68K has a hard 32K local data limit. +#define LARGE_PACKET_MAX (16384 - 16) + +// Enable #pragma cplusplus over dynamic aggregate initializers. +#define USE_CPLUSPLUS_FOR_INIT 1 + +#define NO_CURL 1 +#define NO_EXPAT 1 +#define NO_GETTEXT 1 +#define NO_ICONV 1 +#define NO_IPV6 1 +// MacRelix has mmap(), but we want the small window size +#define NO_MMAP 1 +#define NO_NSEC 1 +#define NO_OPENSSL 1 +#define NO_PTHREADS 1 +#define NO_LIBGEN_H 1 + +#define SHA1_HEADER "block-sha1/sha1.h" + +#define ETC_GITCONFIG "/etc/gitconfig" + +#define ETC_GITATTRIBUTES "/etc/gitattributes" + +#define GIT_EXEC_PATH "/usr/lib/git-core" + +#define GIT_MAN_PATH "man" +#define GIT_INFO_PATH "info" +#define GIT_HTML_PATH "html" + +#define gitmemmem memmem +#define gitstrcasestr strcasestr + +// All MacRelix architectures are big-endian. + +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + +#ifndef BYTE_ORDER +#define BYTE_ORDER BIG_ENDIAN +#endif + +extern int reexec( void* f, ... ); From a5c4200aa4214f521401ef9aa2523f3485fa6de9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 2 Apr 2009 20:19:40 -0700 Subject: [PATCH 189/211] Include "compat/relix.h" targeting MacRelix --- git-compat-util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index e6a4159a25ea2c..0098c95f23b7e4 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -172,6 +172,9 @@ typedef unsigned long uintptr_t; #define _ALL_SOURCE 1 #endif #endif +#ifdef __RELIX__ +#include "compat/relix.h" +#endif /* used on Mac OS X */ #ifdef PRECOMPOSE_UNICODE From 52a2f13edcc7f70fa17953b76cdbdfd552e18052 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 29 Apr 2024 09:11:16 -0400 Subject: [PATCH 190/211] Update GIT_VERSION to 2.0.2 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 1f7b1a47b2af3e..0810ed85c5aeab 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.0.1" +#define GIT_VERSION "2.0.2" #define GIT_USER_AGENT "git/" GIT_VERSION From 6a4c80327c4b278a2d5fa44226ce4d5d394a069e Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 29 Apr 2024 10:56:34 -0400 Subject: [PATCH 191/211] alloc.c: Silence unprototyped function warning --- alloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/alloc.c b/alloc.c index eb22a45c9d0acf..c1deeb11cff6c5 100644 --- a/alloc.c +++ b/alloc.c @@ -20,6 +20,7 @@ #define DEFINE_ALLOCATOR(name, type) \ static unsigned int name##_allocs; \ +void *alloc_##name##_node(void); \ void *alloc_##name##_node(void) \ { \ static int nr; \ From 6707c2560395813a92237552777373e8d0129edb Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 29 Apr 2024 10:46:17 -0400 Subject: [PATCH 192/211] Update GIT_VERSION to 2.0.3 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 0810ed85c5aeab..56646471de1bce 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.0.2" +#define GIT_VERSION "2.0.3" #define GIT_USER_AGENT "git/" GIT_VERSION From cee31dd7b9ecb358f5e3dedb548c7ca740375ef2 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 29 Apr 2024 12:07:51 -0400 Subject: [PATCH 193/211] Update GIT_VERSION to 2.0.4 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 56646471de1bce..689f10597c01ed 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.0.3" +#define GIT_VERSION "2.0.4" #define GIT_USER_AGENT "git/" GIT_VERSION From 82b666e59bac9733fe42c0f15f0fa789f889f2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 6 Sep 2014 22:53:03 +0200 Subject: [PATCH 194/211] trace: correct trace_strbuf() parameter type for !HAVE_VARIADIC_MACROS Reported-by: dev Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trace.c b/trace.c index e583dc63bb8d70..17015fdb8142a7 100644 --- a/trace.c +++ b/trace.c @@ -216,7 +216,7 @@ void trace_argv_printf(const char **argv, const char *format, ...) va_end(ap); } -void trace_strbuf(const char *key, const struct strbuf *data) +void trace_strbuf(struct trace_key *key, const struct strbuf *data) { trace_strbuf_fl(NULL, 0, key, data); } From 55f685a5ca7bcb13ccbba92cb9546adf69e88ac1 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 10:45:08 -0400 Subject: [PATCH 195/211] builtin/replace.c: Initialize dynamically via C++ --- builtin/replace.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/builtin/replace.c b/builtin/replace.c index 887e8f942c7c5c..4ce4cd731431d4 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -233,10 +233,19 @@ static void import_object(unsigned char *sha1, enum object_type type, die_errno("unable to open %s for reading", filename); if (!raw && type == OBJ_TREE) { + + #ifdef USE_CPLUSPLUS_FOR_INIT + #pragma cplusplus on + #endif + const char *argv[] = { "mktree", NULL }; struct child_process cmd = { argv }; struct strbuf result = STRBUF_INIT; + #ifdef USE_CPLUSPLUS_FOR_INIT + #pragma cplusplus reset + #endif + cmd.argv = argv; cmd.git_cmd = 1; cmd.in = fd; From 81f23b68df2c6233bb38d8254d39e5280941f1e6 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 11:00:30 -0400 Subject: [PATCH 196/211] builtin/replace.c: Return after calling die() --- builtin/replace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/replace.c b/builtin/replace.c index 4ce4cd731431d4..3b6c1192ad44cb 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -509,4 +509,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix) default: die("BUG: invalid cmdmode %d", (int)cmdmode); } + + /* Not reached */ + return 0; } From 8be67f20c815db89c7157b2c710a4fd7ef4f542d Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 10:47:57 -0400 Subject: [PATCH 197/211] builtin/update-ref.c: Return after calling die() --- builtin/update-ref.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 95dead5a81bd8d..0eea082cf89339 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -164,6 +164,9 @@ static int parse_next_sha1(struct strbuf *input, const char **next, "%s %s: unexpected end of input when reading " : "%s %s: unexpected end of input when reading ", command, refname); + + /* Not reached */ + return ret; } From 026d882afbcc89340d74b09ebbb6a3d3a5eba0e1 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 10:49:07 -0400 Subject: [PATCH 198/211] strbuf.c: Silence uninitialized variable warning --- strbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strbuf.c b/strbuf.c index 33018d847f0842..e7a3bd1e633027 100644 --- a/strbuf.c +++ b/strbuf.c @@ -94,7 +94,7 @@ void strbuf_ltrim(struct strbuf *sb) int strbuf_reencode(struct strbuf *sb, const char *from, const char *to) { char *out; - int len; + int len = 0; if (same_encoding(from, to)) return 0; From a82d1aa85a8f594f5b7878bb2137d3052a461684 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 11:02:04 -0400 Subject: [PATCH 199/211] trace.c: Silence unprototyped function warning --- trace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trace.c b/trace.c index 17015fdb8142a7..193e0ead7d5aed 100644 --- a/trace.c +++ b/trace.c @@ -157,6 +157,8 @@ static void trace_argv_vprintf_fl(const char *file, int line, print_trace_line(NULL, &buf); } +void trace_strbuf_fl(const char *file, int line, struct trace_key *key, + const struct strbuf *data); void trace_strbuf_fl(const char *file, int line, struct trace_key *key, const struct strbuf *data) { From c81663179f1afd8b5aa025daddf14ba83ac0d8c4 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 11:06:58 -0400 Subject: [PATCH 200/211] builtin/verify-commit.c: Init dynamically via C++ --- builtin/verify-commit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c index b0f85042b234a3..1ce54e1562b20c 100644 --- a/builtin/verify-commit.c +++ b/builtin/verify-commit.c @@ -70,12 +70,20 @@ static int git_verify_commit_config(const char *var, const char *value, void *cb int cmd_verify_commit(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int i = 1, verbose = 0, had_error = 0; const struct option verify_commit_options[] = { OPT__VERBOSE(&verbose, N_("print commit contents")), OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + git_config(git_verify_commit_config, NULL); argc = parse_options(argc, argv, prefix, verify_commit_options, From d18a56d8b72e80e285bcbc5e9f72b6cd144ace13 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 11:03:26 -0400 Subject: [PATCH 201/211] Source.list: Add new v2.1.0 source files --- A-line.confd/Source.list | 2 ++ 1 file changed, 2 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 40cbd855f52d49..863ddd4444acba 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -106,6 +106,7 @@ builtin/update-ref.c builtin/update-server-info.c builtin/upload-archive.c builtin/var.c +builtin/verify-commit.c builtin/verify-pack.c builtin/verify-tag.c builtin/write-tree.c @@ -233,6 +234,7 @@ shell.c show-index.c sideband.c sigchain.c +split-index.c strbuf.c streaming.c string-list.c From aba83f80fcaf287a6e44c186b2bc20f67a7f9e4c Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Mon, 29 Apr 2024 12:51:19 -0400 Subject: [PATCH 202/211] Update GIT_VERSION to 2.1.0 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 689f10597c01ed..80117e9b85d774 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.0.4" +#define GIT_VERSION "2.1.0" #define GIT_USER_AGENT "git/" GIT_VERSION From 1d3e765b8db33f73d3278e10e965a31f218d533a Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 14:40:52 -0400 Subject: [PATCH 203/211] Update GIT_VERSION to 2.1.1 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 80117e9b85d774..66fa692b441fd7 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.1.0" +#define GIT_VERSION "2.1.1" #define GIT_USER_AGENT "git/" GIT_VERSION From 640cce831735f0fc62d7577e0f01a398d1bc0845 Mon Sep 17 00:00:00 2001 From: Etienne Buira Date: Sat, 11 Oct 2014 16:42:07 +0200 Subject: [PATCH 204/211] index-pack: fix compilation with NO_PTHREADS type_cas_lock/unlock() should be defined as no-op for NO_PTHREADS build, just like all the other locking primitives. Signed-off-by: Etienne Buira Signed-off-by: Junio C Hamano --- builtin/index-pack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/index-pack.c b/builtin/index-pack.c index eebf1a8fc21fd5..0f88f4b32550e7 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -185,6 +185,9 @@ static void cleanup_thread(void) #define deepest_delta_lock() #define deepest_delta_unlock() +#define type_cas_lock() +#define type_cas_unlock() + #endif From 8991abcc0d8ae24527ac62279f76d06276d94ff9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 20:44:26 -0400 Subject: [PATCH 205/211] Update GIT_VERSION to 2.1.2 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 66fa692b441fd7..3a740bf47eed2d 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.1.1" +#define GIT_VERSION "2.1.2" #define GIT_USER_AGENT "git/" GIT_VERSION From 0adbbf4a03139ba61c3b919d9bb9b97c6d4060d9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Tue, 30 Apr 2024 23:07:58 -0400 Subject: [PATCH 206/211] Update GIT_VERSION to 2.1.3 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 3a740bf47eed2d..6c13559950ee72 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.1.2" +#define GIT_VERSION "2.1.3" #define GIT_USER_AGENT "git/" GIT_VERSION From 6452471ff067aa53f046fbc52f32391351c5243b Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 1 May 2024 00:56:34 -0400 Subject: [PATCH 207/211] Use C++ to initialize aggregates to dynamic values --- builtin/hash-object.c | 8 ++++++++ builtin/interpret-trailers.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/builtin/hash-object.c b/builtin/hash-object.c index 61583633182da3..372a352960c594 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -78,6 +78,10 @@ static void hash_stdin_paths(const char *type, int no_filters, unsigned flags, int cmd_hash_object(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + static const char * const hash_object_usage[] = { N_("git hash-object [-t ] [-w] [--path=|--no-filters] [--stdin] [--] ..."), N_("git hash-object --stdin-paths < "), @@ -105,6 +109,10 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix) int prefix_length = -1; const char *errstr = NULL; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, NULL, hash_object_options, hash_object_usage, 0); diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index 46838d24a90a7d..fd9c06c75808fb 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -18,6 +18,10 @@ static const char * const git_interpret_trailers_usage[] = { int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) { +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus on +#endif + int trim_empty = 0; struct string_list trailers = STRING_LIST_INIT_DUP; @@ -28,6 +32,10 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) OPT_END() }; +#ifdef USE_CPLUSPLUS_FOR_INIT +#pragma cplusplus reset +#endif + argc = parse_options(argc, argv, prefix, options, git_interpret_trailers_usage, 0); From 047967fc8fa68136ba812ba4a62128d87deccc84 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 1 May 2024 00:59:04 -0400 Subject: [PATCH 208/211] Source.list: Add new v2.2.0 source files --- A-line.confd/Source.list | 2 ++ 1 file changed, 2 insertions(+) diff --git a/A-line.confd/Source.list b/A-line.confd/Source.list index 863ddd4444acba..c6564b9ea0a00e 100644 --- a/A-line.confd/Source.list +++ b/A-line.confd/Source.list @@ -53,6 +53,7 @@ builtin/hash-object.c builtin/help.c builtin/index-pack.c builtin/init-db.c +builtin/interpret-trailers.c builtin/log.c builtin/ls-files.c builtin/ls-remote.c @@ -256,6 +257,7 @@ test-sha1.c test-sigchain.c thread-utils.c trace.c +trailer.c transport.c transport-helper.c tree-diff.c From 012fcb7738bffca48d066a1dbf9b1c315c7925be Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 1 May 2024 00:50:43 -0400 Subject: [PATCH 209/211] Update GIT_VERSION to 2.2.0 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 6c13559950ee72..8d04a5407f9850 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.1.3" +#define GIT_VERSION "2.2.0" #define GIT_USER_AGENT "git/" GIT_VERSION From ef3bf60075e3df82313a2f07465a4e0130752f35 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 1 May 2024 02:18:57 -0400 Subject: [PATCH 210/211] Update GIT_VERSION to 2.2.1 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 8d04a5407f9850..7706928a5e0cbe 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.2.0" +#define GIT_VERSION "2.2.1" #define GIT_USER_AGENT "git/" GIT_VERSION From c5af77d128c8af02abd40634d34d43b0f0cbd469 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Wed, 1 May 2024 12:22:00 -0400 Subject: [PATCH 211/211] Update GIT_VERSION to 2.2.2 --- version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.c b/version.c index 7706928a5e0cbe..6de967c0c0fb7b 100644 --- a/version.c +++ b/version.c @@ -3,7 +3,7 @@ #include "strbuf.h" -#define GIT_VERSION "2.2.1" +#define GIT_VERSION "2.2.2" #define GIT_USER_AGENT "git/" GIT_VERSION