<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/editor.c, branch gitk-resize-error</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=gitk-resize-error</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=gitk-resize-error'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2021-11-26T06:15:08Z</updated>
<entry>
<title>run-command API: remove "env" member, always use "env_array"</title>
<updated>2021-11-26T06:15:08Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-11-25T22:52:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c7c4bdeccf3e737e6e674cd9f0828922e629ab06'/>
<id>urn:sha1:c7c4bdeccf3e737e6e674cd9f0828922e629ab06</id>
<content type='text'>
Remove the "env" member from "struct child_process" in favor of always
using the "env_array". As with the preceding removal of "argv" in
favor of "args" this gets rid of current and future oddities around
memory management at the API boundary (see the amended API docs).

For some of the conversions we can replace patterns like:

    child.env = env-&gt;v;

With:

    strvec_pushv(&amp;child.env_array, env-&gt;v);

But for others we need to guard the strvec_pushv() with a NULL check,
since we're not passing in the "v" member of a "struct strvec",
e.g. in the case of tmp_objdir_env()'s return value.

Ideally we'd rename the "env_array" member to simply "env" as a
follow-up, since it and "args" are now inconsistent in not having an
"_array" suffix, and seemingly without any good reason, unless we look
at the history of how they came to be.

But as we've currently got 122 in-tree hits for a "git grep env_array"
let's leave that for now (and possibly forever). Doing that rename
would be too disruptive.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command API users: use strvec_pushl(), not argv construction</title>
<updated>2021-11-26T06:15:07Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-11-25T22:52:20Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=2b7098936c9e91d527aa53b8d4af0b25d7e912b4'/>
<id>urn:sha1:2b7098936c9e91d527aa53b8d4af0b25d7e912b4</id>
<content type='text'>
Change a pattern of hardcoding an "argv" array size, populating it and
assigning to the "argv" member of "struct child_process" to instead
use "strvec_pushl()" to add data to the "args" member.

This implements the same behavior as before in fewer lines of code,
and moves us further towards being able to remove the "argv" member in
a subsequent commit.

Since we've entirely removed the "argv" variable(s) we can be sure
that no potential logic errors of the type discussed in a preceding
commit are being introduced here, i.e. ones where the local "argv" was
being modified after the assignment to "struct child_process"'s
"argv".

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/save-restore-terminal-revert'</title>
<updated>2021-11-23T02:40:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-11-23T02:40:11Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4150a1677bef6e1e42fd089e784a937f57a5c44b'/>
<id>urn:sha1:4150a1677bef6e1e42fd089e784a937f57a5c44b</id>
<content type='text'>
Regression fix for 2.34

* jc/save-restore-terminal-revert:
  Revert "editor: save and reset terminal after calling EDITOR"
</content>
</entry>
<entry>
<title>Revert "editor: save and reset terminal after calling EDITOR"</title>
<updated>2021-11-22T23:04:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-11-22T23:04:20Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=e3f7e01b50be94bfe6cf35b2f1e01ab75804d8d8'/>
<id>urn:sha1:e3f7e01b50be94bfe6cf35b2f1e01ab75804d8d8</id>
<content type='text'>
This reverts commit 3d411afabc9a96f41d47c07d6af6edda3d29ec92,
blindly opening /dev/tty and calling tcsetattr() seems to be causing
problems.

cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=577358
cf. https://lore.kernel.org/git/04ab7301-ea34-476c-eae4-4044fef74b91@gmail.com/

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cm/save-restore-terminal'</title>
<updated>2021-10-18T22:47:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-10-18T22:47:57Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=853ec9aa9be1b467986dd86ffc36c1c8580a6789'/>
<id>urn:sha1:853ec9aa9be1b467986dd86ffc36c1c8580a6789</id>
<content type='text'>
An editor session launched during a Git operation (e.g. during 'git
commit') can leave the terminal in a funny state.  The code path
has updated to save the terminal state before, and restore it
after, it spawns an editor.

* cm/save-restore-terminal:
  editor: save and reset terminal after calling EDITOR
  terminal: teach git how to save/restore its terminal settings
</content>
</entry>
<entry>
<title>editor: save and reset terminal after calling EDITOR</title>
<updated>2021-10-06T15:53:03Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2021-10-05T07:46:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3d411afabc9a96f41d47c07d6af6edda3d29ec92'/>
<id>urn:sha1:3d411afabc9a96f41d47c07d6af6edda3d29ec92</id>
<content type='text'>
When EDITOR is invoked to modify a commit message, it will likely
change the terminal settings, and if it misbehaves will leave the
terminal output damaged as shown in a recent report from Windows
Terminal[1]

Instead use the functions provided by compat/terminal to save the
settings and recover safely.

[1] https://github.com/microsoft/terminal/issues/9359

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>advice: remove read uses of most global `advice_` variables</title>
<updated>2021-08-25T19:07:52Z</updated>
<author>
<name>Ben Boeckel</name>
<email>mathstuf@gmail.com</email>
</author>
<published>2021-08-23T10:44:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=ed9bff0817d5a7500b50a39c1c35b44aa3e72578'/>
<id>urn:sha1:ed9bff0817d5a7500b50a39c1c35b44aa3e72578</id>
<content type='text'>
In c4a09cc9ccb (Merge branch 'hw/advise-ng', 2020-03-25), a new API for
accessing advice variables was introduced and deprecated `advice_config`
in favor of a new array, `advice_setting`.

This patch ports all but two uses which read the status of the global
`advice_` variables over to the new `advice_enabled` API. We'll deal
with advice_add_embedded_repo and advice_graft_file_deprecated
separately.

Signed-off-by: Ben Boeckel &lt;mathstuf@gmail.com&gt;
Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: fix leaks from git_config_get_string_const()</title>
<updated>2020-08-14T17:52:04Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-08-14T16:17:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=f1de981e8b6dedccf915095792c9afbe3c989591'/>
<id>urn:sha1:f1de981e8b6dedccf915095792c9afbe3c989591</id>
<content type='text'>
There are two functions to get a single config string:

  - git_config_get_string()

  - git_config_get_string_const()

One might naively think that the first one allocates a new string and
the second one just points us to the internal configset storage. But
in fact they both allocate a new copy; the second one exists only to
avoid having to cast when using it with a const global which we never
intend to free.

The documentation for the function explains that clearly, but it seems
I'm not alone in being surprised by this. Of 17 calls to the function,
13 of them leak the resulting value.

We could obviously fix these by adding the appropriate free(). But it
would be simpler still if we actually had a non-allocating way to get
the string. There's git_config_get_value() but that doesn't quite do
what we want. If the config key is present but is a boolean with no
value (e.g., "[foo]bar" in the file), then we'll get NULL (whereas the
string versions will print an error and die).

So let's introduce a new variant, git_config_get_string_tmp(), that
behaves as these callers expect. We need a new name because we have new
semantics but the same function signature (so even if we converted the
four remaining callers, topics in flight might be surprised). The "tmp"
is because this value should only be held onto for a short time. In
practice it's rare for us to clear and refresh the configset,
invalidating the pointer, but hopefully the "tmp" makes callers think
about the lifetime. In each of the converted cases here the value only
needs to last within the local function or its immediate caller.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>real_path: remove unsafe API</title>
<updated>2020-03-10T18:41:40Z</updated>
<author>
<name>Alexandr Miloslavskiy</name>
<email>alexandr.miloslavskiy@syntevo.com</email>
</author>
<published>2020-03-10T13:11:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3d7747e318532a36a263c61cdf92f2decb6424ff'/>
<id>urn:sha1:3d7747e318532a36a263c61cdf92f2decb6424ff</id>
<content type='text'>
Returning a shared buffer invites very subtle bugs due to reentrancy or
multi-threading, as demonstrated by the previous patch.

There was an unfinished effort to abolish this [1].

Let's finally rid of `real_path()`, using `strbuf_realpath()` instead.

This patch uses a local `strbuf` for most places where `real_path()` was
previously called.

However, two places return the value of `real_path()` to the caller. For
them, a `static` local `strbuf` was added, effectively pushing the
problem one level higher:
    read_gitfile_gently()
    get_superproject_working_tree()

[1] https://lore.kernel.org/git/1480964316-99305-1-git-send-email-bmwill@google.com/

Signed-off-by: Alexandr Miloslavskiy &lt;alexandr.miloslavskiy@syntevo.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pager: add a helper function to clear the last line in the terminal</title>
<updated>2019-06-24T20:38:46Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2019-06-24T18:13:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=cd1096b2820d64d5fcb5da20613d5af290e42929'/>
<id>urn:sha1:cd1096b2820d64d5fcb5da20613d5af290e42929</id>
<content type='text'>
There are a couple of places where we want to clear the last line on
the terminal, e.g. when a progress bar line is overwritten by a
shorter line, then the end of that progress line would remain visible,
unless we cover it up.

In 'progress.c' we did this by always appending a fixed number of
space characters to the next line (even if it was not shorter than the
previous), but as it turned out that fixed number was not quite large
enough, see the fix in 9f1fd84e15 (progress: clear previous progress
update dynamically, 2019-04-12).  From then on we've been keeping
track of the length of the last displayed progress line and appending
the appropriate number of space characters to the next line, if
necessary, but, alas, this approach turned out to be error prone, see
the fix in 1aed1a5f25 (progress: avoid empty line when breaking the
progress line, 2019-05-19).  The next patch in this series is about to
fix a case where we don't clear the last line, and on occasion do end
up with such garbage at the end of the line.  It would be great if we
could do that without the need to deal with that without meticulously
computing the necessary number of space characters.

So add a helper function to clear the last line on the terminal using
an ANSI escape sequence, which has the advantage to clear the whole
line no matter how wide it is, even after the terminal width changed.
Such an escape sequence is not available on dumb terminals, though, so
in that case fall back to simply print a whole terminal width (as
reported by term_columns()) worth of space characters.

In 'editor.c' launch_specified_editor() already used this ANSI escape
sequence, so replace it with a call to this function.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
