Merge branch 'jl/nor-or-nand-and' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 9 Apr 2014 19:03:26 +0000 (12:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Apr 2014 19:03:26 +0000 (12:03 -0700)
* 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"

1  2 
Makefile
builtin/checkout.c
builtin/commit.c
remote.c
diff --combined Makefile
index 132bfb3351890b57b0b808773f39aec32588e0ed,fc02788184a690ecc1862109eeec2c02c0062b2f..33aa15b0e34622a4af09c089f37d47223627f507
+++ 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.
  #
  # 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 1b86d9c868c35c7f0ad3f4b39f9d225c8365c77c,7f37d1a2453be5b318c9e9a746cddec78bc28fa7..63151e08a4d1b4180e797fd33e23a9bf75c2f79e
@@@ -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 <something> is _not_ a commit, either "--" is present
-        *       or <something> is not a path, no -t nor -b was given, and
+        *       or <something> is not a path, no -t or -b was given, and
         *       and there is a tracking branch whose name is <something>
         *       in one and only one remote, then this is a short-hand to
         *       fork local <something> from that remote-tracking branch.
diff --combined builtin/commit.c
index 6a60f668b28d1d27b4cb184a24f5b7e63af88f0b,5d594a4743b9b6a7ac6bfac0fb41f4ae6025cf13..7d711eafa698d933291beaa00b485397c7efb256
@@@ -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) {
                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) {
        }
  
        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)
        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;
                     "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 8c15e9d913b520ee539695c556bb835b9c7c90a7,f43c7a9d531db7a36634e6103bfdf60ee3ca22e1..ebed40dcb65df55ac81facbf5df59ddc28451872
+++ 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;
  }