cache: convert struct cache_entry to use struct object_id
[gitweb.git] / unpack-trees.c
index 6bc9512a4516396c7ac0cc0fd5b5cebb01c60cbd..9238308f1bfd925ba93fa6a5d30cee17408d10cf 100644 (file)
@@ -62,17 +62,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
        if (!strcmp(cmd, "checkout"))
                msg = advice_commit_before_merge
                      ? _("Your local changes to the following files would be overwritten by checkout:\n%%s"
-                         "Please commit your changes or stash them before you can switch branches.")
+                         "Please commit your changes or stash them before you switch branches.")
                      : _("Your local changes to the following files would be overwritten by checkout:\n%%s");
        else if (!strcmp(cmd, "merge"))
                msg = advice_commit_before_merge
                      ? _("Your local changes to the following files would be overwritten by merge:\n%%s"
-                         "Please commit your changes or stash them before you can merge.")
+                         "Please commit your changes or stash them before you merge.")
                      : _("Your local changes to the following files would be overwritten by merge:\n%%s");
        else
                msg = advice_commit_before_merge
                      ? _("Your local changes to the following files would be overwritten by %s:\n%%s"
-                         "Please commit your changes or stash them before you can %s.")
+                         "Please commit your changes or stash them before you %s.")
                      : _("Your local changes to the following files would be overwritten by %s:\n%%s");
        msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOT_UPTODATE_FILE] =
                xstrfmt(msg, cmd, cmd);
@@ -83,34 +83,34 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
        if (!strcmp(cmd, "checkout"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be removed by checkout:\n%%s"
-                         "Please move or remove them before you can switch branches.")
+                         "Please move or remove them before you switch branches.")
                      : _("The following untracked working tree files would be removed by checkout:\n%%s");
        else if (!strcmp(cmd, "merge"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be removed by merge:\n%%s"
-                         "Please move or remove them before you can merge.")
+                         "Please move or remove them before you merge.")
                      : _("The following untracked working tree files would be removed by merge:\n%%s");
        else
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be removed by %s:\n%%s"
-                         "Please move or remove them before you can %s.")
+                         "Please move or remove them before you %s.")
                      : _("The following untracked working tree files would be removed by %s:\n%%s");
        msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = xstrfmt(msg, cmd, cmd);
 
        if (!strcmp(cmd, "checkout"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be overwritten by checkout:\n%%s"
-                         "Please move or remove them before you can switch branches.")
+                         "Please move or remove them before you switch branches.")
                      : _("The following untracked working tree files would be overwritten by checkout:\n%%s");
        else if (!strcmp(cmd, "merge"))
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be overwritten by merge:\n%%s"
-                         "Please move or remove them before you can merge.")
+                         "Please move or remove them before you merge.")
                      : _("The following untracked working tree files would be overwritten by merge:\n%%s");
        else
                msg = advice_commit_before_merge
                      ? _("The following untracked working tree files would be overwritten by %s:\n%%s"
-                         "Please move or remove them before you can %s.")
+                         "Please move or remove them before you %s.")
                      : _("The following untracked working tree files would be overwritten by %s:\n%%s");
        msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = xstrfmt(msg, cmd, cmd);
 
@@ -625,7 +625,7 @@ static struct cache_entry *create_ce_entry(const struct traverse_info *info, con
        ce->ce_mode = create_ce_mode(n->mode);
        ce->ce_flags = create_ce_flags(stage);
        ce->ce_namelen = len;
-       hashcpy(ce->sha1, n->oid->hash);
+       oidcpy(&ce->oid, n->oid);
        make_traverse_path(ce->name, info, n);
 
        return ce;
@@ -1287,7 +1287,7 @@ static int same(const struct cache_entry *a, const struct cache_entry *b)
        if ((a->ce_flags | b->ce_flags) & CE_CONFLICTED)
                return 0;
        return a->ce_mode == b->ce_mode &&
-              !hashcmp(a->sha1, b->sha1);
+              !oidcmp(&a->oid, &b->oid);
 }
 
 
@@ -1393,7 +1393,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
                /* If we are not going to update the submodule, then
                 * we don't care.
                 */
-               if (!hashcmp(sha1, ce->sha1))
+               if (!hashcmp(sha1, ce->oid.hash))
                        return 0;
                return verify_clean_submodule(ce, error_type, o);
        }
@@ -1665,7 +1665,7 @@ static void show_stage_entry(FILE *o,
                fprintf(o, "%s%06o %s %d\t%s\n",
                        label,
                        ce->ce_mode,
-                       sha1_to_hex(ce->sha1),
+                       oid_to_hex(&ce->oid),
                        ce_stage(ce),
                        ce->name);
 }