Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-vcs/git/, dev-vcs/git/files/
Date: Sat, 26 Oct 2019 12:55:06
Message-Id: 1572094474.23dafc624b8f4269cd3da2104528cb5fa3cda81d.polynomial-c@gentoo
1 commit: 23dafc624b8f4269cd3da2104528cb5fa3cda81d
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 26 12:54:34 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 26 12:54:34 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23dafc62
7
8 dev-vcs/git: Revbump to avoid empty "remote" output from git servers
9
10 Bumped straight to stable
11
12 Thanks-to: David Flogeras <dflogeras2 <AT> gmail.com>
13 Closes: https://bugs.gentoo.org/698384
14 Package-Manager: Portage-2.3.78, Repoman-2.3.17
15 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
16
17 .../files/git-2.23.0-avoid_empty_remote_line.patch | 145 +++++++++++++++++++++
18 .../{git-2.23.0.ebuild => git-2.23.0-r1.ebuild} | 2 +
19 2 files changed, 147 insertions(+)
20
21 diff --git a/dev-vcs/git/files/git-2.23.0-avoid_empty_remote_line.patch b/dev-vcs/git/files/git-2.23.0-avoid_empty_remote_line.patch
22 new file mode 100644
23 index 00000000000..f2bc3fd634e
24 --- /dev/null
25 +++ b/dev-vcs/git/files/git-2.23.0-avoid_empty_remote_line.patch
26 @@ -0,0 +1,145 @@
27 +From bbf47568ad7e91ab0962b314c054a2da03232c72 Mon Sep 17 00:00:00 2001
28 +From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= <szeder.dev@×××××.com>
29 +Date: Mon, 16 Sep 2019 22:54:11 +0200
30 +Subject: [PATCH] Revert "progress: use term_clear_line()"
31 +MIME-Version: 1.0
32 +Content-Type: text/plain; charset=UTF-8
33 +Content-Transfer-Encoding: 8bit
34 +
35 +This reverts commit 5b12e3123b (progress: use term_clear_line(),
36 +2019-06-24), because covering up the entire last line while refreshing
37 +the progress line caused unexpected problems during 'git
38 +clone/fetch/push':
39 +
40 + $ git clone ssh://localhost/home/szeder/src/tmp/linux.git/
41 + Cloning into 'linux'...
42 + remote:
43 + remote:
44 + remote:
45 + remote: Enumerating objects: 999295
46 +
47 +The length of the progress bar line can shorten when it includes
48 +throughput and the unit changes, or when its length exceeds the width
49 +of the terminal and is broken into two lines. In these cases the
50 +previously displayed longer progress line should be covered up,
51 +because otherwise the leftover characters from the previous progress
52 +line make the output look weird [1]. term_clear_line() makes this
53 +quite simple, as it covers up the entire last line either by using an
54 +ANSI control sequence or by printing a terminal width worth of space
55 +characters, depending on whether the terminal is smart or dumb.
56 +
57 +Unfortunately, when accessing a remote repository via any non-local
58 +protocol the remote 'git receive-pack/upload-pack' processes can't
59 +possibly have any idea about the local terminal (smart of dumb? how
60 +wide?) their progress will end up on. Consequently, they assume the
61 +worst, i.e. standard-width dumb terminal, and print 80 spaces to cover
62 +up the previously displayed progress line. The local 'git
63 +clone/fetch/push' processes then display the remote's progress,
64 +including these coverup spaces, with the 'remote: ' prefix, resulting
65 +in a total line length of 88 characters. If the local terminal is
66 +narrower than that, then the coverup gets line-wrapped, and after that
67 +the CR at the end doesn't return to the beginning of the progress
68 +line, but to the first column of its last line, resulting in those
69 +repeated 'remote: <many-spaces>' lines.
70 +
71 +By reverting 5b12e3123b (progress: use term_clear_line(),
72 +2019-06-24) we won't cover up the entire last line, but go back to
73 +comparing the length of the current progress bar line with the
74 +previous one, and cover up as many characters as needed.
75 +
76 +[1] See commits 545dc345eb (progress: break too long progress bar
77 + lines, 2019-04-12) and 9f1fd84e15 (progress: clear previous
78 + progress update dynamically, 2019-04-12).
79 +
80 +Signed-off-by: SZEDER Gábor <szeder.dev@×××××.com>
81 +Signed-off-by: Junio C Hamano <gitster@×××××.com>
82 +---
83 + progress.c | 29 ++++++++++++++++++-----------
84 + t/t5541-http-push-smart.sh | 6 +++---
85 + 2 files changed, 21 insertions(+), 14 deletions(-)
86 +
87 +diff --git a/progress.c b/progress.c
88 +index 277db8afa2..0eddf1804d 100644
89 +--- a/progress.c
90 ++++ b/progress.c
91 +@@ -88,6 +88,7 @@ static void display(struct progress *progress, uint64_t n, const char *done)
92 + const char *tp;
93 + struct strbuf *counters_sb = &progress->counters_sb;
94 + int show_update = 0;
95 ++ int last_count_len = counters_sb->len;
96 +
97 + if (progress->delay && (!progress_update || --progress->delay))
98 + return;
99 +@@ -115,21 +116,27 @@ static void display(struct progress *progress, uint64_t n, const char *done)
100 + if (show_update) {
101 + if (is_foreground_fd(fileno(stderr)) || done) {
102 + const char *eol = done ? done : "\r";
103 ++ size_t clear_len = counters_sb->len < last_count_len ?
104 ++ last_count_len - counters_sb->len + 1 :
105 ++ 0;
106 ++ /* The "+ 2" accounts for the ": ". */
107 ++ size_t progress_line_len = progress->title_len +
108 ++ counters_sb->len + 2;
109 ++ int cols = term_columns();
110 +
111 +- term_clear_line();
112 + if (progress->split) {
113 +- fprintf(stderr, " %s%s", counters_sb->buf,
114 +- eol);
115 +- } else if (!done &&
116 +- /* The "+ 2" accounts for the ": ". */
117 +- term_columns() < progress->title_len +
118 +- counters_sb->len + 2) {
119 +- fprintf(stderr, "%s:\n %s%s",
120 +- progress->title, counters_sb->buf, eol);
121 ++ fprintf(stderr, " %s%*s", counters_sb->buf,
122 ++ (int) clear_len, eol);
123 ++ } else if (!done && cols < progress_line_len) {
124 ++ clear_len = progress->title_len + 1 < cols ?
125 ++ cols - progress->title_len - 1 : 0;
126 ++ fprintf(stderr, "%s:%*s\n %s%s",
127 ++ progress->title, (int) clear_len, "",
128 ++ counters_sb->buf, eol);
129 + progress->split = 1;
130 + } else {
131 +- fprintf(stderr, "%s: %s%s", progress->title,
132 +- counters_sb->buf, eol);
133 ++ fprintf(stderr, "%s: %s%*s", progress->title,
134 ++ counters_sb->buf, (int) clear_len, eol);
135 + }
136 + fflush(stderr);
137 + }
138 +diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
139 +index b86ddb60f2..92bac43257 100755
140 +--- a/t/t5541-http-push-smart.sh
141 ++++ b/t/t5541-http-push-smart.sh
142 +@@ -262,7 +262,7 @@ test_expect_success TTY 'push shows progress when stderr is a tty' '
143 + cd "$ROOT_PATH"/test_repo_clone &&
144 + test_commit noisy &&
145 + test_terminal git push >output 2>&1 &&
146 +- test_i18ngrep "Writing objects" output
147 ++ test_i18ngrep "^Writing objects" output
148 + '
149 +
150 + test_expect_success TTY 'push --quiet silences status and progress' '
151 +@@ -277,7 +277,7 @@ test_expect_success TTY 'push --no-progress silences progress but not status' '
152 + test_commit no-progress &&
153 + test_terminal git push --no-progress >output 2>&1 &&
154 + test_i18ngrep "^To http" output &&
155 +- test_i18ngrep ! "Writing objects" output
156 ++ test_i18ngrep ! "^Writing objects" output
157 + '
158 +
159 + test_expect_success 'push --progress shows progress to non-tty' '
160 +@@ -285,7 +285,7 @@ test_expect_success 'push --progress shows progress to non-tty' '
161 + test_commit progress &&
162 + git push --progress >output 2>&1 &&
163 + test_i18ngrep "^To http" output &&
164 +- test_i18ngrep "Writing objects" output
165 ++ test_i18ngrep "^Writing objects" output
166 + '
167 +
168 + test_expect_success 'http push gives sane defaults to reflog' '
169 +--
170 +2.24.0.rc1
171 +
172
173 diff --git a/dev-vcs/git/git-2.23.0.ebuild b/dev-vcs/git/git-2.23.0-r1.ebuild
174 similarity index 99%
175 rename from dev-vcs/git/git-2.23.0.ebuild
176 rename to dev-vcs/git/git-2.23.0-r1.ebuild
177 index 3e7e6b8ec66..ec95d334218 100644
178 --- a/dev-vcs/git/git-2.23.0.ebuild
179 +++ b/dev-vcs/git/git-2.23.0-r1.ebuild
180 @@ -144,6 +144,8 @@ PATCHES=(
181
182 # Make submodule output quiet
183 "${FILESDIR}"/git-2.21.0-quiet-submodules-testcase.patch
184 +
185 + "${FILESDIR}"/${P}-avoid_empty_remote_line.patch #698384
186 )
187
188 pkg_setup() {