在 GUI 中单击 Repository/Compress 数据库时执行的 git 命令究竟是什么($git gui)
What are exactly git commands executed while clicking Repository/Compress Database in GUI ($git gui)
我想知道在 GUI ($git gui) 中单击 Repository/Compress 数据库时执行的 git 命令到底是什么
有人可以写下这个菜单选项中执行的内容吗?
不知道是否有跟踪命令的方法 运行,您可以尝试在启动时激活 git
's tracing env variables 之一 git gui
:
GIT_TRACE=1 git gui
然而,该代码实际上是可以访问的:查看 git
存储库中的 git-gui/git-gui.sh
文件。
- 搜索
Compress database
导致 that file,
- 正在搜索
do_gc
到 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}
}
}
(注意 : 链接到来自 branch master
on 2021-12-19 状态的代码)
我检查了 sources,这是它的作用:
${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}
所以有趣的部分(git 命令)是:
git pack-refs --prune
git reflog expire --all
git repack -a -d -l
git rerere gc
strace -qqv -f -e execve -e signal=\!all git gui
将向您确切展示 git gui
及其所有子级 exec,稍微清理一下(在 vim 中是 :set nowrap|g/execve(/.,/ = 0$/j
)让我看到
[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]$
我想知道在 GUI ($git gui) 中单击 Repository/Compress 数据库时执行的 git 命令到底是什么
有人可以写下这个菜单选项中执行的内容吗?
不知道是否有跟踪命令的方法 运行,您可以尝试在启动时激活 git
's tracing env variables 之一 git gui
:
GIT_TRACE=1 git gui
然而,该代码实际上是可以访问的:查看 git
存储库中的 git-gui/git-gui.sh
文件。
- 搜索
Compress database
导致 that file, - 正在搜索
do_gc
到 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}
}
}
(注意 : 链接到来自 branch master
on 2021-12-19 状态的代码)
我检查了 sources,这是它的作用:
${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}
所以有趣的部分(git 命令)是:
git pack-refs --prune
git reflog expire --all
git repack -a -d -l
git rerere gc
strace -qqv -f -e execve -e signal=\!all git gui
将向您确切展示 git gui
及其所有子级 exec,稍微清理一下(在 vim 中是 :set nowrap|g/execve(/.,/ = 0$/j
)让我看到
[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]$