Skip to content

Git dumb terminal - #8962

Merged
outofambit merged 4 commits into
developmentfrom
git-dumb-terminal
Jan 23, 2020
Merged

outofambit merged 4 commits into
developmentfrom
git-dumb-terminal

Conversation

@niik

@niik niik commented Jan 23, 2020

Copy link
Copy Markdown
Member

Description

TL;DR: Our update to Git 2.23 broke our progress parsing

While testing yesterday's beta release I noticed that progress bars in the app didn't seem to behave normally and spotted some odd characters in the description text.

image

image

This [K prefix comes from a change made in Git 2.22.1 which was reverted in Git 2.24.0. Unfortunately we (I) up and decided to upgrade us to Git 2.23 a while back so now we have to deal with this.

The behavior requires that the TERM environment variable is set which, if you launch GitHub Desktop from the terminal (using the github . CLI command which I frequently do) as I frequently do, it will be.

As luck would have it the workaround is pretty straightforward. We can unset the TERM environment variable in order to make the is_terminal_dumb() method in Git return true and thereby reverting us to (almost) the same behavior as we had in 2.19.

This is a prudent change regardless of Git version so we should keep this once we upgrade to 2.24+.

I am unfortunately under the impression that given that this is a regression which we haven't shipped to prod yet we should attempt to land this ahead of the next production release.

Testing notes

  1. Close all open GitHub Desktop processes (including any dev environment you may have open).
  2. Launch GitHub Desktop from the terminal using either github or open -a "GitHub Desktop"
  3. Verify that the TERM environment variable is set in devtools
    image
  4. Clone a large enough repository (atom/atom is a good bet) that you can monitor the clone progress and verify that the progress bar doesn't update as it should and that the subtext starts with [K.

Release notes

Notes: [Fixed] Progress bars failed to update properly when Desktop was launched from a terminal.

niik added 3 commits January 23, 2020 09:09
In between Git 2.22.1[1] and 2.24.0[2] Git attempted to use a different method of clearing the last line in the terminal for non-dumb terminals. While that change was reverted in 2.24 we're currently on 2.23 and have to deal with it.

The side effects of this for us is that our progress parsing has stopped working and that Git error messages are littered with lines starting with "[K" which at best will be confusing to users.

Setting TERM to 'dumb' effectively reverts the behavior to what we're used to (see https://github.com/git/git/blob/a7312d1a28ff3ab0a5a5427b35f01d943103cba8/editor.c#L11-L15).

1. git/git@5b12e31#diff-cf9e2e00bf41dfd6ab5e3e60149405dd
2. git/git@bbf4756#diff-cf9e2e00bf41dfd6ab5e3e60149405dd
@outofambit outofambit self-assigned this Jan 23, 2020
@outofambit
outofambit merged commit 980bdbf into development Jan 23, 2020
@outofambit
outofambit deleted the git-dumb-terminal branch January 23, 2020 23:12
niik added a commit that referenced this pull request Jan 29, 2020
On Windows we apparently have to explicitly set it to 'dumb' for the is_terminal_dumb check to return true. See #8962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants