From: Junio C Hamano Date: Wed, 9 Apr 2014 19:03:26 +0000 (-0700) Subject: Merge branch 'jl/nor-or-nand-and' into maint X-Git-Tag: v1.9.2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3c9e56b75c4a9a6832d94a00f079ea68e8a281ca?hp=-c Merge branch 'jl/nor-or-nand-and' into maint * jl/nor-or-nand-and: code and test: fix misuses of "nor" comments: fix misuses of "nor" contrib: fix misuses of "nor" Documentation: fix misuses of "nor" --- 3c9e56b75c4a9a6832d94a00f079ea68e8a281ca diff --combined Makefile index 132bfb3351,fc02788184..33aa15b0e3 --- a/Makefile +++ b/Makefile @@@ -159,7 -159,7 +159,7 @@@ all: # # Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv. # - # Define NO_INTPTR_T if you don't have intptr_t nor uintptr_t. + # Define NO_INTPTR_T if you don't have intptr_t or uintptr_t. # # Define NO_UINTMAX_T if you don't have uintmax_t. # @@@ -342,9 -342,6 +342,9 @@@ # Define DEFAULT_HELP_FORMAT to "man", "info" or "html" # (defaults to "man") if you want to have a different default when # "git help" is called without a parameter specifying the format. +# +# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not +# return NULL when it receives a bogus time_t. GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@@ -1497,11 -1494,6 +1497,11 @@@ ifneq (,$(XDL_FAST_HASH) BASIC_CFLAGS += -DXDL_FAST_HASH endif +ifdef GMTIME_UNRELIABLE_ERRORS + COMPAT_OBJS += compat/gmtime.o + BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS +endif + ifeq ($(TCLTK_PATH),) NO_TCLTK = NoThanks endif diff --combined builtin/checkout.c index 1b86d9c868,7f37d1a245..63151e08a4 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@@ -53,10 -53,10 +53,10 @@@ struct checkout_opts static int post_checkout_hook(struct commit *old, struct commit *new, int changed) { - return run_hook(NULL, "post-checkout", - sha1_to_hex(old ? old->object.sha1 : null_sha1), - sha1_to_hex(new ? new->object.sha1 : null_sha1), - changed ? "1" : "0", NULL); + return run_hook_le(NULL, "post-checkout", + sha1_to_hex(old ? old->object.sha1 : null_sha1), + sha1_to_hex(new ? new->object.sha1 : null_sha1), + changed ? "1" : "0", NULL); /* "new" can be NULL when checking out from the index before a commit exists. */ @@@ -895,7 -895,7 +895,7 @@@ static int parse_branchname_arg(int arg * between A and B, A...B names that merge base. * * (b) If is _not_ a commit, either "--" is present - * or is not a path, no -t nor -b was given, and + * or is not a path, no -t or -b was given, and * and there is a tracking branch whose name is * in one and only one remote, then this is a short-hand to * fork local from that remote-tracking branch. diff --combined builtin/commit.c index 6a60f668b2,5d594a4743..7d711eafa6 --- a/builtin/commit.c +++ b/builtin/commit.c @@@ -612,7 -612,7 +612,7 @@@ static int prepare_to_commit(const cha /* This checks and barfs if author is badly specified */ determine_author_info(author_ident); - if (!no_verify && run_hook(index_file, "pre-commit", NULL)) + if (!no_verify && run_commit_hook(use_editor, index_file, "pre-commit", NULL)) return 0; if (squash_message) { @@@ -866,8 -866,8 +866,8 @@@ return 0; } - if (run_hook(index_file, "prepare-commit-msg", - git_path(commit_editmsg), hook_arg1, hook_arg2, NULL)) + if (run_commit_hook(use_editor, index_file, "prepare-commit-msg", + git_path(commit_editmsg), hook_arg1, hook_arg2, NULL)) return 0; if (use_editor) { @@@ -883,7 -883,7 +883,7 @@@ } if (!no_verify && - run_hook(index_file, "commit-msg", git_path(commit_editmsg), NULL)) { + run_commit_hook(use_editor, index_file, "commit-msg", git_path(commit_editmsg), NULL)) { return 0; } @@@ -1067,6 -1067,8 +1067,6 @@@ static int parse_and_validate_options(i use_editor = 0; if (0 <= edit_flag) use_editor = edit_flag; - if (!use_editor) - setenv("GIT_EDITOR", ":", 1); /* Sanity check options */ if (amend && !current_head) @@@ -1121,7 -1123,7 +1121,7 @@@ if (argc == 0 && only && amend) only_include_assumed = _("Clever... amending the last one with dirty index."); if (argc > 0 && !also && !only) - only_include_assumed = _("Explicit paths specified without -i nor -o; assuming --only paths..."); + only_include_assumed = _("Explicit paths specified without -i or -o; assuming --only paths..."); if (!cleanup_arg || !strcmp(cleanup_arg, "default")) cleanup_mode = use_editor ? CLEANUP_ALL : CLEANUP_SPACE; else if (!strcmp(cleanup_arg, "verbatim")) @@@ -1443,29 -1445,6 +1443,29 @@@ static int run_rewrite_hook(const unsig return finish_command(&proc); } +int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...) +{ + const char *hook_env[3] = { NULL }; + char index[PATH_MAX]; + va_list args; + int ret; + + snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file); + hook_env[0] = index; + + /* + * Let the hook know that no editor will be launched. + */ + if (!editor_is_used) + hook_env[1] = "GIT_EDITOR=:"; + + va_start(args, name); + ret = run_hook_ve(hook_env, name, args); + va_end(args); + + return ret; +} + int cmd_commit(int argc, const char **argv, const char *prefix) { static struct wt_status s; @@@ -1690,7 -1669,7 +1690,7 @@@ "not exceeded, and then \"git reset HEAD\" to recover.")); rerere(0); - run_hook(get_index_file(), "post-commit", NULL); + run_commit_hook(use_editor, get_index_file(), "post-commit", NULL); if (amend && !no_post_rewrite) { struct notes_rewrite_cfg *cfg; cfg = init_copy_notes_for_rewrite("amend"); diff --combined remote.c index 8c15e9d913,f43c7a9d53..ebed40dcb6 --- a/remote.c +++ b/remote.c @@@ -857,32 -857,6 +857,32 @@@ static int match_name_with_pattern(cons return ret; } +static void query_refspecs_multiple(struct refspec *refs, int ref_count, struct refspec *query, struct string_list *results) +{ + int i; + int find_src = !query->src; + + if (find_src && !query->dst) + error("query_refspecs_multiple: need either src or dst"); + + for (i = 0; i < ref_count; i++) { + struct refspec *refspec = &refs[i]; + const char *key = find_src ? refspec->dst : refspec->src; + const char *value = find_src ? refspec->src : refspec->dst; + const char *needle = find_src ? query->dst : query->src; + char **result = find_src ? &query->src : &query->dst; + + if (!refspec->dst) + continue; + if (refspec->pattern) { + if (match_name_with_pattern(key, needle, value, result)) + string_list_append_nodup(results, *result); + } else if (!strcmp(needle, key)) { + string_list_append(results, value); + } + } +} + int query_refspecs(struct refspec *refs, int ref_count, struct refspec *query) { int i; @@@ -1435,7 -1409,7 +1435,7 @@@ int match_push_refs(struct ref *src, st /* * Remote doesn't have it, and we have no * explicit pattern, and we don't have - * --all nor --mirror. + * --all or --mirror. */ goto free_name; @@@ -2023,37 -1997,25 +2023,37 @@@ static int get_stale_heads_cb(const cha const unsigned char *sha1, int flags, void *cb_data) { struct stale_heads_info *info = cb_data; + struct string_list matches = STRING_LIST_INIT_DUP; struct refspec query; + int i, stale = 1; memset(&query, 0, sizeof(struct refspec)); query.dst = (char *)refname; - if (query_refspecs(info->refs, info->ref_count, &query)) - return 0; /* No matches */ + query_refspecs_multiple(info->refs, info->ref_count, &query, &matches); + if (matches.nr == 0) + goto clean_exit; /* No matches */ /* * If we did find a suitable refspec and it's not a symref and * it's not in the list of refs that currently exist in that - * remote we consider it to be stale. + * remote, we consider it to be stale. In order to deal with + * overlapping refspecs, we need to go over all of the + * matching refs. */ - if (!((flags & REF_ISSYMREF) || - string_list_has_string(info->ref_names, query.src))) { + if (flags & REF_ISSYMREF) + goto clean_exit; + + for (i = 0; stale && i < matches.nr; i++) + if (string_list_has_string(info->ref_names, matches.items[i].string)) + stale = 0; + + if (stale) { struct ref *ref = make_linked_ref(refname, &info->stale_refs_tail); hashcpy(ref->new_sha1, sha1); } - free(query.src); +clean_exit: + string_list_clear(&matches, 0); return 0; }