Re: What's cooking in git.git (Nov 2018, #03; Wed, 7)

2018-11-07 Thread Duy Nguyen
On Wed, Nov 7, 2018 at 2:09 PM SZEDER Gábor  wrote:
>
> On Wed, Nov 07, 2018 at 06:41:45PM +0900, Junio C Hamano wrote:
> > * nd/i18n (2018-11-06) 16 commits
> >  - fsck: mark strings for translation
> >  - fsck: reduce word legos to help i18n
> >  - parse-options.c: mark more strings for translation
> >  - parse-options.c: turn some die() to BUG()
> >  - parse-options: replace opterror() with optname()
> >  - repack: mark more strings for translation
> >  - remote.c: mark messages for translation
> >  - remote.c: turn some error() or die() to BUG()
> >  - reflog: mark strings for translation
> >  - read-cache.c: add missing colon separators
> >  - read-cache.c: mark more strings for translation
> >  - read-cache.c: turn die("internal error") to BUG()
> >  - attr.c: mark more string for translation
> >  - archive.c: mark more strings for translation
> >  - alias.c: mark split_cmdline_strerror() strings for translation
> >  - git.c: mark more strings for translation
> >
> >  More _("i18n") markings.
>
> When this patch is merged into 'pu' all four tests added to
> 't1450-fsck.sh' in b29759d89a (fsck: check HEAD and reflog from other
> worktrees, 2018-10-21) as part of 'nd/per-worktree-ref-iteration'
> below fail when run with GETTEXT_POISON=y.  The test suite passes in
> both of these topics on their own, even with GETTEXT_POISON, it's
> their merge that is somehow problematic.

Not surprising. The i18n series makes fsck output localized strings
and without updating grep to test_i18ngrep, new tests will fail. If
'pu' was passing before, I'm ok with just ejecting this series for
now. Then I wait for the other to land, rebase, fixup and resubmit.
-- 
Duy


Git Test Coverage Report (Wednesday, Nov 7)

2018-11-07 Thread Derrick Stolee

Here is the coverage report for today.

Thanks,

-Stolee

[1] https://dev.azure.com/git/git/_build/results?buildId=251=logs

---

pu: 381b31f0006e46fe041e7fc6e5f7b19da5ccd889
jch: ab76604d6537afa18c9d8588c08f699c1f539659
next: 8438c0b2453a7207c9c45756f5e37dfe283db602
master: 8858448bb49332d353febc078ce4a3abcc962efe
master@{1}: d582ea202b626dcc6c3b01e1e11a296d9badd730

Uncovered code in 'pu' not in 'jch'
--

builtin/blame.c
381b31f000 builtin/blame.c    200) 
repo_unuse_commit_buffer(the_repository, commit, message);
74e8221b52 builtin/blame.c    928) blame_date_width = sizeof("Thu Oct 19 
16:00");

74e8221b52 builtin/blame.c    929) break;

builtin/describe.c
381b31f000 builtin/describe.c 257) repo_parse_commit(the_repository, p);

builtin/pack-objects.c
381b31f000 builtin/pack-objects.c 2832) if 
(!repo_has_object_file(the_repository, >oid) && 
is_promisor_object(>oid))


date.c
74e8221b52  113) die("Timestamp too large for this system: %"PRItime, time);
74e8221b52  216) if (tm->tm_mon == human_tm->tm_mon) {
74e8221b52  217) if (tm->tm_mday > human_tm->tm_mday) {
74e8221b52  219) } else if (tm->tm_mday == human_tm->tm_mday) {
74e8221b52  220) hide.date = hide.wday = 1;
74e8221b52  221) } else if (tm->tm_mday + 5 > human_tm->tm_mday) {
74e8221b52  223) hide.date = 1;
74e8221b52  231) gettimeofday(, NULL);
74e8221b52  232) show_date_relative(time, tz, , buf);
74e8221b52  233) return;
74e8221b52  246) hide.seconds = 1;
74e8221b52  247) hide.tz |= !hide.date;
74e8221b52  248) hide.wday = hide.time = !hide.year;
74e8221b52  262) strbuf_rtrim(buf);
74e8221b52  287) gettimeofday(, NULL);
74e8221b52  290) human_tz = local_time_tzoffset(now.tv_sec, _tm);
74e8221b52  886) static int auto_date_style(void)
74e8221b52  888) return (isatty(1) || pager_in_use()) ? DATE_HUMAN : 
DATE_NORMAL;

74e8221b52  909) return DATE_HUMAN;
74e8221b52  911) return auto_date_style();

diff.c
b613de67c4  316) ret |= COLOR_MOVED_WS_ERROR;
b613de67c4  348) unsigned cm = parse_color_moved_ws(value);
b613de67c4  349) if (cm & COLOR_MOVED_WS_ERROR)

fast-import.c
381b31f000 2935) buf = repo_read_object_file(the_repository, oid, , 
);

381b31f000 3041) buf = repo_read_object_file(the_repository, oid, ,

fsck.c
381b31f000  858) repo_unuse_commit_buffer(the_repository, commit, buffer);
381b31f000  878) repo_read_object_file(the_repository,
381b31f000  879)   >object.oid, , );

http-push.c
381b31f000 1635) if (!repo_has_object_file(the_repository, _oid))
381b31f000 1642) if (!repo_has_object_file(the_repository, 
_ref->old_oid))


negotiator/default.c
381b31f000  71) if (repo_parse_commit(the_repository, commit))

remote.c
879b6a9e6f 1140) return error(_("dst ref %s receives from more than one 
src."),


revision.c
381b31f000  726) if (repo_parse_commit(the_repository, p) < 0)

sequencer.c
381b31f000 1624) repo_unuse_commit_buffer(the_repository, head_commit,
381b31f000 3868) repo_unuse_commit_buffer(the_repository,

sha1-array.c
bba406749a 91) oidcpy([dst], [src]);

submodule.c
b303ef65e7  524) the_repository->submodule_prefix :
e2419f7e30 1378) strbuf_release();
7454fe5cb6 1501) struct get_next_submodule_task *task = task_cb;
7454fe5cb6 1505) get_next_submodule_task_release(task);
7454fe5cb6 1532) return 0;
7454fe5cb6 1536) goto out;
7454fe5cb6 1551) return 0;

tree.c
381b31f000 108) if (repo_parse_commit(the_repository, commit))

wrapper.c
5efde212fc  70) die("Out of memory, malloc failed (tried to allocate %" 
PRIuMAX " bytes)",
5efde212fc  73) error("Out of memory, malloc failed (tried to allocate 
%" PRIuMAX " bytes)",


Commits introducing uncovered code:
Ævar Arnfjörð Bjarmason  879b6a9e6: i18n: remote.c: mark error(...) 
messages for translation

Junio C Hamano  381b31f00: treewide: apply cocci patch
Linus Torvalds  74e8221b5: Add 'human' date format
Martin Koegler  5efde212f: zlib.c: use size_t for size
Stefan Beller  7454fe5cb: fetch: try fetching submodules if needed 
objects were not fetched
Stefan Beller  b303ef65e: submodule: use submodule repos for object 
lookup
Stefan Beller  b613de67c: diff: differentiate error handling in 
parse_color_moved_ws

Stefan Beller  bba406749: sha1-array: provide oid_array_filter
Stefan Beller  e2419f7e3: submodule: migrate get_next_submodule to 
use repository structs




Uncovered code in 'jch' not in 'next'


apply.c
517fe807d6 4776) BUG_ON_OPT_NEG(unset);
735ca208c5 4830) return -1;

archive.c
8a705c4638 399) die(_("not a valid object name: %s"), name);
8a705c4638 412) die(_("not a tree object: %s"), oid_to_hex());
8a705c4638 422) die(_("current working directory is untracked"));

attr.c
aa4fa3fa79  369) fprintf_ln(stderr, _("%s not allowed: %s:%d"),

builtin/am.c
fce5664805 2117) *opt_value = PATCH_FORMAT_UNKNOWN;

builtin/blame.c
517fe807d6 builtin/blame.c    759) BUG_ON_OPT_NEG(unset);

builtin/branch.c
0ecb1fc726 builtin/branch.c 452) die(_("could not resolve HEAD"));

[PATCH v2] format-patch: respect --stat in cover letter's diffstat

2018-11-07 Thread Nguyễn Thái Ngọc Duy
Commit 43662b23ab (format-patch: keep cover-letter diffstat wrapped in
72 columns - 2018-01-24) uncondtionally sets stat width to 72 when
generating diffstat for the cover letter, ignoring --stat from command
line. But it should only do so when stat width is still default
(i.e. stat_width == 0).

In order to fix this, we should only set stat_width if stat_width is
zero. But it will never be. Commit 071dd0ba43 (format-patch: reduce
patch diffstat width to 72 - 2018-02-01) makes sure that default stat
width will be 72 (ignoring $COLUMNS, but could still be overriden by
--stat). So all we need to do here is drop the assignment.

Reported-by: Laszlo Ersek 
Helped-by: Leif Lindholm 
Signed-off-by: Nguyễn Thái Ngọc Duy 
---
 builtin/log.c  |  2 --
 t/t4052-stat-output.sh | 48 +-
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index 061d4fd864..1a39c6e52a 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1009,8 +1009,6 @@ static void show_diffstat(struct rev_info *rev,
 
memcpy(, >diffopt, sizeof(opts));
opts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
-   opts.stat_width = MAIL_DEFAULT_WRAP;
-
diff_setup_done();
 
diff_tree_oid(get_commit_tree_oid(origin),
diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh
index 6e2cf933f7..b1ce0d9b97 100755
--- a/t/t4052-stat-output.sh
+++ b/t/t4052-stat-output.sh
@@ -44,42 +44,50 @@ show --stat
 log -1 --stat
 EOF
 
-while read cmd args
+cat >expect.40 <<-'EOF'
+ ...a | 1 +
+EOF
+cat >expect.6030 <<-'EOF'
+ ...aaa | 1 +
+EOF
+cat >expect2.40 <<-'EOF'
+ ...a | 1 +
+ ...a | 1 +
+EOF
+cat >expect2.6030 <<-'EOF'
+ ...aaa | 1 +
+ ...aaa | 1 +
+EOF
+while read expect cmd args
 do
-   cat >expect <<-'EOF'
-...a | 1 +
-   EOF
test_expect_success "$cmd --stat=width: a long name is given more room 
when the bar is short" '
git $cmd $args --stat=40 >output &&
grep " | " output >actual &&
-   test_cmp expect actual
+   test_cmp $expect.40 actual
'
 
test_expect_success "$cmd --stat-width=width with long name" '
git $cmd $args --stat-width=40 >output &&
grep " | " output >actual &&
-   test_cmp expect actual
+   test_cmp $expect.40 actual
'
 
-   cat >expect <<-'EOF'
-...aaa | 1 +
-   EOF
test_expect_success "$cmd --stat=...,name-width with long name" '
git $cmd $args --stat=60,30 >output &&
grep " | " output >actual &&
-   test_cmp expect actual
+   test_cmp $expect.6030 actual
'
 
test_expect_success "$cmd --stat-name-width with long name" '
git $cmd $args --stat-name-width=30 >output &&
grep " | " output >actual &&
-   test_cmp expect actual
+   test_cmp $expect.6030 actual
'
 done <<\EOF
-format-patch -1 --stdout
-diff HEAD^ HEAD --stat
-show --stat
-log -1 --stat
+expect2 format-patch --cover-letter -1 --stdout
+expect diff HEAD^ HEAD --stat
+expect show --stat
+expect log -1 --stat
 EOF
 
 
@@ -95,6 +103,16 @@ test_expect_success 'preparation for big change tests' '
git commit -m message abcd
 '
 
+cat >expect72 <<'EOF'
+ abcd | 1000 ++
+ abcd | 1000 ++
+EOF
+test_expect_success "format-patch --cover-letter ignores COLUMNS (big change)" 
'
+   COLUMNS=200 git format-patch -1 --stdout --cover-letter >output &&
+   grep " | " output >actual &&
+   test_cmp expect72 actual
+'
+
 cat >expect72 <<'EOF'
  abcd | 1000 ++
 EOF
-- 
2.19.1.1005.gac84295441



Re: [PATCH/RFC] Support --append-trailer in cherry-pick and revert

2018-11-07 Thread Duy Nguyen
On Tue, Nov 6, 2018 at 11:11 PM Jeff King  wrote:
>
> On Tue, Nov 06, 2018 at 06:48:22PM +0100, Ævar Arnfjörð Bjarmason wrote:
>
> > The implementation looks fine to me, but as noted in
> > https://public-inbox.org/git/8736se6qyc@evledraar.gmail.com/ I
> > wonder what the plausible end-game is. That we'll turn this on by
> > default in a few years, and then you can only worry about
> > git-interpret-trailers for repos created as of 2020 or something?
> >
> > Otherwise it seems we'll need to *also* parse out the existing messages
> > we've added.
>
> Could we help the reading scripts by normalizing old and new output via
> interpret-trailers, %(trailers), etc?
>
> I think "(cherry picked from ...)" is already considered a trailer by
> the trailer code. If the caller instructs us to, we could probably
> rewrite it to:
>
>   Cherry-picked-from: ...
>
> in the output. Then the end-game is that scripts should just use
> interpret-trailers, etc, and old and new commits will Just Work.

There is still one thing to settle. "revert -m1" could produce
something like this

This reverts commit , reversing
changes made to .

My proposal produces this

Reverts: ^2

And I can't really convert the former to latter without accessing
object database (probably not a good idea?) to check if SHA2 is the
second parent of SHA1. So either

 - I access object database anyway
 - Generate just "Reverts: " (i.e. losing info) with interpret-trailers
 - Change Reverts: tag to a different output format, or maybe use two
tags instead.
-- 
Duy


<    1   2