{"thread":{"id":"49790","subject":"[PATCH 00/22] Kill the_index part 5","startedAt":"2018-11-10T05:46:56Z","lastAt":"2018-11-12T10:24:42Z","messageCount":6,"participants":["Nguyễn Thái Ngọc Duy","Laszlo Ersek"],"isPatch":true,"patchVersion":1,"patchTotal":22},"messages":[{"id":"362857","messageId":"20181110054646.10149-1-pclouds@gmail.com","threadId":"49790","inReplyTo":null,"subject":"[PATCH 00/22] Kill the_index part 5","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-11-10T05:46:23Z","receivedAt":"2018-11-10T05:46:56Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"I lied about part 5 being final. This series contains most of my WIP\nseries [2] except sha1-name.c, read-cache.c and merge-recursive.c\nbecause there will be conflicts on 'pu' so they will be in part 6. At\nleast this only results in two small conflicts in sequencer.c.\n\nI did start pushing the_repository out of library code [1] in the bottom\nhalf of this series. There aren't big surprises except that cache-tree\nAPI now take _both_ struct repository and struct index_state. The\nreason is cache-tree can work on temporary indexes and repo->index is\nabout $GIT_DIR/index.\n\n[1] Stefan and I make a good team. He keeps adding the_repository. I\nkeep removing. We both hold hands leading commit counts (with Brian\njust a bit behind frantically replacing sha1 with oid to keep up).\nMeanwhile Junio is crying in the corner because of too many conflicts.\n:-D\n\n[2] https://public-inbox.org/git/20181019145237.16079-1-pclouds@gmail.com/\n\nNguyễn Thái Ngọc Duy (22):\n  wt-status.c: remove implicit dependency on the_index\n  wt-status.c: remove implicit dependency the_repository\n  list-objects-filter.c: remove implicit dependency on the_index\n  list-objects.c: reduce the_repository references\n  notes-merge.c: remove implicit dependency on the_index\n  notes-merge.c: remove implicit dependency the_repository\n  transport.c: remove implicit dependency on the_index\n  sequencer.c: remove implicit dependency on the_index\n  sequencer.c: remove implicit dependency on the_repository\n  blame.c: remove implicit dependency the_repository\n  bisect.c: remove the_repository reference\n  branch.c: remove the_repository reference\n  bundle.c: remove the_repository references\n  cache-tree.c: remove the_repository references\n  delta-islands.c: remove the_repository references\n  diff-lib.c: remove the_repository references\n  line-log.c: remove the_repository reference\n  notes-cache.c: remove the_repository references\n  pack-check.c: remove the_repository references\n  pack-*.c: remove the_repository references\n  rerere.c: remove the_repository references\n  rebase-interactive.c: remove the_repository references\n\n bisect.c                      |  48 ++--\n bisect.h                      |   5 +-\n blame.c                       |  39 +--\n branch.c                      |  21 +-\n branch.h                      |   8 +-\n builtin/am.c                  |   4 +-\n builtin/bisect--helper.c      |   2 +-\n builtin/branch.c              |   6 +-\n builtin/bundle.c              |   7 +-\n builtin/checkout.c            |   5 +-\n builtin/commit.c              |   8 +-\n builtin/fsck.c                |   3 +-\n builtin/merge-ours.c          |   2 +-\n builtin/merge.c               |   2 +-\n builtin/notes.c               |   2 +-\n builtin/pack-objects.c        |   6 +-\n builtin/pull.c                |   3 +-\n builtin/push.c                |   3 +-\n builtin/read-tree.c           |   4 +-\n builtin/rebase--interactive.c |  19 +-\n builtin/rebase.c              |  13 +-\n builtin/rerere.c              |  10 +-\n builtin/reset.c               |   4 +-\n builtin/revert.c              |   8 +-\n bundle.c                      |  26 +-\n bundle.h                      |   9 +-\n cache-tree.c                  |  26 +-\n cache-tree.h                  |   4 +-\n combine-diff.c                |   2 +-\n delta-islands.c               |  24 +-\n delta-islands.h               |   9 +-\n diff-lib.c                    |   7 +-\n diff.c                        |  12 +-\n diff.h                        |   5 +-\n diffcore-pickaxe.c            |   4 +-\n grep.c                        |   2 +-\n line-log.c                    |   2 +-\n list-objects-filter.c         |  10 +-\n list-objects-filter.h         |   2 +\n list-objects.c                |  13 +-\n notes-cache.c                 |  12 +-\n notes-cache.h                 |   6 +-\n notes-merge.c                 |  16 +-\n notes-merge.h                 |   5 +-\n pack-bitmap-write.c           |   6 +-\n pack-bitmap.c                 |  13 +-\n pack-bitmap.h                 |   3 +-\n pack-check.c                  |   9 +-\n pack-objects.c                |   6 +-\n pack-objects.h                |   5 +-\n pack.h                        |   4 +-\n read-cache.c                  |   2 +-\n rebase-interactive.c          |   6 +-\n rebase-interactive.h          |   5 +-\n ref-filter.c                  |   2 +-\n rerere.c                      |  26 +-\n rerere.h                      |   6 +-\n sequencer.c                   | 453 +++++++++++++++++++---------------\n sequencer.h                   |  27 +-\n transport.c                   |   9 +-\n transport.h                   |   3 +-\n unpack-trees.c                |   2 +-\n userdiff.c                    |   5 +-\n userdiff.h                    |   4 +-\n wt-status.c                   |  94 ++++---\n wt-status.h                   |  21 +-\n 66 files changed, 650 insertions(+), 489 deletions(-)\n\n-- \n2.19.1.1231.g84aef82467\n\n"},{"id":"362858","messageId":"20181110054646.10149-2-pclouds@gmail.com","threadId":"49790","inReplyTo":"20181110054646.10149-1-pclouds@gmail.com","subject":"[PATCH v2] format-patch: respect --stat in cover letter's diffstat","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-11-10T05:46:24Z","receivedAt":"2018-11-10T05:46:58Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Commit 43662b23ab (format-patch: keep cover-letter diffstat wrapped in\n72 columns - 2018-01-24) uncondtionally sets stat width to 72 when\ngenerating diffstat for the cover letter, ignoring --stat from command\nline. But it should only do so when stat width is still default\n(i.e. stat_width == 0).\n\nIn order to fix this, we should only set stat_width if stat_width is\nzero. But it will never be. Commit 071dd0ba43 (format-patch: reduce\npatch diffstat width to 72 - 2018-02-01) makes sure that default stat\nwidth will be 72 (ignoring $COLUMNS, but could still be overriden by\n--stat). So all we need to do here is drop the assignment.\n\nReported-by: Laszlo Ersek <lersek@redhat.com>\nHelped-by: Leif Lindholm <leif.lindholm@linaro.org>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/log.c          |  2 --\n t/t4052-stat-output.sh | 48 +++++++++++++++++++++++++++++-------------\n 2 files changed, 33 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 061d4fd864..1a39c6e52a 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1009,8 +1009,6 @@ static void show_diffstat(struct rev_info *rev,\n \n \tmemcpy(&opts, &rev->diffopt, sizeof(opts));\n \topts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;\n-\topts.stat_width = MAIL_DEFAULT_WRAP;\n-\n \tdiff_setup_done(&opts);\n \n \tdiff_tree_oid(get_commit_tree_oid(origin),\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 6e2cf933f7..28c053849a 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -44,42 +44,50 @@ show --stat\n log -1 --stat\n EOF\n \n-while read cmd args\n+cat >expect.60 <<-'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n+EOF\n+cat >expect.6030 <<-'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n+EOF\n+cat >expect2.60 <<-'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n+EOF\n+cat >expect2.6030 <<-'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n+EOF\n+while read expect cmd args\n do\n-\tcat >expect <<-'EOF'\n-\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n-\tEOF\n \ttest_expect_success \"$cmd --stat=width: a long name is given more room when the bar is short\" '\n \t\tgit $cmd $args --stat=40 >output &&\n \t\tgrep \" | \" output >actual &&\n-\t\ttest_cmp expect actual\n+\t\ttest_cmp $expect.60 actual\n \t'\n \n \ttest_expect_success \"$cmd --stat-width=width with long name\" '\n \t\tgit $cmd $args --stat-width=40 >output &&\n \t\tgrep \" | \" output >actual &&\n-\t\ttest_cmp expect actual\n+\t\ttest_cmp $expect.60 actual\n \t'\n \n-\tcat >expect <<-'EOF'\n-\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n-\tEOF\n \ttest_expect_success \"$cmd --stat=...,name-width with long name\" '\n \t\tgit $cmd $args --stat=60,30 >output &&\n \t\tgrep \" | \" output >actual &&\n-\t\ttest_cmp expect actual\n+\t\ttest_cmp $expect.6030 actual\n \t'\n \n \ttest_expect_success \"$cmd --stat-name-width with long name\" '\n \t\tgit $cmd $args --stat-name-width=30 >output &&\n \t\tgrep \" | \" output >actual &&\n-\t\ttest_cmp expect actual\n+\t\ttest_cmp $expect.6030 actual\n \t'\n done <<\\EOF\n-format-patch -1 --stdout\n-diff HEAD^ HEAD --stat\n-show --stat\n-log -1 --stat\n+expect2 format-patch --cover-letter -1 --stdout\n+expect diff HEAD^ HEAD --stat\n+expect show --stat\n+expect log -1 --stat\n EOF\n \n \n@@ -95,6 +103,16 @@ test_expect_success 'preparation for big change tests' '\n \tgit commit -m message abcd\n '\n \n+cat >expect72 <<'EOF'\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+EOF\n+test_expect_success \"format-patch --cover-letter ignores COLUMNS (big change)\" '\n+\tCOLUMNS=200 git format-patch -1 --stdout --cover-letter >output &&\n+\tgrep \" | \" output >actual &&\n+\ttest_cmp expect72 actual\n+'\n+\n cat >expect72 <<'EOF'\n  abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n EOF\n-- \n2.19.1.1005.gac84295441\n\n"},{"id":"362859","messageId":"20181110054646.10149-3-pclouds@gmail.com","threadId":"49790","inReplyTo":"20181110054646.10149-1-pclouds@gmail.com","subject":"[PATCH 01/22] wt-status.c: remove implicit dependency on the_index","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-11-10T05:46:25Z","receivedAt":"2018-11-10T05:46:58Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/commit.c |  2 +-\n builtin/pull.c   |  3 +-\n builtin/rebase.c |  7 +++--\n sequencer.c      |  8 ++---\n wt-status.c      | 76 +++++++++++++++++++++++++++---------------------\n wt-status.h      | 17 +++++++----\n 6 files changed, 66 insertions(+), 47 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 074bd9a551..6637a928a7 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -185,7 +185,7 @@ static void determine_whence(struct wt_status *s)\n \n static void status_init_config(struct wt_status *s, config_fn_t fn)\n {\n-\twt_status_prepare(s);\n+\twt_status_prepare(the_repository, s);\n \tinit_diff_ui_defaults();\n \tgit_config(fn, s);\n \tdetermine_whence(s);\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex c21aa276f1..6026ce1a69 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -888,7 +888,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \t\t\tdie(_(\"Updating an unborn branch with changes added to the index.\"));\n \n \t\tif (!autostash)\n-\t\t\trequire_clean_work_tree(N_(\"pull with rebase\"),\n+\t\t\trequire_clean_work_tree(the_repository,\n+\t\t\t\tN_(\"pull with rebase\"),\n \t\t\t\t_(\"please commit or stash them.\"), 1, 0);\n \n \t\tif (get_rebase_fork_point(&rebase_fork_point, repo, *refspecs))\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 0ee06aa363..b9eb958454 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -983,7 +983,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\t\t     &lock_file);\n \t\trollback_lock_file(&lock_file);\n \n-\t\tif (has_unstaged_changes(1)) {\n+\t\tif (has_unstaged_changes(the_repository, 1)) {\n \t\t\tputs(_(\"You must edit all merge conflicts and then\\n\"\n \t\t\t       \"mark them as resolved using git add\"));\n \t\t\texit(1);\n@@ -1351,7 +1351,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\tupdate_index_if_able(&the_index, &lock_file);\n \t\trollback_lock_file(&lock_file);\n \n-\t\tif (has_unstaged_changes(1) || has_uncommitted_changes(1)) {\n+\t\tif (has_unstaged_changes(the_repository, 1) ||\n+\t\t    has_uncommitted_changes(the_repository, 1)) {\n \t\t\tconst char *autostash =\n \t\t\t\tstate_dir_path(\"autostash\", &options);\n \t\t\tstruct child_process stash = CHILD_PROCESS_INIT;\n@@ -1397,7 +1398,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t}\n \t}\n \n-\tif (require_clean_work_tree(\"rebase\",\n+\tif (require_clean_work_tree(the_repository, \"rebase\",\n \t\t\t\t    _(\"Please commit or stash them.\"), 1, 1)) {\n \t\tret = 1;\n \t\tgoto cleanup;\ndiff --git a/sequencer.c b/sequencer.c\nindex 9e1ab3a2a7..0b8f18fd36 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2773,7 +2773,7 @@ static int do_exec(const char *command_line)\n \tif (discard_cache() < 0 || read_cache() < 0)\n \t\treturn error(_(\"could not read index\"));\n \n-\tdirty = require_clean_work_tree(\"rebase\", NULL, 1, 1);\n+\tdirty = require_clean_work_tree(the_repository, \"rebase\", NULL, 1, 1);\n \n \tif (status) {\n \t\twarning(_(\"execution failed: %s\\n%s\"\n@@ -3714,10 +3714,10 @@ static int commit_staged_changes(struct replay_opts *opts,\n \tunsigned int flags = ALLOW_EMPTY | EDIT_MSG;\n \tunsigned int final_fixup = 0, is_clean;\n \n-\tif (has_unstaged_changes(1))\n+\tif (has_unstaged_changes(the_repository, 1))\n \t\treturn error(_(\"cannot rebase: You have unstaged changes.\"));\n \n-\tis_clean = !has_uncommitted_changes(0);\n+\tis_clean = !has_uncommitted_changes(the_repository, 0);\n \n \tif (file_exists(rebase_path_amend())) {\n \t\tstruct strbuf rev = STRBUF_INIT;\n@@ -4847,7 +4847,7 @@ int complete_action(struct replay_opts *opts, unsigned flags,\n \tif (checkout_onto(opts, onto_name, oid_to_hex(&oid), orig_head))\n \t\treturn -1;\n ;\n-\tif (require_clean_work_tree(\"rebase\", \"\", 1, 1))\n+\tif (require_clean_work_tree(the_repository, \"rebase\", \"\", 1, 1))\n \t\treturn -1;\n \n \treturn sequencer_continue(opts);\ndiff --git a/wt-status.c b/wt-status.c\nindex 187568a112..6d401b2c24 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -119,9 +119,10 @@ static void status_printf_more(struct wt_status *s, const char *color,\n \tva_end(ap);\n }\n \n-void wt_status_prepare(struct wt_status *s)\n+void wt_status_prepare(struct repository *r, struct wt_status *s)\n {\n \tmemset(s, 0, sizeof(*s));\n+\ts->repo = r;\n \tmemcpy(s->color_palette, default_wt_status_colors,\n \t       sizeof(default_wt_status_colors));\n \ts->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n@@ -494,19 +495,19 @@ static void wt_status_collect_changed_cb(struct diff_queue_struct *q,\n \t}\n }\n \n-static int unmerged_mask(const char *path)\n+static int unmerged_mask(struct index_state *istate, const char *path)\n {\n \tint pos, mask;\n \tconst struct cache_entry *ce;\n \n-\tpos = cache_name_pos(path, strlen(path));\n+\tpos = index_name_pos(istate, path, strlen(path));\n \tif (0 <= pos)\n \t\treturn 0;\n \n \tmask = 0;\n \tpos = -pos-1;\n-\twhile (pos < active_nr) {\n-\t\tce = active_cache[pos++];\n+\twhile (pos < istate->cache_nr) {\n+\t\tce = istate->cache[pos++];\n \t\tif (strcmp(ce->name, path) || !ce_stage(ce))\n \t\t\tbreak;\n \t\tmask |= (1 << (ce_stage(ce) - 1));\n@@ -566,7 +567,8 @@ static void wt_status_collect_updated_cb(struct diff_queue_struct *q,\n \t\t\ts->committable = 1;\n \t\t\tbreak;\n \t\tcase DIFF_STATUS_UNMERGED:\n-\t\t\td->stagemask = unmerged_mask(p->two->path);\n+\t\t\td->stagemask = unmerged_mask(s->repo->index,\n+\t\t\t\t\t\t     p->two->path);\n \t\t\t/*\n \t\t\t * Don't bother setting {mode,oid}_{head,index} since the print\n \t\t\t * code will output the stage values directly and not use the\n@@ -585,7 +587,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)\n {\n \tstruct rev_info rev;\n \n-\trepo_init_revisions(the_repository, &rev, NULL);\n+\trepo_init_revisions(s->repo, &rev, NULL);\n \tsetup_revisions(0, NULL, &rev, NULL);\n \trev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;\n \trev.diffopt.flags.dirty_submodules = 1;\n@@ -610,7 +612,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)\n \tstruct rev_info rev;\n \tstruct setup_revision_opt opt;\n \n-\trepo_init_revisions(the_repository, &rev, NULL);\n+\trepo_init_revisions(s->repo, &rev, NULL);\n \tmemset(&opt, 0, sizeof(opt));\n \topt.def = s->is_initial ? empty_tree_oid_hex() : s->reference;\n \tsetup_revisions(0, NULL, &rev, &opt);\n@@ -643,14 +645,15 @@ static void wt_status_collect_changes_index(struct wt_status *s)\n \n static void wt_status_collect_changes_initial(struct wt_status *s)\n {\n+\tstruct index_state *istate = s->repo->index;\n \tint i;\n \n-\tfor (i = 0; i < active_nr; i++) {\n+\tfor (i = 0; i < istate->cache_nr; i++) {\n \t\tstruct string_list_item *it;\n \t\tstruct wt_status_change_data *d;\n-\t\tconst struct cache_entry *ce = active_cache[i];\n+\t\tconst struct cache_entry *ce = istate->cache[i];\n \n-\t\tif (!ce_path_match(&the_index, ce, &s->pathspec, NULL))\n+\t\tif (!ce_path_match(istate, ce, &s->pathspec, NULL))\n \t\t\tcontinue;\n \t\tif (ce_intent_to_add(ce))\n \t\t\tcontinue;\n@@ -684,6 +687,7 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \tint i;\n \tstruct dir_struct dir;\n \tuint64_t t_begin = getnanotime();\n+\tstruct index_state *istate = s->repo->index;\n \n \tif (!s->show_untracked_files)\n \t\treturn;\n@@ -698,25 +702,25 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \t\tif (s->show_ignored_mode == SHOW_MATCHING_IGNORED)\n \t\t\tdir.flags |= DIR_SHOW_IGNORED_TOO_MODE_MATCHING;\n \t} else {\n-\t\tdir.untracked = the_index.untracked;\n+\t\tdir.untracked = istate->untracked;\n \t}\n \n \tsetup_standard_excludes(&dir);\n \n-\tfill_directory(&dir, &the_index, &s->pathspec);\n+\tfill_directory(&dir, istate, &s->pathspec);\n \n \tfor (i = 0; i < dir.nr; i++) {\n \t\tstruct dir_entry *ent = dir.entries[i];\n-\t\tif (cache_name_is_other(ent->name, ent->len) &&\n-\t\t    dir_path_match(&the_index, ent, &s->pathspec, 0, NULL))\n+\t\tif (index_name_is_other(istate, ent->name, ent->len) &&\n+\t\t    dir_path_match(istate, ent, &s->pathspec, 0, NULL))\n \t\t\tstring_list_insert(&s->untracked, ent->name);\n \t\tfree(ent);\n \t}\n \n \tfor (i = 0; i < dir.ignored_nr; i++) {\n \t\tstruct dir_entry *ent = dir.ignored[i];\n-\t\tif (cache_name_is_other(ent->name, ent->len) &&\n-\t\t    dir_path_match(&the_index, ent, &s->pathspec, 0, NULL))\n+\t\tif (index_name_is_other(istate, ent->name, ent->len) &&\n+\t\t    dir_path_match(istate, ent, &s->pathspec, 0, NULL))\n \t\t\tstring_list_insert(&s->ignored, ent->name);\n \t\tfree(ent);\n \t}\n@@ -1009,7 +1013,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s)\n \tint dirty_submodules;\n \tconst char *c = color(WT_STATUS_HEADER, s);\n \n-\trepo_init_revisions(the_repository, &rev, NULL);\n+\trepo_init_revisions(s->repo, &rev, NULL);\n \trev.diffopt.flags.allow_textconv = 1;\n \trev.diffopt.ita_invisible_in_index = 1;\n \n@@ -1326,7 +1330,7 @@ static void show_rebase_in_progress(struct wt_status *s,\n \t\t\t\t_(\"  (use \\\"git rebase --abort\\\" to check out the original branch)\"));\n \t\t}\n \t} else if (s->state.rebase_in_progress ||\n-\t\t   !stat(git_path_merge_msg(the_repository), &st)) {\n+\t\t   !stat(git_path_merge_msg(s->repo), &st)) {\n \t\tprint_rebase_state(s, color);\n \t\tif (s->hints)\n \t\t\tstatus_printf_ln(s, color,\n@@ -2135,6 +2139,7 @@ static void wt_porcelain_v2_print_unmerged_entry(\n \tstruct wt_status *s)\n {\n \tstruct wt_status_change_data *d = it->util;\n+\tstruct index_state *istate = s->repo->index;\n \tconst struct cache_entry *ce;\n \tstruct strbuf buf_index = STRBUF_INIT;\n \tconst char *path_index = NULL;\n@@ -2173,11 +2178,11 @@ static void wt_porcelain_v2_print_unmerged_entry(\n \t */\n \tmemset(stages, 0, sizeof(stages));\n \tsum = 0;\n-\tpos = cache_name_pos(it->string, strlen(it->string));\n+\tpos = index_name_pos(istate, it->string, strlen(it->string));\n \tassert(pos < 0);\n \tpos = -pos-1;\n-\twhile (pos < active_nr) {\n-\t\tce = active_cache[pos++];\n+\twhile (pos < istate->cache_nr) {\n+\t\tce = istate->cache[pos++];\n \t\tstage = ce_stage(ce);\n \t\tif (strcmp(ce->name, it->string) || !stage)\n \t\t\tbreak;\n@@ -2302,12 +2307,12 @@ void wt_status_print(struct wt_status *s)\n /**\n  * Returns 1 if there are unstaged changes, 0 otherwise.\n  */\n-int has_unstaged_changes(int ignore_submodules)\n+int has_unstaged_changes(struct repository *r, int ignore_submodules)\n {\n \tstruct rev_info rev_info;\n \tint result;\n \n-\trepo_init_revisions(the_repository, &rev_info, NULL);\n+\trepo_init_revisions(r, &rev_info, NULL);\n \tif (ignore_submodules) {\n \t\trev_info.diffopt.flags.ignore_submodules = 1;\n \t\trev_info.diffopt.flags.override_submodule_config = 1;\n@@ -2321,15 +2326,16 @@ int has_unstaged_changes(int ignore_submodules)\n /**\n  * Returns 1 if there are uncommitted changes, 0 otherwise.\n  */\n-int has_uncommitted_changes(int ignore_submodules)\n+int has_uncommitted_changes(struct repository *r,\n+\t\t\t    int ignore_submodules)\n {\n \tstruct rev_info rev_info;\n \tint result;\n \n-\tif (is_cache_unborn())\n+\tif (is_index_unborn(r->index))\n \t\treturn 0;\n \n-\trepo_init_revisions(the_repository, &rev_info, NULL);\n+\trepo_init_revisions(r, &rev_info, NULL);\n \tif (ignore_submodules)\n \t\trev_info.diffopt.flags.ignore_submodules = 1;\n \trev_info.diffopt.flags.quick = 1;\n@@ -2340,7 +2346,7 @@ int has_uncommitted_changes(int ignore_submodules)\n \t\t * We have no head (or it's corrupt); use the empty tree,\n \t\t * which will complain if the index is non-empty.\n \t\t */\n-\t\tstruct tree *tree = lookup_tree(the_repository, the_hash_algo->empty_tree);\n+\t\tstruct tree *tree = lookup_tree(r, the_hash_algo->empty_tree);\n \t\tadd_pending_object(&rev_info, &tree->object, \"\");\n \t}\n \n@@ -2353,24 +2359,28 @@ int has_uncommitted_changes(int ignore_submodules)\n  * If the work tree has unstaged or uncommitted changes, dies with the\n  * appropriate message.\n  */\n-int require_clean_work_tree(const char *action, const char *hint, int ignore_submodules, int gently)\n+int require_clean_work_tree(struct repository *r,\n+\t\t\t    const char *action,\n+\t\t\t    const char *hint,\n+\t\t\t    int ignore_submodules,\n+\t\t\t    int gently)\n {\n \tstruct lock_file lock_file = LOCK_INIT;\n \tint err = 0, fd;\n \n \tfd = hold_locked_index(&lock_file, 0);\n-\trefresh_cache(REFRESH_QUIET);\n+\trefresh_index(r->index, REFRESH_QUIET, NULL, NULL, NULL);\n \tif (0 <= fd)\n-\t\tupdate_index_if_able(&the_index, &lock_file);\n+\t\tupdate_index_if_able(r->index, &lock_file);\n \trollback_lock_file(&lock_file);\n \n-\tif (has_unstaged_changes(ignore_submodules)) {\n+\tif (has_unstaged_changes(r, ignore_submodules)) {\n \t\t/* TRANSLATORS: the action is e.g. \"pull with rebase\" */\n \t\terror(_(\"cannot %s: You have unstaged changes.\"), _(action));\n \t\terr = 1;\n \t}\n \n-\tif (has_uncommitted_changes(ignore_submodules)) {\n+\tif (has_uncommitted_changes(r, ignore_submodules)) {\n \t\tif (err)\n \t\t\terror(_(\"additionally, your index contains uncommitted changes.\"));\n \t\telse\ndiff --git a/wt-status.h b/wt-status.h\nindex 1fcf93afbf..8375e816fb 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -7,6 +7,7 @@\n #include \"pathspec.h\"\n #include \"remote.h\"\n \n+struct repository;\n struct worktree;\n \n enum color_wt_status {\n@@ -83,6 +84,7 @@ struct wt_status_state {\n };\n \n struct wt_status {\n+\tstruct repository *repo;\n \tint is_initial;\n \tchar *branch;\n \tconst char *reference;\n@@ -128,7 +130,7 @@ struct wt_status {\n \n size_t wt_status_locate_end(const char *s, size_t len);\n void wt_status_add_cut_line(FILE *fp);\n-void wt_status_prepare(struct wt_status *s);\n+void wt_status_prepare(struct repository *r, struct wt_status *s);\n void wt_status_print(struct wt_status *s);\n void wt_status_collect(struct wt_status *s);\n void wt_status_collect_free_buffers(struct wt_status *s);\n@@ -144,9 +146,14 @@ __attribute__((format (printf, 3, 4)))\n void status_printf(struct wt_status *s, const char *color, const char *fmt, ...);\n \n /* The following functions expect that the caller took care of reading the index. */\n-int has_unstaged_changes(int ignore_submodules);\n-int has_uncommitted_changes(int ignore_submodules);\n-int require_clean_work_tree(const char *action, const char *hint,\n-\tint ignore_submodules, int gently);\n+int has_unstaged_changes(struct repository *repo,\n+\t\t\t int ignore_submodules);\n+int has_uncommitted_changes(struct repository *repo,\n+\t\t\t    int ignore_submodules);\n+int require_clean_work_tree(struct repository *repo,\n+\t\t\t    const char *action,\n+\t\t\t    const char *hint,\n+\t\t\t    int ignore_submodules,\n+\t\t\t    int gently);\n \n #endif /* STATUS_H */\n-- \n2.19.1.1231.g84aef82467\n\n"},{"id":"362860","messageId":"20181110054646.10149-4-pclouds@gmail.com","threadId":"49790","inReplyTo":"20181110054646.10149-1-pclouds@gmail.com","subject":"[PATCH 02/22] wt-status.c: remove implicit dependency the_repository","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-11-10T05:46:26Z","receivedAt":"2018-11-10T05:47:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n ref-filter.c |  2 +-\n wt-status.c  | 18 ++++++++++--------\n wt-status.h  |  4 +++-\n 3 files changed, 14 insertions(+), 10 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 0c45ed9d94..c4eaf30313 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1413,7 +1413,7 @@ char *get_head_description(void)\n \tstruct strbuf desc = STRBUF_INIT;\n \tstruct wt_status_state state;\n \tmemset(&state, 0, sizeof(state));\n-\twt_status_get_state(&state, 1);\n+\twt_status_get_state(the_repository, &state, 1);\n \tif (state.rebase_in_progress ||\n \t    state.rebase_interactive_in_progress) {\n \t\tif (state.branch)\ndiff --git a/wt-status.c b/wt-status.c\nindex 6d401b2c24..e582c54238 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -755,7 +755,7 @@ void wt_status_collect(struct wt_status *s)\n \t\twt_status_collect_changes_index(s);\n \twt_status_collect_untracked(s);\n \n-\twt_status_get_state(&s->state, s->branch && !strcmp(s->branch, \"HEAD\"));\n+\twt_status_get_state(s->repo, &s->state, s->branch && !strcmp(s->branch, \"HEAD\"));\n \tif (s->state.merge_in_progress && !has_unmerged(s))\n \t\ts->committable = 1;\n }\n@@ -1482,7 +1482,8 @@ static int grab_1st_switch(struct object_id *ooid, struct object_id *noid,\n \treturn 1;\n }\n \n-static void wt_status_get_detached_from(struct wt_status_state *state)\n+static void wt_status_get_detached_from(struct repository *r,\n+\t\t\t\t\tstruct wt_status_state *state)\n {\n \tstruct grab_1st_switch_cbdata cb;\n \tstruct commit *commit;\n@@ -1499,7 +1500,7 @@ static void wt_status_get_detached_from(struct wt_status_state *state)\n \t    /* sha1 is a commit? match without further lookup */\n \t    (oideq(&cb.noid, &oid) ||\n \t     /* perhaps sha1 is a tag, try to dereference to a commit */\n-\t     ((commit = lookup_commit_reference_gently(the_repository, &oid, 1)) != NULL &&\n+\t     ((commit = lookup_commit_reference_gently(r, &oid, 1)) != NULL &&\n \t      oideq(&cb.noid, &commit->object.oid)))) {\n \t\tconst char *from = ref;\n \t\tif (!skip_prefix(from, \"refs/tags/\", &from))\n@@ -1556,30 +1557,31 @@ int wt_status_check_bisect(const struct worktree *wt,\n \treturn 0;\n }\n \n-void wt_status_get_state(struct wt_status_state *state,\n+void wt_status_get_state(struct repository *r,\n+\t\t\t struct wt_status_state *state,\n \t\t\t int get_detached_from)\n {\n \tstruct stat st;\n \tstruct object_id oid;\n \n-\tif (!stat(git_path_merge_head(the_repository), &st)) {\n+\tif (!stat(git_path_merge_head(r), &st)) {\n \t\tstate->merge_in_progress = 1;\n \t} else if (wt_status_check_rebase(NULL, state)) {\n \t\t;\t\t/* all set */\n-\t} else if (!stat(git_path_cherry_pick_head(the_repository), &st) &&\n+\t} else if (!stat(git_path_cherry_pick_head(r), &st) &&\n \t\t\t!get_oid(\"CHERRY_PICK_HEAD\", &oid)) {\n \t\tstate->cherry_pick_in_progress = 1;\n \t\toidcpy(&state->cherry_pick_head_oid, &oid);\n \t}\n \twt_status_check_bisect(NULL, state);\n-\tif (!stat(git_path_revert_head(the_repository), &st) &&\n+\tif (!stat(git_path_revert_head(r), &st) &&\n \t    !get_oid(\"REVERT_HEAD\", &oid)) {\n \t\tstate->revert_in_progress = 1;\n \t\toidcpy(&state->revert_head_oid, &oid);\n \t}\n \n \tif (get_detached_from)\n-\t\twt_status_get_detached_from(state);\n+\t\twt_status_get_detached_from(r, state);\n }\n \n static void wt_longstatus_print_state(struct wt_status *s)\ndiff --git a/wt-status.h b/wt-status.h\nindex 8375e816fb..3a95975032 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -134,7 +134,9 @@ void wt_status_prepare(struct repository *r, struct wt_status *s);\n void wt_status_print(struct wt_status *s);\n void wt_status_collect(struct wt_status *s);\n void wt_status_collect_free_buffers(struct wt_status *s);\n-void wt_status_get_state(struct wt_status_state *state, int get_detached_from);\n+void wt_status_get_state(struct repository *repo,\n+\t\t\t struct wt_status_state *state,\n+\t\t\t int get_detached_from);\n int wt_status_check_rebase(const struct worktree *wt,\n \t\t\t   struct wt_status_state *state);\n int wt_status_check_bisect(const struct worktree *wt,\n-- \n2.19.1.1231.g84aef82467\n\n"},{"id":"362861","messageId":"20181110054646.10149-5-pclouds@gmail.com","threadId":"49790","inReplyTo":"20181110054646.10149-1-pclouds@gmail.com","subject":"[PATCH 03/22] list-objects-filter.c: remove implicit dependency on the_index","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-11-10T05:46:27Z","receivedAt":"2018-11-10T05:47:01Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"While at there, since we have access to struct repository now,\neliminate the only the_repository reference in this file.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n list-objects-filter.c | 10 +++++++---\n list-objects-filter.h |  2 ++\n list-objects.c        |  9 ++++++---\n 3 files changed, 15 insertions(+), 6 deletions(-)\n\ndiff --git a/list-objects-filter.c b/list-objects-filter.c\nindex 765f3df3b0..a62624a1ce 100644\n--- a/list-objects-filter.c\n+++ b/list-objects-filter.c\n@@ -34,6 +34,7 @@ struct filter_blobs_none_data {\n };\n \n static enum list_objects_filter_result filter_blobs_none(\n+\tstruct repository *r,\n \tenum list_objects_filter_situation filter_situation,\n \tstruct object *obj,\n \tconst char *pathname,\n@@ -88,6 +89,7 @@ struct filter_trees_none_data {\n };\n \n static enum list_objects_filter_result filter_trees_none(\n+\tstruct repository *r,\n \tenum list_objects_filter_situation filter_situation,\n \tstruct object *obj,\n \tconst char *pathname,\n@@ -144,6 +146,7 @@ struct filter_blobs_limit_data {\n };\n \n static enum list_objects_filter_result filter_blobs_limit(\n+\tstruct repository *r,\n \tenum list_objects_filter_situation filter_situation,\n \tstruct object *obj,\n \tconst char *pathname,\n@@ -171,7 +174,7 @@ static enum list_objects_filter_result filter_blobs_limit(\n \t\tassert(obj->type == OBJ_BLOB);\n \t\tassert((obj->flags & SEEN) == 0);\n \n-\t\tt = oid_object_info(the_repository, &obj->oid, &object_length);\n+\t\tt = oid_object_info(r, &obj->oid, &object_length);\n \t\tif (t != OBJ_BLOB) { /* probably OBJ_NONE */\n \t\t\t/*\n \t\t\t * We DO NOT have the blob locally, so we cannot\n@@ -249,6 +252,7 @@ struct filter_sparse_data {\n };\n \n static enum list_objects_filter_result filter_sparse(\n+\tstruct repository *r,\n \tenum list_objects_filter_situation filter_situation,\n \tstruct object *obj,\n \tconst char *pathname,\n@@ -268,7 +272,7 @@ static enum list_objects_filter_result filter_sparse(\n \t\tdtype = DT_DIR;\n \t\tval = is_excluded_from_list(pathname, strlen(pathname),\n \t\t\t\t\t    filename, &dtype, &filter_data->el,\n-\t\t\t\t\t    &the_index);\n+\t\t\t\t\t    r->index);\n \t\tif (val < 0)\n \t\t\tval = filter_data->array_frame[filter_data->nr].defval;\n \n@@ -331,7 +335,7 @@ static enum list_objects_filter_result filter_sparse(\n \t\tdtype = DT_REG;\n \t\tval = is_excluded_from_list(pathname, strlen(pathname),\n \t\t\t\t\t    filename, &dtype, &filter_data->el,\n-\t\t\t\t\t    &the_index);\n+\t\t\t\t\t    r->index);\n \t\tif (val < 0)\n \t\t\tval = frame->defval;\n \t\tif (val > 0) {\ndiff --git a/list-objects-filter.h b/list-objects-filter.h\nindex 52b4a84da9..1d45a4ad57 100644\n--- a/list-objects-filter.h\n+++ b/list-objects-filter.h\n@@ -4,6 +4,7 @@\n struct list_objects_filter_options;\n struct object;\n struct oidset;\n+struct repository;\n \n /*\n  * During list-object traversal we allow certain objects to be\n@@ -60,6 +61,7 @@ enum list_objects_filter_situation {\n };\n \n typedef enum list_objects_filter_result (*filter_object_fn)(\n+\tstruct repository *r,\n \tenum list_objects_filter_situation filter_situation,\n \tstruct object *obj,\n \tconst char *pathname,\ndiff --git a/list-objects.c b/list-objects.c\nindex c41cc80db5..0cfd646026 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -55,7 +55,8 @@ static void process_blob(struct traversal_context *ctx,\n \tpathlen = path->len;\n \tstrbuf_addstr(path, name);\n \tif ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)\n-\t\tr = ctx->filter_fn(LOFS_BLOB, obj,\n+\t\tr = ctx->filter_fn(ctx->revs->repo,\n+\t\t\t\t   LOFS_BLOB, obj,\n \t\t\t\t   path->buf, &path->buf[pathlen],\n \t\t\t\t   ctx->filter_data);\n \tif (r & LOFR_MARK_SEEN)\n@@ -175,7 +176,8 @@ static void process_tree(struct traversal_context *ctx,\n \n \tstrbuf_addstr(base, name);\n \tif ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)\n-\t\tr = ctx->filter_fn(LOFS_BEGIN_TREE, obj,\n+\t\tr = ctx->filter_fn(ctx->revs->repo,\n+\t\t\t\t   LOFS_BEGIN_TREE, obj,\n \t\t\t\t   base->buf, &base->buf[baselen],\n \t\t\t\t   ctx->filter_data);\n \tif (r & LOFR_MARK_SEEN)\n@@ -191,7 +193,8 @@ static void process_tree(struct traversal_context *ctx,\n \t\tprocess_tree_contents(ctx, tree, base);\n \n \tif ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn) {\n-\t\tr = ctx->filter_fn(LOFS_END_TREE, obj,\n+\t\tr = ctx->filter_fn(ctx->revs->repo,\n+\t\t\t\t   LOFS_END_TREE, obj,\n \t\t\t\t   base->buf, &base->buf[baselen],\n \t\t\t\t   ctx->filter_data);\n \t\tif (r & LOFR_MARK_SEEN)\n-- \n2.19.1.1231.g84aef82467\n\n"},{"id":"362984","messageId":"b89707b3-515c-7275-8e56-d901a0c64736@redhat.com","threadId":"49790","inReplyTo":"20181110054646.10149-2-pclouds@gmail.com","subject":"Re: [PATCH v2] format-patch: respect --stat in cover letter's diffstat","fromName":"Laszlo Ersek","fromEmail":"lersek@redhat.com","sentAt":"2018-11-12T10:24:38Z","receivedAt":"2018-11-12T10:24:42Z","isPatch":true,"sender":{"key":"lersek@redhat.com","avatar":null},"body":"On 11/10/18 06:46, Nguyễn Thái Ngọc Duy wrote:\n> Commit 43662b23ab (format-patch: keep cover-letter diffstat wrapped in\n> 72 columns - 2018-01-24) uncondtionally sets stat width to 72 when\n> generating diffstat for the cover letter, ignoring --stat from command\n> line. But it should only do so when stat width is still default\n> (i.e. stat_width == 0).\n> \n> In order to fix this, we should only set stat_width if stat_width is\n> zero. But it will never be. Commit 071dd0ba43 (format-patch: reduce\n> patch diffstat width to 72 - 2018-02-01) makes sure that default stat\n> width will be 72 (ignoring $COLUMNS, but could still be overriden by\n> --stat). So all we need to do here is drop the assignment.\n> \n> Reported-by: Laszlo Ersek <lersek@redhat.com>\n> Helped-by: Leif Lindholm <leif.lindholm@linaro.org>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  builtin/log.c          |  2 --\n>  t/t4052-stat-output.sh | 48 +++++++++++++++++++++++++++++-------------\n>  2 files changed, 33 insertions(+), 17 deletions(-)\n\n* This submission should have been posted as v3, not v2. V2 was posted at\n\nhttps://public-inbox.org/git/20181107164953.24965-1-pclouds@gmail.com/\n\n* Comparing the patch emails, the only difference is that this version\nrenames \"expect.40\" to \"expect.60\". This should have been mentioned in a\ncover letter, or in the Notes section of the current submission.\n\n* In my response to the (original) v2 posting, at\n\nhttps://public-inbox.org/git/f0f95dd0-1a9e-01d0-70f4-3c6d5450df70@redhat.com/\n\nI stated that I didn't try to run the test suite, and gave my T-b (under\nthe circumstances described there). Given that the change in v3 (= this\nsubmission) is limited to the test case, I think my T-b should have been\ncarried forward.\n\nThanks\nLaszlo\n\n\n\n> diff --git a/builtin/log.c b/builtin/log.c\n> index 061d4fd864..1a39c6e52a 100644\n> --- a/builtin/log.c\n> +++ b/builtin/log.c\n> @@ -1009,8 +1009,6 @@ static void show_diffstat(struct rev_info *rev,\n>  \n>  \tmemcpy(&opts, &rev->diffopt, sizeof(opts));\n>  \topts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;\n> -\topts.stat_width = MAIL_DEFAULT_WRAP;\n> -\n>  \tdiff_setup_done(&opts);\n>  \n>  \tdiff_tree_oid(get_commit_tree_oid(origin),\n> diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\n> index 6e2cf933f7..28c053849a 100755\n> --- a/t/t4052-stat-output.sh\n> +++ b/t/t4052-stat-output.sh\n> @@ -44,42 +44,50 @@ show --stat\n>  log -1 --stat\n>  EOF\n>  \n> -while read cmd args\n> +cat >expect.60 <<-'EOF'\n> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> +EOF\n> +cat >expect.6030 <<-'EOF'\n> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> +EOF\n> +cat >expect2.60 <<-'EOF'\n> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> +EOF\n> +cat >expect2.6030 <<-'EOF'\n> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> +EOF\n> +while read expect cmd args\n>  do\n> -\tcat >expect <<-'EOF'\n> -\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> -\tEOF\n>  \ttest_expect_success \"$cmd --stat=width: a long name is given more room when the bar is short\" '\n>  \t\tgit $cmd $args --stat=40 >output &&\n>  \t\tgrep \" | \" output >actual &&\n> -\t\ttest_cmp expect actual\n> +\t\ttest_cmp $expect.60 actual\n>  \t'\n>  \n>  \ttest_expect_success \"$cmd --stat-width=width with long name\" '\n>  \t\tgit $cmd $args --stat-width=40 >output &&\n>  \t\tgrep \" | \" output >actual &&\n> -\t\ttest_cmp expect actual\n> +\t\ttest_cmp $expect.60 actual\n>  \t'\n>  \n> -\tcat >expect <<-'EOF'\n> -\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n> -\tEOF\n>  \ttest_expect_success \"$cmd --stat=...,name-width with long name\" '\n>  \t\tgit $cmd $args --stat=60,30 >output &&\n>  \t\tgrep \" | \" output >actual &&\n> -\t\ttest_cmp expect actual\n> +\t\ttest_cmp $expect.6030 actual\n>  \t'\n>  \n>  \ttest_expect_success \"$cmd --stat-name-width with long name\" '\n>  \t\tgit $cmd $args --stat-name-width=30 >output &&\n>  \t\tgrep \" | \" output >actual &&\n> -\t\ttest_cmp expect actual\n> +\t\ttest_cmp $expect.6030 actual\n>  \t'\n>  done <<\\EOF\n> -format-patch -1 --stdout\n> -diff HEAD^ HEAD --stat\n> -show --stat\n> -log -1 --stat\n> +expect2 format-patch --cover-letter -1 --stdout\n> +expect diff HEAD^ HEAD --stat\n> +expect show --stat\n> +expect log -1 --stat\n>  EOF\n>  \n>  \n> @@ -95,6 +103,16 @@ test_expect_success 'preparation for big change tests' '\n>  \tgit commit -m message abcd\n>  '\n>  \n> +cat >expect72 <<'EOF'\n> + abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n> + abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n> +EOF\n> +test_expect_success \"format-patch --cover-letter ignores COLUMNS (big change)\" '\n> +\tCOLUMNS=200 git format-patch -1 --stdout --cover-letter >output &&\n> +\tgrep \" | \" output >actual &&\n> +\ttest_cmp expect72 actual\n> +'\n> +\n>  cat >expect72 <<'EOF'\n>   abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  EOF\n> \n\n"}]}