From: Junio C Hamano Date: Sun, 4 Mar 2007 03:47:46 +0000 (-0800) Subject: Merge branch 'maint' X-Git-Tag: v1.5.1-rc1~102 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/253e772edeb56092e0fad43ec0640658671313c5?ds=inline;hp=-c Merge branch 'maint' * maint: Unset NO_C99_FORMAT on Cygwin. Fix a "pointer type missmatch" warning. Fix some "comparison is always true/false" warnings. Fix an "implicit function definition" warning. Fix a "label defined but unreferenced" warning. Document the config variable format.suffix git-merge: fail correctly when we cannot fast forward. builtin-archive: use RUN_SETUP Fix git-gc usage note --- 253e772edeb56092e0fad43ec0640658671313c5 diff --combined Documentation/config.txt index d2b4a05ca5,d9c12f14b9..d20902bc33 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@@ -5,8 -5,7 +5,8 @@@ The git configuration file contains a n the git command's behavior. `.git/config` file for each repository is used to store the information for that repository, and `$HOME/.gitconfig` is used to store per user information to give -fallback values for `.git/config` file. +fallback values for `.git/config` file. The file `/etc/gitconfig` +can be used to store system-wide defaults. They can be used by both the git plumbing and the porcelains. The variables are divided into sections, where @@@ -340,6 -339,11 +340,11 @@@ fetch.unpackLimit: format.headers:: Additional email headers to include in a patch to be submitted by mail. See gitlink:git-format-patch[1]. + + format.suffix:: + The default for format-patch is to output files with the suffix + `.patch`. Use this variable to change that suffix (make sure to + include the dot if you want it). gc.packrefs:: `git gc` does not run `git pack-refs` in a bare repository by @@@ -471,10 -475,6 +476,10 @@@ remote..push: The default set of "refspec" for gitlink:git-push[1]. See gitlink:git-push[1]. +remote..skipDefaultUpdate:: + If true, this remote will be skipped by default when updating + using the remote subcommand of gitlink:git-remote[1]. + remote..receivepack:: The default program to execute on the remote side when pushing. See option \--exec of gitlink:git-push[1]. @@@ -483,14 -483,6 +488,14 @@@ remote..uploadpack: The default program to execute on the remote side when fetching. See option \--exec of gitlink:git-fetch-pack[1]. +remote..tagopt:: + Setting this value to --no-tags disables automatic tag following when fetching + from remote + +remotes.:: + The list of remotes which are fetched by "git remote update + ". See gitlink:git-remote[1]. + repack.usedeltabaseoffset:: Allow gitlink:git-repack[1] to create packs that uses delta-base offset. Defaults to false. diff --combined Makefile index 9a37b15439,f674e556ff..a221bdc027 --- a/Makefile +++ b/Makefile @@@ -89,6 -89,9 +89,9 @@@ all: # # Define NO_ICONV if your libc does not properly support iconv. # + # Define OLD_ICONV if your library has an old iconv(), where the second + # (input buffer pointer) parameter is declared with type (const char **). + # # Define NO_R_TO_GCC if your gcc does not like "-R/path/lib" that # tells runtime paths to dynamic libraries; "-Wl,-rpath=/path/lib" # is used instead. @@@ -128,7 -131,6 +131,7 @@@ prefix = $(HOME bindir = $(prefix)/bin gitexecdir = $(bindir) template_dir = $(prefix)/share/git-core/templates/ +ETC_GITCONFIG = $(prefix)/etc/gitconfig # DESTDIR= # default configuration for gitweb @@@ -177,7 -179,7 +180,7 @@@ SCRIPT_SH = git-merge-one-file.sh git-parse-remote.sh \ git-pull.sh git-rebase.sh \ git-repack.sh git-request-pull.sh git-reset.sh \ - git-resolve.sh git-revert.sh git-sh-setup.sh \ + git-revert.sh git-sh-setup.sh \ git-tag.sh git-verify-tag.sh \ git-applymbox.sh git-applypatch.sh git-am.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ @@@ -267,8 -269,7 +270,8 @@@ LIB_OBJS = revision.o pager.o tree-walk.o xdiff-interface.o \ write_or_die.o trace.o list-objects.o grep.o \ alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \ - color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o + color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \ + convert.o BUILTIN_OBJS = \ builtin-add.o \ @@@ -277,7 -278,6 +280,7 @@@ builtin-archive.o \ builtin-blame.o \ builtin-branch.o \ + builtin-bundle.o \ builtin-cat-file.o \ builtin-checkout-index.o \ builtin-check-ref-format.o \ @@@ -287,6 -287,7 +290,6 @@@ builtin-diff.o \ builtin-diff-files.o \ builtin-diff-index.o \ - builtin-diff-stages.o \ builtin-diff-tree.o \ builtin-fmt-merge-msg.o \ builtin-for-each-ref.o \ @@@ -298,7 -299,6 +301,7 @@@ builtin-ls-tree.o \ builtin-mailinfo.o \ builtin-mailsplit.o \ + builtin-merge-base.o \ builtin-merge-file.o \ builtin-mv.o \ builtin-name-rev.o \ @@@ -378,7 -378,6 +381,6 @@@ ifeq ($(uname_O),Cygwin NO_STRCASESTR = YesPlease NO_SYMLINK_HEAD = YesPlease NEEDS_LIBICONV = YesPlease - NO_C99_FORMAT = YesPlease NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes NO_TRUSTABLE_FILEMODE = UnfortunatelyYes # There are conflicting reports about this. @@@ -576,6 -575,10 +578,10 @@@ ifdef NO_ICON BASIC_CFLAGS += -DNO_ICONV endif + ifdef OLD_ICONV + BASIC_CFLAGS += -DOLD_ICONV + endif + ifdef PPC_SHA1 SHA1_HEADER = "ppc/sha1.h" LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o @@@ -600,7 -603,6 +606,7 @@@ endi # Shell quote (do not use $(call) to accommodate ancient setups); SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER)) +ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG)) DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) bindir_SQ = $(subst ','\'',$(bindir)) @@@ -613,8 -615,7 +619,8 @@@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PA LIBS = $(GITLIBS) $(EXTLIBS) -BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS) +BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \ + -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $(COMPAT_CFLAGS) LIB_OBJS += $(COMPAT_OBJS) ALL_CFLAGS += $(BASIC_CFLAGS) @@@ -830,7 -831,7 +836,7 @@@ GIT-CFLAGS: .FORCE-GIT-CFLAG export NO_SVN_TESTS -test: all +test: all test-chmtime$X $(MAKE) -C t/ all test-date$X: test-date.c date.o ctype.o @@@ -845,9 -846,6 +851,9 @@@ test-dump-cache-tree$X: dump-cache-tree test-sha1$X: test-sha1.o $(GITLIBS) $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) +test-chmtime$X: test-chmtime.c + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $< + check-sha1:: test-sha1$X ./test-sha1.sh diff --combined builtin-archive.c index 8ea6cb1efc,5265764b6f..2fae885f5c --- a/builtin-archive.c +++ b/builtin-archive.c @@@ -35,7 -35,7 +35,7 @@@ static int run_remote_archiver(const ch for (i = 1; i < argc; i++) { const char *arg = argv[i]; - if (!strncmp("--exec=", arg, 7)) { + if (!prefixcmp(arg, "--exec=")) { if (exec_at) die("multiple --exec specified"); exec = arg + 7; @@@ -62,7 -62,7 +62,7 @@@ if (buf[len-1] == '\n') buf[--len] = 0; if (strcmp(buf, "ACK")) { - if (len > 5 && !strncmp(buf, "NACK ", 5)) + if (len > 5 && !prefixcmp(buf, "NACK ")) die("git-archive: NACK %s", buf + 5); die("git-archive: protocol error"); } @@@ -166,11 -166,11 +166,11 @@@ int parse_archive_args(int argc, const verbose = 1; continue; } - if (!strncmp(arg, "--format=", 9)) { + if (!prefixcmp(arg, "--format=")) { format = arg + 9; continue; } - if (!strncmp(arg, "--prefix=", 9)) { + if (!prefixcmp(arg, "--prefix=")) { base = arg + 9; continue; } @@@ -218,7 -218,7 +218,7 @@@ static const char *extract_remote_arg(i if (!strcmp(arg, "--")) no_more_options = 1; if (!no_more_options) { - if (!strncmp(arg, "--remote=", 9)) { + if (!prefixcmp(arg, "--remote=")) { if (remote) die("Multiple --remote specified"); remote = arg + 9; @@@ -252,8 -252,6 +252,6 @@@ int cmd_archive(int argc, const char ** memset(&ar, 0, sizeof(ar)); tree_idx = parse_archive_args(argc, argv, &ar); - if (prefix == NULL) - prefix = setup_git_directory(); argv += tree_idx; parse_treeish_arg(argv, &ar.args, prefix); diff --combined git-compat-util.h index 5d154faef6,309240bbce..56212b2f11 --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -1,8 -1,6 +1,8 @@@ #ifndef GIT_COMPAT_UTIL_H #define GIT_COMPAT_UTIL_H +#define _FILE_OFFSET_BITS 64 + #ifndef FLEX_ARRAY #if defined(__GNUC__) && (__GNUC__ < 3) #define FLEX_ARRAY 0 @@@ -49,9 -47,15 +49,15 @@@ #include #include #include + #if defined(__CYGWIN__) + #undef _XOPEN_SOURCE + #include + #define _XOPEN_SOURCE 600 + #else #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */ #include #define _ALL_SOURCE 1 + #endif #ifndef NO_ICONV #include @@@ -281,9 -285,4 +287,9 @@@ static inline int sane_case(int x, int return x; } +static inline int prefixcmp(const char *str, const char *prefix) +{ + return strncmp(str, prefix, strlen(prefix)); +} + #endif diff --combined git.c index 9b37f42321,660b0a6dc2..04fc99a3dd --- a/git.c +++ b/git.c @@@ -48,7 -48,7 +48,7 @@@ static int handle_options(const char** /* * Check remaining flags. */ - if (!strncmp(cmd, "--exec-path", 11)) { + if (!prefixcmp(cmd, "--exec-path")) { cmd += 11; if (*cmd == '=') git_set_exec_path(cmd + 1); @@@ -66,7 -66,7 +66,7 @@@ setenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1); (*argv)++; (*argc)--; - } else if (!strncmp(cmd, "--git-dir=", 10)) { + } else if (!prefixcmp(cmd, "--git-dir=")) { setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1); } else if (!strcmp(cmd, "--bare")) { static char git_dir[PATH_MAX+1]; @@@ -88,7 -88,7 +88,7 @@@ static char *alias_string static int git_alias_config(const char *var, const char *value) { - if (!strncmp(var, "alias.", 6) && !strcmp(var + 6, alias_command)) { + if (!prefixcmp(var, "alias.") && !strcmp(var + 6, alias_command)) { alias_string = xstrdup(value); } return 0; @@@ -226,10 -226,9 +226,10 @@@ static void handle_internal_command(in { "add", cmd_add, RUN_SETUP | NOT_BARE }, { "annotate", cmd_annotate, USE_PAGER }, { "apply", cmd_apply }, - { "archive", cmd_archive }, + { "archive", cmd_archive, RUN_SETUP }, { "blame", cmd_blame, RUN_SETUP }, { "branch", cmd_branch, RUN_SETUP }, + { "bundle", cmd_bundle }, { "cat-file", cmd_cat_file, RUN_SETUP }, { "checkout-index", cmd_checkout_index, RUN_SETUP }, { "check-ref-format", cmd_check_ref_format }, @@@ -238,9 -237,10 +238,9 @@@ { "config", cmd_config }, { "count-objects", cmd_count_objects, RUN_SETUP }, { "describe", cmd_describe, RUN_SETUP }, - { "diff", cmd_diff, RUN_SETUP | USE_PAGER }, - { "diff-files", cmd_diff_files, RUN_SETUP }, + { "diff", cmd_diff, USE_PAGER }, + { "diff-files", cmd_diff_files }, { "diff-index", cmd_diff_index, RUN_SETUP }, - { "diff-stages", cmd_diff_stages, RUN_SETUP }, { "diff-tree", cmd_diff_tree, RUN_SETUP }, { "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP }, { "for-each-ref", cmd_for_each_ref, RUN_SETUP }, @@@ -248,7 -248,7 +248,7 @@@ { "fsck", cmd_fsck, RUN_SETUP }, { "fsck-objects", cmd_fsck, RUN_SETUP }, { "get-tar-commit-id", cmd_get_tar_commit_id }, - { "grep", cmd_grep, RUN_SETUP }, + { "grep", cmd_grep, RUN_SETUP | USE_PAGER }, { "help", cmd_help }, { "init", cmd_init_db }, { "init-db", cmd_init_db }, @@@ -257,7 -257,6 +257,7 @@@ { "ls-tree", cmd_ls_tree, RUN_SETUP }, { "mailinfo", cmd_mailinfo }, { "mailsplit", cmd_mailsplit }, + { "merge-base", cmd_merge_base, RUN_SETUP }, { "merge-file", cmd_merge_file }, { "mv", cmd_mv, RUN_SETUP | NOT_BARE }, { "name-rev", cmd_name_rev, RUN_SETUP }, @@@ -349,7 -348,7 +349,7 @@@ int main(int argc, const char **argv, c * So we just directly call the internal command handler, and * die if that one cannot handle it. */ - if (!strncmp(cmd, "git-", 4)) { + if (!prefixcmp(cmd, "git-")) { cmd += 4; argv[0] = cmd; handle_internal_command(argc, argv, envp); @@@ -361,7 -360,7 +361,7 @@@ argc--; handle_options(&argv, &argc); if (argc > 0) { - if (!strncmp(argv[0], "--", 2)) + if (!prefixcmp(argv[0], "--")) argv[0] += 2; } else { /* Default command: "help" */ diff --combined refs.c index d347876c87,a9b8c72c6b..7a1f89caad --- a/refs.c +++ b/refs.c @@@ -828,8 -828,8 +828,8 @@@ int rename_ref(const char *oldref, cons goto rollback; } - if (!strncmp(oldref, "refs/heads/", 11) && - !strncmp(newref, "refs/heads/", 11)) { + if (!prefixcmp(oldref, "refs/heads/") && + !prefixcmp(newref, "refs/heads/")) { char oldsection[1024], newsection[1024]; snprintf(oldsection, 1024, "branch.%s", oldref + 11); @@@ -894,8 -894,8 +894,8 @@@ static int log_ref_write(const char *re log_file = git_path("logs/%s", ref_name); if (log_all_ref_updates && - (!strncmp(ref_name, "refs/heads/", 11) || - !strncmp(ref_name, "refs/remotes/", 13) || + (!prefixcmp(ref_name, "refs/heads/") || + !prefixcmp(ref_name, "refs/remotes/") || !strcmp(ref_name, "HEAD"))) { if (safe_create_leading_directories(log_file) < 0) return error("unable to create directory for %s", @@@ -1042,7 -1042,9 +1042,9 @@@ int create_symref(const char *ref_targe return -1; } + #ifndef NO_SYMLINK_HEAD done: + #endif if (logmsg && !read_ref(refs_heads_master, new_sha1)) log_ref_write(ref_target, old_sha1, new_sha1, logmsg); diff --combined utf8.c index 9e1a6d4964,f381a7f137..a2965c9c11 --- a/utf8.c +++ b/utf8.c @@@ -3,13 -3,15 +3,15 @@@ /* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */ + typedef unsigned int ucs_char_t; /* assuming 32bit int */ + struct interval { int first; int last; }; /* auxiliary function for binary search in interval table */ - static int bisearch(wchar_t ucs, const struct interval *table, int max) { + static int bisearch(ucs_char_t ucs, const struct interval *table, int max) { int min = 0; int mid; @@@ -56,11 -58,11 +58,11 @@@ * ISO 8859-1 and WGL4 characters, Unicode control characters, * etc.) have a column width of 1. * - * This implementation assumes that wchar_t characters are encoded + * This implementation assumes that ucs_char_t characters are encoded * in ISO 10646. */ - static int wcwidth(wchar_t ch) + static int wcwidth(ucs_char_t ch) { /* * Sorted list of non-overlapping intervals of non-spacing characters, @@@ -157,7 -159,7 +159,7 @@@ int utf8_width(const char **start) { unsigned char *s = (unsigned char *)*start; - wchar_t ch; + ucs_char_t ch; if (*s < 0x80) { /* 0xxxxxxx */ @@@ -235,19 -237,12 +237,19 @@@ static void print_spaces(int count /* * Wrap the text, if necessary. The variable indent is the indent for the * first line, indent2 is the indent for all other lines. + * If indent is negative, assume that already -indent columns have been + * consumed (and no extra indent is necessary for the first line). */ -void print_wrapped_text(const char *text, int indent, int indent2, int width) +int print_wrapped_text(const char *text, int indent, int indent2, int width) { int w = indent, assume_utf8 = is_utf8(text); const char *bol = text, *space = NULL; + if (indent < 0) { + w = -indent; + space = text; + } + for (;;) { char c = *text; if (!c || isspace(c)) { @@@ -258,9 -253,10 +260,9 @@@ else print_spaces(indent); fwrite(start, text - start, 1, stdout); - if (!c) { - putchar('\n'); - return; - } else if (c == '\t') + if (!c) + return w; + else if (c == '\t') w |= 0x07; space = text; w++; @@@ -268,7 -264,7 +270,7 @@@ } else { putchar('\n'); - text = bol = space + 1; + text = bol = space + isspace(*space); space = NULL; w = indent = indent2; } @@@ -281,7 -277,6 +283,7 @@@ text++; } } + return w; } int is_encoding_utf8(const char *name) @@@ -298,11 -293,17 +300,17 @@@ * with iconv. If the conversion fails, returns NULL. */ #ifndef NO_ICONV + #ifdef OLD_ICONV + typedef const char * iconv_ibp; + #else + typedef char * iconv_ibp; + #endif char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding) { iconv_t conv; size_t insz, outsz, outalloc; - char *out, *outpos, *cp; + char *out, *outpos; + iconv_ibp cp; if (!in_encoding) return NULL; @@@ -314,7 -315,7 +322,7 @@@ outalloc = outsz + 1; /* for terminating NUL */ out = xmalloc(outalloc); outpos = out; - cp = (char *)in; + cp = (iconv_ibp)in; while (1) { size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);