I would like to know what are exactly git commands executed while clicking Repository/Compress Database in GUI ($git gui)
Is it possible for somebody to write it what is executed in this menu option?

I would like to know what are exactly git commands executed while clicking Repository/Compress Database in GUI ($git gui)
Is it possible for somebody to write it what is executed in this menu option?

I checked the sources, here's what it does :
${NS}::button $w.buttons.gc -text [mc "Compress Database"] \
34 -default normal \
35 -command "destroy $w;do_gc"
// < snip >
proc do_gc {} {
72 set w [console::new {gc} [mc "Compressing the object database"]]
73 console::chain $w {
74 {exec git pack-refs --prune}
75 {exec git reflog expire --all}
76 {exec git repack -a -d -l}
77 {exec git rerere gc}
So the interesting part (git commands) is :
git pack-refs --prune
git reflog expire --all
git repack -a -d -l
git rerere gc
Docs here :
git pack-refs
git reflog
git repack
git rerere
Don't know if there is a way to trace commands as they are run, you may try activating one of git's tracing env variables when launching git gui :
GIT_TRACE=1 git gui
The code, however, is actually accessible : look at the git-gui/git-gui.sh file in git's repo.
Compress database leads to that file,do_gc to that function :proc do_gc {} {
set w [console::new {gc} [mc "Compressing the object database"]]
console::chain $w {
{exec git pack-refs --prune}
{exec git reflog expire --all}
{exec git repack -a -d -l}
{exec git rerere gc}
}
}
(note : links to code from the state of branch master on 2021-12-19)
strace -qqv -f -e execve -e signal=\!all git gui
will show you exactly what git gui and all its children exec, a little cleanup (in vim it's :set nowrap|g/execve(/.,/ = 0$/j) leaves me looking at
[jthill@gadabout tmp.eEjBFrhhXH]$ strace -qqvfeexecve -e signal='!all' git gui
execve("/home/jthill/bin/git", ["git", "gui"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/home/jthill/.co"..., "LESS=FRX", "XDG_SESSION_PATH=/org/freedeskto"...,
[pid 278871] execve("/home/jthill/libexec/git-core/git-gui", ["/home/jthill/libexec/git-core/gi"...], ["CFLAGS=-march=native -pipe -Os ", "COLORTERM=truecolor", "CXXFLAGS=-march=native -pipe -Os"..., "DBUS_SESSION_BUS_ADDRESS=unix:pa"...,
[pid 278871] execve("/usr/bin/wish", ["wish", "/home/jthill/libexec/git-core/gi"..., "--"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/home/jthill/.co"..., "LESS
[pid 278872] execve("/home/jthill/libexec/git-core/git", ["/home/jthill/libexec/git-core/gi"..., "--version"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/home/jt
[pid 278873] execve("/home/jthill/libexec/git-core/git", ["/home/jthill/libexec/git-core/gi"..., "--exec-path"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/home/
[pid 278874] execve("/home/jthill/libexec/git-core/git-rev-parse", ["/home/jthill/libexec/git-core/gi"..., "--git-dir"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIR
[pid 278875] execve("/home/jthill/libexec/git-core/git-rev-parse", ["/home/jthill/libexec/git-core/gi"..., "--show-prefix"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG
[pid 278876] execve("/home/jthill/libexec/git-core/git-config", ["/home/jthill/libexec/git-core/gi"..., "--null", "--list"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG
[pid 278877] execve("/home/jthill/libexec/git-core/git-rev-parse", ["/home/jthill/libexec/git-core/gi"..., "--show-toplevel"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONF
[pid 278878] execve("/home/jthill/libexec/git-core/git-rev-parse", ["/home/jthill/libexec/git-core/gi"..., "--is-bare-repository"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG
[pid 278879] execve("/home/jthill/libexec/git-core/git", ["/home/jthill/libexec/git-core/gi"..., "--html-path"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/home/
[pid 278880] execve("/home/jthill/libexec/git-core/aspell", ["aspell", "--mode=none", "--encoding=utf-8", "pipe"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/hom
[pid 278882] execve("/home/jthill/libexec/git-core/git-rev-parse", ["/home/jthill/libexec/git-core/gi"..., "--verify", "HEAD"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CON
[pid 278883] execve("/home/jthill/libexec/git-core/git-update-index", ["/home/jthill/libexec/git-core/gi"..., "-q", "--unmerged", "--ignore-missing", "--refresh"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=503316
[pid 278892] execve("/home/jthill/libexec/git-core/git-diff-index", ["/home/jthill/libexec/git-core/gi"..., "--cached", "--ignore-submodules=dirty", "-z", "da4cafc2a0046d629716cac96875e1aa"...], ["SHELL=/bin/bash", "SESSION_MANAGER=local/g
[pid 278893] execve("/home/jthill/libexec/git-core/git-diff-files", ["/home/jthill/libexec/git-core/gi"..., "-z"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/hom
[pid 278894] execve("/home/jthill/libexec/git-core/git-ls-files", ["/home/jthill/libexec/git-core/gi"..., "--others", "-z", "--exclude-standard"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=t
[pid 278905] execve("/home/jthill/libexec/git-core/git-pack-refs", ["/home/jthill/libexec/git-core/gi"..., "--prune"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=
[pid 278906] execve("/home/jthill/libexec/git-core/git-reflog", ["/home/jthill/libexec/git-core/gi"..., "expire", "--all"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_
[pid 278914] execve("/home/jthill/libexec/git-core/git-rerere", ["/home/jthill/libexec/git-core/gi"..., "gc"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_CONFIG_DIRS=/home/jt
[pid 278920] execve("/home/jthill/libexec/git-core/git-config", ["/home/jthill/libexec/git-core/gi"..., "gui.wmstate", "normal"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=truecolor", "XDG_C
[pid 278921] execve("/home/jthill/libexec/git-core/git-config", ["/home/jthill/libexec/git-core/gi"..., "gui.geometry", "923x419+997+602 191 190"], ["SHELL=/bin/bash", "SESSION_MANAGER=local/gadabout:@"..., "WINDOWID=50331678", "COLORTERM=
[jthill@gadabout tmp.eEjBFrhhXH]$