1
0
mirror of https://github.com/git/git.git synced 2025-02-06 10:24:25 +00:00

Merge branch 'ps/build-sign-compare'

Start working to make the codebase buildable with -Wsign-compare.

* ps/build-sign-compare:
  t/helper: don't depend on implicit wraparound
  scalar: address -Wsign-compare warnings
  builtin/patch-id: fix type of `get_one_patchid()`
  builtin/blame: fix type of `length` variable when emitting object ID
  gpg-interface: address -Wsign-comparison warnings
  daemon: fix type of `max_connections`
  daemon: fix loops that have mismatching integer types
  global: trivial conversions to fix `-Wsign-compare` warnings
  pkt-line: fix -Wsign-compare warning on 32 bit platform
  csum-file: fix -Wsign-compare warning on 32-bit platform
  diff.h: fix index used to loop through unsigned integer
  config.mak.dev: drop `-Wno-sign-compare`
  global: mark code units that generate warnings with `-Wsign-compare`
  compat/win32: fix -Wsign-compare warning in "wWinMain()"
  compat/regex: explicitly ignore "-Wsign-compare" warnings
  git-compat-util: introduce macros to disable "-Wsign-compare" warnings
This commit is contained in:
Junio C Hamano 2024-12-23 09:32:10 -08:00
commit 4156b6a741
266 changed files with 524 additions and 235 deletions

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "add-interactive.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "add-interactive.h"

View File

@ -161,7 +161,6 @@ void advise_if_enabled(enum advice_type type, const char *advice, ...)
int git_default_advice_config(const char *var, const char *value)
{
const char *k, *slot_name;
int i;
if (!strcmp(var, "color.advice")) {
advice_use_color = git_config_colorbool(var, value);
@ -180,7 +179,7 @@ int git_default_advice_config(const char *var, const char *value)
if (!skip_prefix(var, "advice.", &k))
return 0;
for (i = 0; i < ARRAY_SIZE(advice_setting); i++) {
for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++) {
if (strcasecmp(k, advice_setting[i].key))
continue;
advice_setting[i].level = git_config_bool(var, value)
@ -194,9 +193,7 @@ int git_default_advice_config(const char *var, const char *value)
void list_config_advices(struct string_list *list, const char *prefix)
{
int i;
for (i = 0; i < ARRAY_SIZE(advice_setting); i++)
for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++)
list_config_item(list, prefix, advice_setting[i].key);
}

View File

@ -8,6 +8,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"

1
attr.c
View File

@ -7,6 +7,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"

View File

@ -29,10 +29,9 @@ static const char en85[] = {
static char de85[256];
static void prep_base85(void)
{
int i;
if (de85['Z'])
return;
for (i = 0; i < ARRAY_SIZE(en85); i++) {
for (size_t i = 0; i < ARRAY_SIZE(en85); i++) {
int ch = en85[i];
de85[ch] = i + 1;
}

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "refs.h"

View File

@ -1,3 +1,5 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "bloom.h"
#include "diff.h"

View File

@ -3,6 +3,7 @@
*
* Copyright (C) 2006 Linus Torvalds
*/
#include "builtin.h"
#include "advice.h"
#include "config.h"
@ -39,9 +40,9 @@ static int chmod_pathspec(struct repository *repo,
char flip,
int show_only)
{
int i, ret = 0;
int ret = 0;
for (i = 0; i < repo->index->cache_nr; i++) {
for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
int err;
@ -69,9 +70,9 @@ static int renormalize_tracked_files(struct repository *repo,
const struct pathspec *pathspec,
int flags)
{
int i, retval = 0;
int retval = 0;
for (i = 0; i < repo->index->cache_nr; i++) {
for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
if (!include_sparse &&

View File

@ -5,6 +5,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "advice.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "copy.h"
#include "environment.h"

View File

@ -4,7 +4,9 @@
* Copyright (c) 2006, 2014 by its authors
* See COPYING for licensing conditions
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "color.h"
@ -465,9 +467,14 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
reset = GIT_COLOR_RESET;
}
if (abbrev < MINIMUM_ABBREV)
BUG("abbreviation is smaller than minimum length: %d < %d",
abbrev, MINIMUM_ABBREV);
for (cnt = 0; cnt < ent->num_lines; cnt++) {
char ch;
int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? the_hash_algo->hexsz : abbrev;
size_t length = (opt & OUTPUT_LONG_OBJECT_NAME) ?
the_hash_algo->hexsz : (size_t) abbrev;
if (opt & OUTPUT_COLOR_LINE) {
if (cnt > 0) {
@ -498,7 +505,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
length--;
putchar('?');
}
printf("%.*s", length, hex);
fwrite(hex, 1, length, stdout);
if (opt & OUTPUT_ANNOTATE_COMPAT) {
const char *name;
if (opt & OUTPUT_SHOW_EMAIL)

View File

@ -4,7 +4,9 @@
* Copyright (c) 2006 Kristian Høgsberg <krh@redhat.com>
* Based on git-branch.sh by Junio C Hamano.
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "color.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "convert.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "entry.h"

View File

@ -4,7 +4,10 @@
* Copyright (C) 2005 Linus Torvalds
*
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "gettext.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
#include "branch.h"

View File

@ -5,7 +5,10 @@
*
* Based on git-clean.sh by Pavel Roskin
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "config.h"

View File

@ -7,7 +7,10 @@
*
* Clone a repository into a different directory that does not yet exist.
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"

View File

@ -4,7 +4,10 @@
* Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com>
* Based on git-commit.sh by Junio C Hamano and Linus Torvalds
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
#include "config.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "environment.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "diff.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "diff.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "diff.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (c) 2006 Junio C Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "ewah/ewok.h"

View File

@ -11,7 +11,9 @@
*
* Copyright (C) 2016 Johannes Schindelin
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
@ -364,7 +366,8 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
char *lbase_dir = NULL, *rbase_dir = NULL;
size_t ldir_len, rdir_len, wtdir_len;
const char *workdir, *tmp;
int ret = 0, i;
int ret = 0;
size_t i;
FILE *fp = NULL;
struct hashmap working_tree_dups = HASHMAP_INIT(working_tree_entry_cmp,
NULL);

View File

@ -3,7 +3,10 @@
*
* Copyright (C) 2007 Johannes E. Schindelin
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "gettext.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "environment.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "gettext.h"
#include "hex.h"

View File

@ -1,7 +1,10 @@
/*
* "git fetch"
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
#include "config.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -36,7 +37,7 @@ int cmd_for_each_repo(int argc,
{
static const char *config_key = NULL;
int keep_going = 0;
int i, result = 0;
int result = 0;
const struct string_list *values;
int err;
@ -61,7 +62,7 @@ int cmd_for_each_repo(int argc,
else if (err)
return 0;
for (i = 0; i < values->nr; i++) {
for (size_t i = 0; i < values->nr; i++) {
int ret = run_command_on_repo(values->items[i].string, argc, argv);
if (ret) {
if (!keep_going)

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "config.h"

View File

@ -9,7 +9,10 @@
*
* Copyright (c) 2006 Shawn O. Pearce
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "date.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (c) 2006 Junio C Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "gettext.h"

View File

@ -1,8 +1,9 @@
/*
* Builtin help command
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "exec-cmd.h"
@ -129,7 +130,6 @@ static void list_config_help(enum show_config_type type)
struct string_list keys = STRING_LIST_INIT_DUP;
struct string_list keys_uniq = STRING_LIST_INIT_DUP;
struct string_list_item *item;
int i;
for (p = config_name_list; *p; p++) {
const char *var = *p;
@ -156,7 +156,7 @@ static void list_config_help(enum show_config_type type)
e->prefix, e->placeholder);
string_list_sort(&keys);
for (i = 0; i < keys.nr; i++) {
for (size_t i = 0; i < keys.nr; i++) {
const char *var = keys.items[i].string;
const char *wildcard, *tag, *cut;
const char *dot = NULL;

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "delta.h"

View File

@ -4,7 +4,10 @@
* (C) Copyright 2006 Linus Torvalds
* 2006 Junio Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "config.h"

View File

@ -5,7 +5,10 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "convert.h"

View File

@ -4,6 +4,9 @@
* It just splits a mbox into a list of files: "0001" "0002" ..
* so you can process them further from there.
*/
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "gettext.h"
#include "string-list.h"
@ -172,7 +175,6 @@ static int split_maildir(const char *maildir, const char *dir,
char *file = NULL;
FILE *f = NULL;
int ret = -1;
int i;
struct string_list list = STRING_LIST_INIT_DUP;
list.cmp = maildir_filename_cmp;
@ -180,7 +182,7 @@ static int split_maildir(const char *maildir, const char *dir,
if (populate_maildir_list(&list, maildir) < 0)
goto out;
for (i = 0; i < list.nr; i++) {
for (size_t i = 0; i < list.nr; i++) {
char *name;
free(file);

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "diff.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "hex.h"
#include "read-cache-ll.h"

View File

@ -7,7 +7,9 @@
*
* Pretend we resolved the heads, but declare our tree trumps everybody else.
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "builtin.h"
#include "diff.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
@ -497,10 +498,9 @@ static int real_merge(struct merge_tree_options *o,
if (!result.clean) {
struct string_list conflicted_files = STRING_LIST_INIT_NODUP;
const char *last = NULL;
int i;
merge_get_conflicted_files(&result, &conflicted_files);
for (i = 0; i < conflicted_files.nr; i++) {
for (size_t i = 0; i < conflicted_files.nr; i++) {
const char *name = conflicted_files.items[i].string;
struct stage_info *c = conflicted_files.items[i].util;
if (!o->name_only)
@ -584,7 +584,7 @@ int cmd_merge_tree(int argc,
if (xopts.nr && o.mode == MODE_TRIVIAL)
die(_("--trivial-merge is incompatible with all other options"));
for (int x = 0; x < xopts.nr; x++)
for (size_t x = 0; x < xopts.nr; x++)
if (parse_merge_opt(&o.merge_options, xopts.v[x]))
die(_("unknown strategy option: -X%s"), xopts.v[x]);

View File

@ -5,7 +5,10 @@
*
* Based on git-merge.sh by Junio C Hamano.
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"

View File

@ -3,7 +3,9 @@
*
* Copyright (C) 2006 Johannes Schindelin
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "environment.h"
#include "gettext.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "environment.h"
#include "gettext.h"

View File

@ -5,6 +5,7 @@
* This file is licensed under the GPL v2.
*
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
@ -389,7 +390,6 @@ static int cmp_remaining_objects(const void *a, const void *b)
static void sort_pack_list(struct pack_list **pl)
{
struct pack_list **ary, *p;
int i;
size_t n = pack_list_size(*pl);
if (n < 2)
@ -403,7 +403,7 @@ static void sort_pack_list(struct pack_list **pl)
QSORT(ary, n, cmp_remaining_objects);
/* link them back again */
for (i = 0; i < n - 1; i++)
for (size_t i = 0; i < n - 1; i++)
ary[i]->next = ary[i + 1];
ary[n - 1]->next = NULL;
*pl = ary[0];

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "diff.h"
@ -8,13 +9,13 @@
#include "parse-options.h"
#include "setup.h"
static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)
static void flush_current_id(size_t patchlen, struct object_id *id, struct object_id *result)
{
if (patchlen)
printf("%s %s\n", oid_to_hex(result), oid_to_hex(id));
}
static int remove_space(char *line)
static size_t remove_space(char *line)
{
char *src = line;
char *dst = line;
@ -61,10 +62,11 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after)
return 1;
}
static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
struct strbuf *line_buf, int stable, int verbatim)
static size_t get_one_patchid(struct object_id *next_oid, struct object_id *result,
struct strbuf *line_buf, int stable, int verbatim)
{
int patchlen = 0, found_next = 0;
size_t patchlen = 0;
int found_next = 0;
int before = -1, after = -1;
int diff_is_binary = 0;
char pre_oid_str[GIT_MAX_HEXSZ + 1], post_oid_str[GIT_MAX_HEXSZ + 1];
@ -76,7 +78,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
while (strbuf_getwholeline(line_buf, stdin, '\n') != EOF) {
char *line = line_buf->buf;
const char *p = line;
int len;
size_t len;
/* Possibly skip over the prefix added by "log" or "format-patch" */
if (!skip_prefix(line, "commit ", &p) &&
@ -177,7 +179,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
static void generate_id_list(int stable, int verbatim)
{
struct object_id oid, n, result;
int patchlen;
size_t patchlen;
struct strbuf line_buf = STRBUF_INIT;
oidclr(&oid, the_repository->hash_algo);

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "commit.h"
#include "diff.h"

View File

@ -7,6 +7,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "config.h"
@ -941,11 +942,10 @@ static int get_can_ff(struct object_id *orig_head,
static int already_up_to_date(struct object_id *orig_head,
struct oid_array *merge_heads)
{
int i;
struct commit *ours;
ours = lookup_commit_reference(the_repository, orig_head);
for (i = 0; i < merge_heads->nr; i++) {
for (size_t i = 0; i < merge_heads->nr; i++) {
struct commit_list *list = NULL;
struct commit *theirs;
int ok;

View File

@ -1,7 +1,9 @@
/*
* "git push"
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "branch.h"
@ -417,7 +419,7 @@ static int do_push(int flags,
const struct string_list *push_options,
struct remote *remote)
{
int i, errs;
int errs;
struct strvec *url;
struct refspec *push_refspec = &rs;
@ -432,7 +434,7 @@ static int do_push(int flags,
}
errs = 0;
url = push_url_of_remote(remote);
for (i = 0; i < url->nr; i++) {
for (size_t i = 0; i < url->nr; i++) {
struct transport *transport =
transport_get(remote, url->v[i]);
if (flags & TRANSPORT_PUSH_OPTIONS)

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "object-name.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (c) 2018 Pratik Karki
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "gettext.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "dir.h"

View File

@ -2,9 +2,11 @@
* "git replay" builtin command
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "environment.h"
#include "hex.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -55,7 +56,7 @@ int cmd_rerere(int argc,
struct repository *repo UNUSED)
{
struct string_list merge_rr = STRING_LIST_INIT_DUP;
int i, autoupdate = -1, flags = 0;
int autoupdate = -1, flags = 0;
struct option options[] = {
OPT_SET_INT(0, "rerere-autoupdate", &autoupdate,
@ -98,11 +99,11 @@ int cmd_rerere(int argc,
if (setup_rerere(the_repository, &merge_rr,
flags | RERERE_READONLY) < 0)
return 0;
for (i = 0; i < merge_rr.nr; i++)
for (size_t i = 0; i < merge_rr.nr; i++)
printf("%s\n", merge_rr.items[i].string);
} else if (!strcmp(argv[0], "remaining")) {
rerere_remaining(the_repository, &merge_rr);
for (i = 0; i < merge_rr.nr; i++) {
for (size_t i = 0; i < merge_rr.nr; i++) {
if (merge_rr.items[i].util != RERERE_RESOLVED)
printf("%s\n", merge_rr.items[i].string);
else
@ -114,7 +115,7 @@ int cmd_rerere(int argc,
if (setup_rerere(the_repository, &merge_rr,
flags | RERERE_READONLY) < 0)
return 0;
for (i = 0; i < merge_rr.nr; i++) {
for (size_t i = 0; i < merge_rr.nr; i++) {
const char *path = merge_rr.items[i].string;
const struct rerere_id *id = merge_rr.items[i].util;
if (diff_two(rerere_path(id, "preimage"), path, path, path))

View File

@ -7,7 +7,9 @@
*
* Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "config.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "commit.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "builtin.h"
#include "parse-options.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (C) Linus Torvalds 2006
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
#include "config.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "commit.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "environment.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "gettext.h"
#include "hash.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "dir.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
@ -873,9 +874,8 @@ static void diff_include_untracked(const struct stash_info *info, struct diff_op
struct tree *tree[ARRAY_SIZE(oid)];
struct tree_desc tree_desc[ARRAY_SIZE(oid)];
struct unpack_trees_options unpack_tree_opt = { 0 };
int i;
for (i = 0; i < ARRAY_SIZE(oid); i++) {
for (size_t i = 0; i < ARRAY_SIZE(oid); i++) {
tree[i] = parse_tree_indirect(oid[i]);
if (parse_tree(tree[i]) < 0)
die(_("failed to parse tree"));
@ -1557,12 +1557,11 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
repo_read_index_preload(the_repository, NULL, 0);
if (!include_untracked && ps->nr) {
int i;
char *ps_matched = xcalloc(ps->nr, 1);
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(the_repository->index);
for (i = 0; i < the_repository->index->cache_nr; i++)
for (size_t i = 0; i < the_repository->index->cache_nr; i++)
ce_path_match(the_repository->index, the_repository->index->cache[i], ps,
ps_matched);

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "environment.h"
@ -194,7 +195,7 @@ static int module_list_compute(const char **argv,
struct pathspec *pathspec,
struct module_list *list)
{
int i, result = 0;
int result = 0;
char *ps_matched = NULL;
parse_pathspec(pathspec, 0,
@ -207,7 +208,7 @@ static int module_list_compute(const char **argv,
if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
for (i = 0; i < the_repository->index->cache_nr; i++) {
for (size_t i = 0; i < the_repository->index->cache_nr; i++) {
const struct cache_entry *ce = the_repository->index->cache[i];
if (!match_pathspec(the_repository->index, pathspec, ce->name, ce_namelen(ce),
@ -3396,7 +3397,6 @@ static void die_on_index_match(const char *path, int force)
die(_("index file corrupt"));
if (ps.nr) {
int i;
char *ps_matched = xcalloc(ps.nr, 1);
/* TODO: audit for interaction with sparse-index. */
@ -3406,7 +3406,7 @@ static void die_on_index_match(const char *path, int force)
* Since there is only one pathspec, we just need to
* check ps_matched[0] to know if a cache entry matched.
*/
for (i = 0; i < the_repository->index->cache_nr; i++) {
for (size_t i = 0; i < the_repository->index->cache_nr; i++) {
ce_path_match(the_repository->index, the_repository->index->cache[i], &ps,
ps_matched);

View File

@ -5,7 +5,10 @@
* Carlos Rica <jasampler@gmail.com>
* Based on git-tag.sh and mktag.c by Linus Torvalds.
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
#include "config.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "bulk-checkin.h"
#include "config.h"

View File

@ -3,7 +3,10 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "bulk-checkin.h"
#include "config.h"

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "gettext.h"

View File

@ -3,7 +3,9 @@
*
* Copyright (C) Eric Biederman, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "attr.h"
@ -178,10 +180,9 @@ static void list_vars(void)
if ((val = ptr->read(0))) {
if (ptr->multivalued && *val) {
struct string_list list = STRING_LIST_INIT_DUP;
int i;
string_list_split(&list, val, '\n', -1);
for (i = 0; i < list.nr; i++)
for (size_t i = 0; i < list.nr; i++)
printf("%s=%s\n", ptr->name, list.items[i].string);
string_list_clear(&list, 0);
} else {

View File

@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "advice.h"

View File

@ -3,6 +3,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "bulk-checkin.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "bundle-uri.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "lockfile.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "gettext.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "chunk-format.h"

View File

@ -1,3 +1,5 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
#include "color.h"

View File

@ -1,3 +1,5 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
#include "column.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "object-store-ll.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "commit.h"

View File

@ -1765,7 +1765,6 @@ int commit_tree_extended(const char *msg, size_t msg_len,
{ &compat_sig, r->compat_hash_algo },
{ &sig, r->hash_algo },
};
int i;
/*
* We write algorithms in the order they were implemented in
@ -1779,7 +1778,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
* We traverse each algorithm in order, and apply the signature
* to each buffer.
*/
for (i = 0; i < ARRAY_SIZE(bufs); i++) {
for (size_t i = 0; i < ARRAY_SIZE(bufs); i++) {
if (!bufs[i].algo)
continue;
add_header_signature(&buffer, bufs[i].sig, bufs[i].algo);

View File

@ -208,13 +208,12 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef UNUSED,
const char *slash;
char *resolved = NULL;
struct strbuf tmp = STRBUF_INIT;
int k;
/*
* Build a list of all filesystem changes into a private/local
* list and without holding any locks.
*/
for (k = 0; k < num_of_events; k++) {
for (size_t k = 0; k < num_of_events; k++) {
/*
* On Mac, we receive an array of absolute paths.
*/

View File

@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "../git-compat-util.h"
#include "win32.h"

View File

@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>. */
#define DISABLE_SIGN_COMPARE_WARNINGS
/* To bump the minimum Windows version to Windows Vista */
#include "git-compat-util.h"

View File

@ -17,6 +17,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#pragma GCC diagnostic ignored "-Wsign-compare"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

View File

@ -259,14 +259,13 @@ static DWORD cmode_in, cmode_out;
void restore_term(void)
{
if (use_stty) {
int i;
struct child_process cp = CHILD_PROCESS_INIT;
if (stty_restore.nr == 0)
return;
strvec_push(&cp.args, "stty");
for (i = 0; i < stty_restore.nr; i++)
for (size_t i = 0; i < stty_restore.nr; i++)
strvec_push(&cp.args, stty_restore.items[i].string);
run_command(&cp);
string_list_clear(&stty_restore, 0);

View File

@ -53,7 +53,8 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,
wchar_t git_command_line[32768];
size_t size = sizeof(git_command_line) / sizeof(wchar_t);
const wchar_t *needs_quotes = L"";
int slash = 0, i;
size_t slash = 0;
int len;
STARTUPINFO startup_info = {
.cb = sizeof(STARTUPINFO),
@ -66,7 +67,7 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,
DWORD exit_code;
/* First, determine the full path of argv[0] */
for (i = 0; _wpgmptr[i]; i++)
for (size_t i = 0; _wpgmptr[i]; i++)
if (_wpgmptr[i] == L' ')
needs_quotes = L"\"";
else if (_wpgmptr[i] == L'\\')
@ -79,16 +80,16 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,
extend_path(_wpgmptr, slash);
/* Then, add the full path of `git.exe` as argv[0] */
i = swprintf_s(git_command_line, size, L"%ls%.*ls\\git.exe%ls",
needs_quotes, slash, _wpgmptr, needs_quotes);
if (i < 0)
len = swprintf_s(git_command_line, size, L"%ls%.*ls\\git.exe%ls",
needs_quotes, (int) slash, _wpgmptr, needs_quotes);
if (len < 0)
return 127; /* Too long path */
if (*command_line) {
/* Now, append the command-line arguments */
i = swprintf_s(git_command_line + i, size - i,
L" %ls", command_line);
if (i < 0)
len = swprintf_s(git_command_line + len, size - len,
L" %ls", command_line);
if (len < 0)
return 127;
}

View File

@ -1,3 +1,5 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "../git-compat-util.h"
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)

View File

@ -4,6 +4,8 @@
#undef NOGDI
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "../git-compat-util.h"
#include <wingdi.h>
#include <winreg.h>

View File

@ -7,6 +7,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"

Some files were not shown because too many files have changed in this diff Show More