Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maintenance: do not open console on Windows #1570

Closed
wants to merge 2 commits into from

Conversation

derrickstolee
Copy link

These two patches are cherry-picks of commits that have lived in git-for-windows/git since 2019 when background maintenance was originally introduced.

If we run the core Git project's version of background maintenance on a Windows platform, then each background maintenance run will create a new console window, visible to the user. This is due to quirks around how Windows applications work: they require some parent application and will create a console window if one does not exist.

This is solved by creating a new 'headless-git.exe' executable that knows how to hide its own window. This isn't an appropriate change to make to 'git.exe' since that expects to be run within an existing console or application.

  1. Patch 1 introduces the 'headless-git.exe' executable with the ability to hide its window.
  2. Patch 2 modifies the schtasks integration to use 'headless-git.exe' instead of 'git.exe'.

Thanks,
-Stolee

cc: gitster@pobox.com
cc: johannes.schindelin@gmx.de

On Windows, there are two kinds of executables, console ones and
non-console ones. Git's executables are all console ones.

When launching the former e.g. in a scheduled task, a CMD window pops
up. This is not what we want for the tasks installed via the `git
maintenance` command.

To work around this, let's introduce `headless-git.exe`, which is a
non-console program that does _not_ pop up any window. All it does is to
re-launch `git.exe`, suppressing that console window, passing through
all command-line arguments as-are.

Helped-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Helped-by: Yuyi Wang <Strawberry_Str@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
We just introduced a helper to avoid showing a console window when the
scheduled task runs `git.exe`. Let's actually use it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
@derrickstolee
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 9, 2023

Submitted as pull.1570.git.1691600087.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1570/derrickstolee/headless-git-v1

To fetch this version to local tag pr-1570/derrickstolee/headless-git-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1570/derrickstolee/headless-git-v1

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 9, 2023

This branch is now known as ds/maintenance-on-windows-fix.

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 9, 2023

This patch series was integrated into seen via git@6646ac4.

@gitgitgadget gitgitgadget bot added the seen label Aug 9, 2023
@gitgitgadget
Copy link

gitgitgadget bot commented Aug 10, 2023

This patch series was integrated into seen via git@9d36205.

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 10, 2023

This patch series was integrated into next via git@3d7abef.

@gitgitgadget gitgitgadget bot added the next label Aug 10, 2023
@gitgitgadget
Copy link

gitgitgadget bot commented Aug 10, 2023

This patch series was integrated into seen via git@2c472f0.

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 11, 2023

There was a status update in the "New Topics" section about the branch ds/maintenance-on-windows-fix on the Git mailing list:

Windows updates.

Will merge to 'master'.
source: <pull.1570.git.1691600087.gitgitgadget@gmail.com>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants