{"thread":{"id":"11746","subject":"[PATCH 9/9] Build in checkout","startedAt":"2008-01-25T23:25:11Z","lastAt":"2008-01-25T23:25:11Z","messageCount":1,"participants":["Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":9},"messages":[{"id":"66613","messageId":"alpine.LNX.1.00.0801251824120.13593@iabervon.org","threadId":"11746","inReplyTo":null,"subject":"[PATCH 9/9] Build in checkout","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-01-25T23:25:11Z","receivedAt":"2008-01-25T23:25:11Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"The only differences in behavior should be:\n\n - git checkout -m with non-trivial merging won't print out\n   merge-recursive messages (see the change in t7201-co.sh)\n\n - git checkout -- paths... will give a sensible error message if\n   HEAD is invalid as a commit.\n\n - some intermediate states which were written to disk in the shell\n   version (in particular, index states) are only kept in memory in\n   this version, and therefore these can no longer be revealed by\n   later write operations becoming impossible.\n\nI'm not 100% sure I got the merge recursive setup exactly right; the\nbase for a non-trivial merge in the shell code doesn't seem\ntheoretically justified to me, but I tried to match it anyway, and the\ntests all pass this way.\n\nOther than these items, the results should be identical to the shell\nversion, so far as I can tell.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\n Makefile                                           |    3 +-\n builtin-checkout.c                                 |  478 ++++++++++++++++++++\n builtin.h                                          |    1 +\n .../examples/git-checkout.sh                       |    0 \n git.c                                              |    1 +\n t/t7201-co.sh                                      |    7 -\n 6 files changed, 482 insertions(+), 8 deletions(-)\n create mode 100644 builtin-checkout.c\n rename git-checkout.sh => contrib/examples/git-checkout.sh (100%)\n\ndiff --git a/Makefile b/Makefile\nindex 47f91f9..303e9f6 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -219,7 +219,7 @@ BASIC_CFLAGS =\n BASIC_LDFLAGS =\n \n SCRIPT_SH = \\\n-\tgit-bisect.sh git-checkout.sh \\\n+\tgit-bisect.sh \\\n \tgit-clone.sh \\\n \tgit-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \\\n \tgit-pull.sh git-rebase.sh git-rebase--interactive.sh \\\n@@ -331,6 +331,7 @@ BUILTIN_OBJS = \\\n \tbuiltin-bundle.o \\\n \tbuiltin-cat-file.o \\\n \tbuiltin-check-attr.o \\\n+\tbuiltin-checkout.o \\\n \tbuiltin-checkout-index.o \\\n \tbuiltin-check-ref-format.o \\\n \tbuiltin-clean.o \\\ndiff --git a/builtin-checkout.c b/builtin-checkout.c\nnew file mode 100644\nindex 0000000..1fac55a\n--- /dev/null\n+++ b/builtin-checkout.c\n@@ -0,0 +1,478 @@\n+#include \"cache.h\"\n+#include \"builtin.h\"\n+#include \"parse-options.h\"\n+#include \"refs.h\"\n+#include \"commit.h\"\n+#include \"tree.h\"\n+#include \"tree-walk.h\"\n+#include \"unpack-trees.h\"\n+#include \"dir.h\"\n+#include \"run-command.h\"\n+#include \"merge-recursive.h\"\n+#include \"diff.h\"\n+#include \"revision.h\"\n+\n+static const char * const checkout_usage[] = {\n+\t\"git checkout [options] <branch>\",\n+\t\"git checkout [options] [<branch>] -- <file>...\",\n+\tNULL,\n+};\n+\n+static int post_checkout_hook(struct commit *old, struct commit *new,\n+\t\t\t      int changed)\n+{\n+\tstruct child_process proc;\n+\tconst char *name = git_path(\"hooks/post-checkout\");\n+\tconst char *argv[5];\n+\n+\tif (access(name, X_OK) < 0)\n+\t\treturn 0;\n+\n+\tmemset(&proc, 0, sizeof(proc));\n+\targv[0] = name;\n+\targv[1] = xstrdup(sha1_to_hex(old->object.sha1));\n+\targv[2] = xstrdup(sha1_to_hex(new->object.sha1));\n+\targv[3] = changed ? \"1\" : \"0\";\n+\targv[4] = NULL;\n+\tproc.argv = argv;\n+\tproc.no_stdin = 1;\n+\tproc.stdout_to_stderr = 1;\n+\treturn run_command(&proc);\n+}\n+\n+static int cache_unmerged(void)\n+{\n+\tint i;\n+\tfor (i = 0; i < active_nr; i++) {\n+\t\tif (ce_stage(active_cache[i]))\n+\t\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n+static int update_some(const unsigned char *sha1, const char *base, int baselen,\n+\t\t       const char *pathname, unsigned mode, int stage)\n+{\n+\tif (S_ISGITLINK(mode)) {\n+\t\treturn 0;\n+\t} else if (S_ISDIR(mode)) {\n+\t\treturn READ_TREE_RECURSIVE;\n+\t}\n+\tint len = baselen + strlen(pathname);\n+\tstruct cache_entry *ce = xcalloc(1, cache_entry_size(len));\n+\thashcpy(ce->sha1, sha1);\n+\tmemcpy(ce->name, base, baselen);\n+\tmemcpy(ce->name + baselen, pathname, len - baselen);\n+\tce->ce_flags = create_ce_flags(len, 0);\n+\tce->ce_mode = create_ce_mode(mode);\n+\tadd_cache_entry(ce, ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);\n+\treturn 0;\n+}\n+\n+static int read_tree_some(struct tree *tree, const char **pathspec)\n+{\n+\tint newfd;\n+\tstruct lock_file lock_file;\n+\tnewfd = hold_locked_index(&lock_file, 1);\n+\tread_cache();\n+\n+\tread_tree_recursive(tree, \"\", 0, 0, pathspec, update_some);\n+\n+\tif (write_cache(newfd, active_cache, active_nr) ||\n+\t    close(newfd) || commit_locked_index(&lock_file))\n+\t\tdie(\"unable to write new index file\");\n+\n+\t/* update the index with the given tree's info\n+\t * for all args, expanding wildcards, and exit\n+\t * with any non-zero return code.\n+\t */\n+\treturn 0;\n+}\n+\n+static int checkout_paths(const char **pathspec)\n+{\n+\tint pos;\n+\tstruct checkout state;\n+\tstatic char *ps_matched;\n+\tunsigned char rev[20];\n+\tint flag;\n+\tstruct commit *head;\n+\n+\tfor (pos = 0; pathspec[pos]; pos++)\n+\t\t;\n+\tps_matched = xcalloc(1, pos);\n+\n+\tfor (pos = 0; pos < active_nr; pos++) {\n+\t\tstruct cache_entry *ce = active_cache[pos];\n+\t\tpathspec_match(pathspec, ps_matched, ce->name, 0);\n+\t}\n+\n+\tif (report_path_error(ps_matched, pathspec, 0))\n+\t\treturn 1;\n+\n+\tmemset(&state, 0, sizeof(state));\n+\tstate.force = 1;\n+\tstate.refresh_cache = 1;\n+\tfor (pos = 0; pos < active_nr; pos++) {\n+\t\tstruct cache_entry *ce = active_cache[pos];\n+\t\tif (pathspec_match(pathspec, NULL, ce->name, 0)) {\n+\t\t\tcheckout_entry(ce, &state, NULL);\n+\t\t}\n+\t}\n+\n+\tresolve_ref(\"HEAD\", rev, 0, &flag);\n+\thead = lookup_commit_reference_gently(rev, 1);\n+\n+\treturn post_checkout_hook(head, head, 0);\n+}\n+\n+static int remove_merge_head(void)\n+{\n+\tunlink(git_path(\"MERGE_HEAD\"));\n+\treturn 0;\n+}\n+\n+static void show_local_changes(struct object *head)\n+{\n+\tstruct rev_info rev;\n+\t// I think we want full paths, even if we're in a subdirectory.\n+\tinit_revisions(&rev, NULL);\n+\trev.abbrev = 0;\n+\trev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;\n+\tadd_pending_object(&rev, head, NULL);\n+\trun_diff_index(&rev, 0);\n+}\n+\n+static void describe_detached_head(char *msg, struct commit *commit)\n+{\n+\tstruct strbuf sb;\n+\tstrbuf_init(&sb, 0);\n+\tparse_commit(commit);\n+\tpretty_print_commit(CMIT_FMT_ONELINE, commit, &sb, 0, \"\", \"\", 0, 0);\n+\tfprintf(stderr, \"%s %s... %s\\n\", msg,\n+\t\tfind_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV), sb.buf);\n+\tstrbuf_release(&sb);\n+}\n+\n+static int reset_to_new(struct tree *tree, int quiet)\n+{\n+\tstruct unpack_trees_options opts;\n+\tstruct tree_desc tree_desc;\n+\tmemset(&opts, 0, sizeof(opts));\n+\topts.head_idx = -1;\n+\topts.update = 1;\n+\topts.reset = 1;\n+\topts.merge = 1;\n+\topts.fn = oneway_merge;\n+\topts.verbose_update = !quiet;\n+\tparse_tree(tree);\n+\tinit_tree_desc(&tree_desc, tree->buffer, tree->size);\n+\tif (unpack_trees(1, &tree_desc, &opts))\n+\t\treturn 128;\n+\treturn 0;\n+}\n+\n+static void reset_clean_to_new(struct tree *tree, int quiet)\n+{\n+\tstruct unpack_trees_options opts;\n+\tstruct tree_desc tree_desc;\n+\tmemset(&opts, 0, sizeof(opts));\n+\topts.head_idx = -1;\n+\topts.skip_unmerged = 1;\n+\topts.reset = 1;\n+\topts.merge = 1;\n+\topts.fn = oneway_merge;\n+\topts.verbose_update = !quiet;\n+\tparse_tree(tree);\n+\tinit_tree_desc(&tree_desc, tree->buffer, tree->size);\n+\tunpack_trees(1, &tree_desc, &opts);\n+}\n+\n+struct checkout_opts {\n+\tint quiet;\n+\tint merge;\n+\tint force;\n+\n+\tchar *new_branch;\n+\tint new_branch_log;\n+\tint track;\n+\tint no_track;\n+};\n+\n+struct branch_info {\n+\tconst char *name; /* The short name used */\n+\tconst char *path; /* The full name of a real branch */\n+\tstruct commit *commit; /* The named commit */\n+};\n+\n+static void setup_branch_path(struct branch_info *branch)\n+{\n+\tchar *path = xmalloc(strlen(branch->name) +\n+\t\t\t     strlen(\"refs/heads/\") + 1);\n+\tsprintf(path, \"refs/heads/%s\", branch->name);\n+\tbranch->path = path;\n+}\n+\n+static int merge_working_tree(struct checkout_opts *opts,\n+\t\t\t      struct branch_info *old, struct branch_info *new,\n+\t\t\t      const char *prefix)\n+{\n+\tint ret;\n+\tstruct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));\n+\tint newfd = hold_locked_index(lock_file, 1);\n+\tread_cache();\n+\n+\tif (opts->force) {\n+\t\tret = reset_to_new(new->commit->tree, opts->quiet);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t} else {\n+\t\tstruct tree_desc trees[2];\n+\t\tstruct tree *tree;\n+\t\tstruct unpack_trees_options topts;\n+\t\tmemset(&topts, 0, sizeof(topts));\n+\t\ttopts.head_idx = -1;\n+\n+\t\trefresh_cache(REFRESH_QUIET);\n+\n+\t\tif (cache_unmerged()) {\n+\t\t\tret = opts->merge ? -1 :\n+\t\t\t\terror(\"you need to resolve your current index first\");\n+\t\t} else {\n+\t\t\ttopts.update = 1;\n+\t\t\ttopts.merge = 1;\n+\t\t\ttopts.gently = opts->merge;\n+\t\t\ttopts.fn = twoway_merge;\n+\t\t\ttopts.dir = xcalloc(1, sizeof(*topts.dir));\n+\t\t\ttopts.dir->show_ignored = 1;\n+\t\t\ttopts.dir->exclude_per_dir = \".gitignore\";\n+\t\t\ttopts.prefix = prefix;\n+\t\t\ttree = parse_tree_indirect(old->commit->object.sha1);\n+\t\t\tinit_tree_desc(&trees[0], tree->buffer, tree->size);\n+\t\t\ttree = parse_tree_indirect(new->commit->object.sha1);\n+\t\t\tinit_tree_desc(&trees[1], tree->buffer, tree->size);\n+\t\t\tret = unpack_trees(2, trees, &topts);\n+\t\t}\n+\t\tif (ret) {\n+\t\t\t/*\n+\t\t\t * Unpack couldn't do a trivial merge; either\n+\t\t\t * give up or do a real merge, depending on\n+\t\t\t * whether the merge flag was used.\n+\t\t\t */\n+\t\t\tstruct tree *result;\n+\t\t\tstruct tree *work;\n+\t\t\tif (!opts->merge)\n+\t\t\t\treturn 1;\n+\t\t\tparse_commit(old->commit);\n+\n+\t\t\t/* Do more real merge */\n+\n+\t\t\t/*\n+\t\t\t * We update the index fully, then write the\n+\t\t\t * tree from the index, then merge the new\n+\t\t\t * branch with the current tree, with the old\n+\t\t\t * branch as the base. Then we reset the index\n+\t\t\t * (but not the working tree) to the new\n+\t\t\t * branch, leaving the working tree as the\n+\t\t\t * merged version, but skipping unmerged\n+\t\t\t * entries in the index.\n+\t\t\t */\n+\n+\t\t\tadd_files_to_cache(0, NULL, NULL);\n+\t\t\twork = write_tree_from_memory();\n+\n+\t\t\tret = reset_to_new(new->commit->tree, opts->quiet);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t\tmerge_trees(new->commit->tree, work, old->commit->tree,\n+\t\t\t\t    new->name, \"local\", &result);\n+\t\t\treset_clean_to_new(new->commit->tree, opts->quiet);\n+\t\t}\n+\t}\n+\n+\tif (write_cache(newfd, active_cache, active_nr) ||\n+\t    close(newfd) || commit_locked_index(lock_file))\n+\t\tdie(\"unable to write new index file\");\n+\n+\tif (!opts->force)\n+\t\tshow_local_changes(&new->commit->object);\n+\n+\treturn 0;\n+}\n+\n+static void update_refs_for_switch(struct checkout_opts *opts,\n+\t\t\t\t   struct branch_info *old,\n+\t\t\t\t   struct branch_info *new)\n+{\n+\tchar *msg;\n+\tconst char *old_desc;\n+\tif (opts->new_branch) {\n+\t\tcreate_branch(opts->new_branch, new->name, 0,\n+\t\t\t      opts->new_branch_log, opts->track);\n+\t\tnew->name = opts->new_branch;\n+\t\tsetup_branch_path(new);\n+\t}\n+\n+\tmsg = malloc(1024);\n+\told_desc = old->name;\n+\tif (!old_desc)\n+\t\told_desc = sha1_to_hex(old->commit->object.sha1);\n+\tsnprintf(msg, 1024, \"checkout: moving from %s to %s\",\n+\t\t old_desc, new->name);\n+\n+\tif (new->path) {\n+\t\tcreate_symref(\"HEAD\", new->path, msg);\n+\t\tif (!opts->quiet) {\n+\t\t\tif (old->path && !strcmp(new->path, old->path))\n+\t\t\t\tfprintf(stderr, \"Already on \\\"%s\\\"\\n\",\n+\t\t\t\t\tnew->name);\n+\t\t\telse\n+\t\t\t\tfprintf(stderr, \"Switched to%s branch \\\"%s\\\"\\n\",\n+\t\t\t\t\topts->new_branch ? \" a new\" : \"\",\n+\t\t\t\t\tnew->name);\n+\t\t}\n+\t} else if (strcmp(new->name, \"HEAD\")) {\n+\t\tupdate_ref(msg, \"HEAD\", new->commit->object.sha1, NULL,\n+\t\t\t   REF_NODEREF, DIE_ON_ERR);\n+\t\tif (!opts->quiet) {\n+\t\t\tif (old->path)\n+\t\t\t\tfprintf(stderr, \"Note: moving to \\\"%s\\\" which isn't a local branch\\nIf you want to create a new branch from this checkout, you may do so\\n(now or later) by using -b with the checkout command again. Example:\\n  git checkout -b <new_branch_name>\\n\", new->name);\n+\t\t\tdescribe_detached_head(\"HEAD is now at\", new->commit);\n+\t\t}\n+\t}\n+\tremove_merge_head();\n+}\n+\n+static int switch_branches(struct checkout_opts *opts,\n+\t\t\t   struct branch_info *new, const char *prefix)\n+{\n+\tint ret = 0;\n+\tstruct branch_info old;\n+\tunsigned char rev[20];\n+\tint flag;\n+\tmemset(&old, 0, sizeof(old));\n+\told.path = resolve_ref(\"HEAD\", rev, 0, &flag);\n+\told.commit = lookup_commit_reference_gently(rev, 1);\n+\tif (!(flag & REF_ISSYMREF))\n+\t\told.path = NULL;\n+\n+\tif (old.path && !prefixcmp(old.path, \"refs/heads/\"))\n+\t\told.name = old.path + strlen(\"refs/heads/\");\n+\n+\tif (!new->name) {\n+\t\tnew->name = \"HEAD\";\n+\t\tnew->commit = old.commit;\n+\t\tif (!new->commit)\n+\t\t\tdie(\"You are on a branch yet to be born\");\n+\t\tparse_commit(new->commit);\n+\t}\n+\n+\t/*\n+\t * If the new thing isn't a branch and isn't HEAD and we're\n+\t * not starting a new branch, and we want messages, and we\n+\t * weren't on a branch, and we're moving to a new commit,\n+\t * describe the old commit.\n+\t */\n+\tif (!new->path && strcmp(new->name, \"HEAD\") && !opts->new_branch &&\n+\t    !opts->quiet && !old.path && new->commit != old.commit)\n+\t\tdescribe_detached_head(\"Previous HEAD position was\", old.commit);\n+\n+\tif (!old.commit) {\n+\t\tif (!opts->quiet) {\n+\t\t\tfprintf(stderr, \"warning: You appear to be on a branch yet to be born.\\n\");\n+\t\t\tfprintf(stderr, \"warning: Forcing checkout of %s.\\n\", new->name);\n+\t\t}\n+\t\topts->force = 1;\n+\t}\n+\n+\tret = merge_working_tree(opts, &old, new, prefix);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tupdate_refs_for_switch(opts, &old, new);\n+\n+\treturn post_checkout_hook(old.commit, new->commit, 1);\n+}\n+\n+int cmd_checkout(int argc, const char **argv, const char *prefix)\n+{\n+\tstruct checkout_opts opts;\n+\tunsigned char rev[20];\n+\tconst char *arg;\n+\tstruct branch_info new;\n+\tstruct tree *source_tree = NULL;\n+\n+\tmemset(&opts, 0, sizeof(opts));\n+\n+\tmemset(&new, 0, sizeof(new));\n+\n+\tstruct option options[] = {\n+\t\tOPT__QUIET(&opts.quiet),\n+\t\tOPT_STRING('b', NULL, &opts.new_branch, \"new branch\", \"branch\"),\n+\t\tOPT_BOOLEAN('l', NULL, &opts.new_branch_log, \"log for new branch\"),\n+\t\tOPT_BOOLEAN( 0 , \"no-track\", &opts.no_track, \"don't track\"),\n+\t\tOPT_BOOLEAN( 0 , \"track\", &opts.track, \"track\"),\n+\t\tOPT_BOOLEAN('f', NULL, &opts.force, \"force\"),\n+\t\tOPT_BOOLEAN('m', NULL, &opts.merge, \"merge\"),\n+\t};\n+\n+\tgit_config(git_default_config);\n+\n+\targc = parse_options(argc, argv, options, checkout_usage, 0);\n+\tif (argc) {\n+\t\targ = argv[0];\n+\t\tif (get_sha1(arg, rev))\n+\t\t\t;\n+\t\telse if ((new.commit = lookup_commit_reference_gently(rev, 1))) {\n+\t\t\tnew.name = arg;\n+\t\t\tsetup_branch_path(&new);\n+\t\t\tif (resolve_ref(new.path, rev, 1, NULL))\n+\t\t\t\tnew.commit = lookup_commit_reference(rev);\n+\t\t\telse\n+\t\t\t\tnew.path = NULL;\n+\t\t\tparse_commit(new.commit);\n+\t\t\tsource_tree = new.commit->tree;\n+\t\t\targv++;\n+\t\t\targc--;\n+\t\t} else if ((source_tree = parse_tree_indirect(rev))) {\n+\t\t\targv++;\n+\t\t\targc--;\n+\t\t}\n+\t}\n+\n+\tif (argc && !strcmp(argv[0], \"--\")) {\n+\t\targv++;\n+\t\targc--;\n+\t}\n+\n+\tif (!opts.new_branch && (opts.track || opts.no_track)) {\n+\t\tdie(\"git checkout: --track and --no-track require -b\");\n+\t}\n+\tif (opts.force && opts.merge) {\n+\t\tdie(\"git checkout: -f and -m are incompatible\");\n+\t}\n+\n+\tif (argc) {\n+\t\tconst char **pathspec = get_pathspec(prefix, argv);\n+\t\t/* Checkout paths */\n+\t\tif (opts.new_branch || opts.force || opts.merge) {\n+\t\t\tif (argc == 1) {\n+\t\t\t\tdie(\"git checkout: updating paths is incompatible with switching branches/forcing\\nDid you intend to checkout '%s' which can not be resolved as commit?\", argv[0]);\n+\t\t\t} else {\n+\t\t\t\tdie(\"git checkout: updating paths is incompatible with switching branches/forcing\");\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (source_tree)\n+\t\t\tread_tree_some(source_tree, pathspec);\n+\t\telse\n+\t\t\tread_cache();\n+\t\treturn checkout_paths(pathspec);\n+\t}\n+\n+\tif (new.name && !new.commit) {\n+\t\tdie(\"Cannot switch branch to a non-commit.\");\n+\t}\n+\n+\treturn switch_branches(&opts, &new, prefix);\n+}\ndiff --git a/builtin.h b/builtin.h\nindex 428160d..25d91bb 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -19,6 +19,7 @@ extern int cmd_blame(int argc, const char **argv, const char *prefix);\n extern int cmd_branch(int argc, const char **argv, const char *prefix);\n extern int cmd_bundle(int argc, const char **argv, const char *prefix);\n extern int cmd_cat_file(int argc, const char **argv, const char *prefix);\n+extern int cmd_checkout(int argc, const char **argv, const char *prefix);\n extern int cmd_checkout_index(int argc, const char **argv, const char *prefix);\n extern int cmd_check_attr(int argc, const char **argv, const char *prefix);\n extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);\ndiff --git a/git-checkout.sh b/contrib/examples/git-checkout.sh\nsimilarity index 100%\nrename from git-checkout.sh\nrename to contrib/examples/git-checkout.sh\ndiff --git a/git.c b/git.c\nindex 114ea75..fc15686 100644\n--- a/git.c\n+++ b/git.c\n@@ -287,6 +287,7 @@ static void handle_internal_command(int argc, const char **argv)\n \t\t{ \"branch\", cmd_branch, RUN_SETUP },\n \t\t{ \"bundle\", cmd_bundle },\n \t\t{ \"cat-file\", cmd_cat_file, RUN_SETUP },\n+\t\t{ \"checkout\", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },\n \t\t{ \"checkout-index\", cmd_checkout_index,\n \t\t\tRUN_SETUP | NEED_WORK_TREE},\n \t\t{ \"check-ref-format\", cmd_check_ref_format },\ndiff --git a/t/t7201-co.sh b/t/t7201-co.sh\nindex c6f93a9..92c9ba9 100755\n--- a/t/t7201-co.sh\n+++ b/t/t7201-co.sh\n@@ -103,13 +103,6 @@ test_expect_success \"checkout -m with dirty tree\" '\n \ttest \"$(git symbolic-ref HEAD)\" = \"refs/heads/side\" &&\n \n \t(cat >expect.messages <<EOF\n-Merging side with local\n-Merging:\n-ab76817 Side M one, D two, A three\n-virtual local\n-found 1 common ancestor(s):\n-7329388 Initial A one, A two\n-Auto-merged one\n M\tone\n EOF\n ) &&\n-- \n1.5.4.rc3.4.g16335\n"}]}