Merge branch 'rs/object-id'
authorJunio C Hamano <gitster@pobox.com>
Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)
"uchar [40]" to "struct object_id" conversion continues.

* rs/object-id:
checkout: convert post_checkout_hook() to struct object_id
use oidcpy() for copying hashes between instances of struct object_id
use oid_to_hex_r() for converting struct object_id hashes to hex strings

1  2 
wt-status.c
diff --combined wt-status.c
index 4dff0b3e2108bbd41e638c7beb69e62b20fa8740,a05328dc4885773c0c7b4693b224fb30016bb7ad..d47012048f81c92a82758d87f8726cb919501104
@@@ -628,7 -628,7 +628,7 @@@ static void wt_status_collect_changes_i
                        d->index_status = DIFF_STATUS_ADDED;
                        /* Leave {mode,oid}_head zero for adds. */
                        d->mode_index = ce->ce_mode;
-                       hashcpy(d->oid_index.hash, ce->oid.hash);
+                       oidcpy(&d->oid_index, &ce->oid);
                }
        }
  }
@@@ -1135,17 -1135,14 +1135,17 @@@ static void abbrev_sha1_in_line(struct 
        strbuf_list_free(split);
  }
  
 -static void read_rebase_todolist(const char *fname, struct string_list *lines)
 +static int read_rebase_todolist(const char *fname, struct string_list *lines)
  {
        struct strbuf line = STRBUF_INIT;
        FILE *f = fopen(git_path("%s", fname), "r");
  
 -      if (!f)
 +      if (!f) {
 +              if (errno == ENOENT)
 +                      return -1;
                die_errno("Could not open file %s for reading",
                          git_path("%s", fname));
 +      }
        while (!strbuf_getline_lf(&line, f)) {
                if (line.len && line.buf[0] == comment_line_char)
                        continue;
                abbrev_sha1_in_line(&line);
                string_list_append(lines, line.buf);
        }
 +      return 0;
  }
  
  static void show_rebase_information(struct wt_status *s,
                struct string_list yet_to_do = STRING_LIST_INIT_DUP;
  
                read_rebase_todolist("rebase-merge/done", &have_done);
 -              read_rebase_todolist("rebase-merge/git-rebase-todo", &yet_to_do);
 -
 +              if (read_rebase_todolist("rebase-merge/git-rebase-todo",
 +                                       &yet_to_do))
 +                      status_printf_ln(s, color,
 +                              _("git-rebase-todo is missing."));
                if (have_done.nr == 0)
                        status_printf_ln(s, color, _("No commands done."));
                else {
@@@ -2102,7 -2096,7 +2102,7 @@@ static void wt_porcelain_v2_print_unmer
                if (strcmp(ce->name, it->string) || !stage)
                        break;
                stages[stage - 1].mode = ce->ce_mode;
-               hashcpy(stages[stage - 1].oid.hash, ce->oid.hash);
+               oidcpy(&stages[stage - 1].oid, &ce->oid);
                sum |= (1 << (stage - 1));
        }
        if (sum != d->stagemask)