threads / discuss / 61447

git-gui: Visualize * History does nothing on macOS

Subject: git-gui: Visualize * History does nothing on macOS

## tl;dr

6 messages between May 9, 2024 and Jun 22, 2024.

replies: 5people: 4as markdown or json

Ilya Kulakov· May 9, 2024, 18:17 UTC · lore
Both "Visualize <branch>'s History" and "Visualize All Branch History" do nothing on macOS. In the terminal it logs:
Error in startup script: 58:103: execution error: Not authorized to send Apple events to System Events. (-1743)
    while executing
"exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes whose unix id is %d to true
        end te..."
    invoked from within
"if {[tk windowingsystem] eq "aqua"} {
    exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes ..."
    (file "/opt/homebrew/bin/gitk" line 12321)
The relevant code at https://github.com/git/git/blob/0f3415f1f8478b05e64db11eb8aaa2915e48fef6/git-gui/git-gui.sh#L271-L279 should not be fatal, because the permission to access "System Events" and arbitrarily manipulate windows is optional.

Best Regards, Ilya Kulakov

Eric Sunshine· May 9, 2024, 19:05 UTC · re: Ilya Kulakov · lore

Re: git-gui: Visualize * History does nothing on macOS

On Thu, May 9, 2024 at 2:17 PM Ilya Kulakov <kulakov.ilya@gmail.com> wrote:
Show 8 quoted lines
> Both "Visualize <branch>'s History" and "Visualize All Branch History" do nothing on macOS. In the terminal it logs:
>
> Error in startup script: 58:103: execution error: Not authorized to send Apple events to System Events. (-1743)
> "if {[tk windowingsystem] eq "aqua"} {
>     exec osascript -e [format {
>         tell application "System Events"
>             set frontmost of processes ..."
>     (file "/opt/homebrew/bin/gitk" line 12321)
The above is reporting that the problem is in the `gitk` script...
> The relevant code at https://github.com/git/git/blob/0f3415f1f8478b05e64db11eb8aaa2915e48fef6/git-gui/git-gui.sh#L271-L279 should not be fatal, because the permission to access "System Events" and arbitrarily manipulate windows is optional.

... but the code you cited here is the git-gui script, which does not experience the same problem because a `catch` block is wrapped around the `exec osascript` invocation.

A patch to fix this problem in `gitk` was posted[1] in 2018 but never got picked up since the `gitk` maintainer seems to have disappeared. Considering that the patch is still relevant, perhaps it might make sense for Junio to pick it up himself and apply it to the Git tree(?).

[1]: https://lore.kernel.org/git/20180724065120.7664-1-sunshine@sunshineco.com/
Stefan Haller· Jun 20, 2024, 14:40 UTC · re: Eric Sunshine · lore

Re: git-gui: Visualize * History does nothing on macOS

On 09.05.24 21:05, Eric Sunshine wrote:
Show 6 quoted lines
> A patch to fix this problem in `gitk` was posted[1] in 2018 but never
> got picked up since the `gitk` maintainer seems to have disappeared.
> Considering that the patch is still relevant, perhaps it might make
> sense for Junio to pick it up himself and apply it to the Git tree(?).
> 
> [1]: https://lore.kernel.org/git/20180724065120.7664-1-sunshine@sunshineco.com/

Whether the patch is still relevant depends on which versions of Tcl/Tk we are supporting. On recent versions, the whole AppleScript business is no longer necessary, windows come to the front correctly without it. So a better patch might be to remove the osascript call entirely.

In my locally patched version of gitk I did that long ago. I don't remember which version of Tcl/Tk I was running back then, but my patch that removes the code is from October 2020.

-Stefan
Eric Sunshine· Jun 21, 2024, 04:35 UTC · re: Stefan Haller · lore

Re: git-gui: Visualize * History does nothing on macOS

On Thu, Jun 20, 2024 at 10:40 AM Stefan Haller <lists@haller-berlin.de> wrote:
Show 12 quoted lines
> On 09.05.24 21:05, Eric Sunshine wrote:
> > A patch to fix this problem in `gitk` was posted[1] in 2018 but never
> > got picked up since the `gitk` maintainer seems to have disappeared.
> > Considering that the patch is still relevant, perhaps it might make
> > sense for Junio to pick it up himself and apply it to the Git tree(?).
> >
> > [1]: https://lore.kernel.org/git/20180724065120.7664-1-sunshine@sunshineco.com/
>
> Whether the patch is still relevant depends on which versions of Tcl/Tk
> we are supporting. On recent versions, the whole AppleScript business is
> no longer necessary, windows come to the front correctly without it. So
> a better patch might be to remove the osascript call entirely.

That's a possibility, though it abandons users stuck on older systems (which may not be a big deal since it's only a minor annoyance if the Gitk window doesn't come to the foreground).

Unfortunately, it seems unlikely that either my 2018 patch or your suggestion will be applied since the Gitk maintainer seems to have disappeared(?)[*].

[*] Interestingly, I just checked git://ozlabs.org/~paulus/gitk and noticed that changes were applied as recently as 2022-02-20, however, the patch I submitted was not one of them.

Stefan Haller· Jun 21, 2024, 06:12 UTC · re: Eric Sunshine · lore

Re: git-gui: Visualize * History does nothing on macOS

On 21.06.24 06:35, Eric Sunshine wrote:
Show 7 quoted lines
> Unfortunately, it seems unlikely that either my 2018 patch or your
> suggestion will be applied since the Gitk maintainer seems to have
> disappeared(?)[*].
> 
> [*] Interestingly, I just checked git://ozlabs.org/~paulus/gitk and
> noticed that changes were applied as recently as 2022-02-20, however,
> the patch I submitted was not one of them.

In 2022, Paul said [1] that he would be willing to pass maintainership to somebody else. Johannes, now that you volunteered to take on git-gui, could you imagine doing the same for gitk? This would be awesome.

-Stefan
[1] https://public-inbox.org/git/YntxL%2FfTplFm8lr6@cleo/
Johannes Sixt· Jun 22, 2024, 07:13 UTC · re: Stefan Haller · lore

Re: git-gui: Visualize * History does nothing on macOS

Am 21.06.24 um 08:12 schrieb Stefan Haller:
> In 2022, Paul said [1] that he would be willing to pass maintainership
> to somebody else. Johannes, now that you volunteered to take on git-gui,
> could you imagine doing the same for gitk? This would be awesome.

I can imagine it, but I'm not yet offering to do so, since I haven't even evolved a git-gui workflow.

-- Hannes

← back to recent threads