Merge branch 'bw/dir-c-stops-relying-on-the-index'
authorJunio C Hamano <gitster@pobox.com>
Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)
API update.

* bw/dir-c-stops-relying-on-the-index:
dir: convert fill_directory to take an index
dir: convert read_directory to take an index
dir: convert read_directory_recursive to take an index
dir: convert open_cached_dir to take an index
dir: convert is_excluded to take an index
dir: convert prep_exclude to take an index
dir: convert add_excludes to take an index
dir: convert is_excluded_from_list to take an index
dir: convert last_exclude_matching_from_list to take an index
dir: convert dir_add* to take an index
dir: convert get_dtype to take index
dir: convert directory_exists_in_index to take index
dir: convert read_skip_worktree_file_from_index to take an index
dir: stop using the index compatibility macros

1  2 
unpack-trees.c
wt-status.c
diff --combined unpack-trees.c
index d98a4f4d8668d989d34e5b938947704836ae8c84,cff6b3f8c4ec9ee58eb63836bb38ec867ddd1c18..c312c2cd3affa49b17fad336dce6be89fcc954ba
@@@ -252,18 -252,14 +252,18 @@@ static int check_submodule_move_head(co
                                     const char *new_id,
                                     struct unpack_trees_options *o)
  {
 +      unsigned flags = SUBMODULE_MOVE_HEAD_DRY_RUN;
        const struct submodule *sub = submodule_from_ce(ce);
        if (!sub)
                return 0;
  
 +      if (o->reset)
 +              flags |= SUBMODULE_MOVE_HEAD_FORCE;
 +
        switch (sub->update_strategy.type) {
        case SM_UPDATE_UNSPECIFIED:
        case SM_UPDATE_CHECKOUT:
 -              if (submodule_move_head(ce->name, old_id, new_id, SUBMODULE_MOVE_HEAD_DRY_RUN))
 +              if (submodule_move_head(ce->name, old_id, new_id, flags))
                        return o->gently ? -1 :
                                add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
                return 0;
@@@ -312,7 -308,6 +312,7 @@@ static void unlink_entry(const struct c
                case SM_UPDATE_CHECKOUT:
                case SM_UPDATE_REBASE:
                case SM_UPDATE_MERGE:
 +                      /* state.force is set at the caller. */
                        submodule_move_head(ce->name, "HEAD", NULL,
                                            SUBMODULE_MOVE_HEAD_FORCE);
                        break;
@@@ -1073,7 -1068,7 +1073,7 @@@ static int clear_ce_flags_dir(struct ca
        struct cache_entry **cache_end;
        int dtype = DT_DIR;
        int ret = is_excluded_from_list(prefix->buf, prefix->len,
-                                       basename, &dtype, el);
+                                       basename, &dtype, el, &the_index);
        int rc;
  
        strbuf_addch(prefix, '/');
@@@ -1176,7 -1171,7 +1176,7 @@@ static int clear_ce_flags_1(struct cach
                /* Non-directory */
                dtype = ce_to_dtype(ce);
                ret = is_excluded_from_list(ce->name, ce_namelen(ce),
-                                           name, &dtype, el);
+                                           name, &dtype, el, &the_index);
                if (ret < 0)
                        ret = defval;
                if (ret > 0)
@@@ -1256,7 -1251,7 +1256,7 @@@ int unpack_trees(unsigned len, struct t
                o->skip_sparse_checkout = 1;
        if (!o->skip_sparse_checkout) {
                char *sparse = git_pathdup("info/sparse-checkout");
-               if (add_excludes_from_file_to_list(sparse, "", 0, &el, 0) < 0)
+               if (add_excludes_from_file_to_list(sparse, "", 0, &el, NULL) < 0)
                        o->skip_sparse_checkout = 1;
                else
                        o->el = &el;
@@@ -1597,7 -1592,7 +1597,7 @@@ static int verify_clean_subdirectory(co
        memset(&d, 0, sizeof(d));
        if (o->dir)
                d.exclude_per_dir = o->dir->exclude_per_dir;
-       i = read_directory(&d, pathbuf, namelen+1, NULL);
+       i = read_directory(&d, &the_index, pathbuf, namelen+1, NULL);
        if (i)
                return o->gently ? -1 :
                        add_rejected_path(o, ERROR_NOT_UPTODATE_DIR, ce->name);
@@@ -1639,7 -1634,7 +1639,7 @@@ static int check_ok_to_remove(const cha
                return 0;
  
        if (o->dir &&
-           is_excluded(o->dir, name, &dtype))
+           is_excluded(o->dir, &the_index, name, &dtype))
                /*
                 * ce->name is explicitly excluded, so it is Ok to
                 * overwrite it.
diff --combined wt-status.c
index 7daa5320ac7538835285495782e74be5423ed76b,3b40f740558d8286b609ce785c1fc0b15fd5e9ae..f55f587111a79f679ee5b6e940d955fcc1868d3c
@@@ -665,7 -665,7 +665,7 @@@ static void wt_status_collect_untracked
                dir.untracked = the_index.untracked;
        setup_standard_excludes(&dir);
  
-       fill_directory(&dir, &s->pathspec);
+       fill_directory(&dir, &the_index, &s->pathspec);
  
        for (i = 0; i < dir.nr; i++) {
                struct dir_entry *ent = dir.entries[i];
@@@ -1002,7 -1002,7 +1002,7 @@@ static void wt_longstatus_print_trackin
                color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
                                 comment_line_char);
        else
 -              fputs("", s->fp);
 +              fputs("\n", s->fp);
  }
  
  static int has_unmerged(struct wt_status *s)
@@@ -1387,7 -1387,7 +1387,7 @@@ struct grab_1st_switch_cbdata 
  };
  
  static int grab_1st_switch(struct object_id *ooid, struct object_id *noid,
 -                         const char *email, unsigned long timestamp, int tz,
 +                         const char *email, timestamp_t timestamp, int tz,
                           const char *message, void *cb_data)
  {
        struct grab_1st_switch_cbdata *cb = cb_data;