Home > Mobile >  What are exactly git commands executed while clicking Repository/Compress Database in GUI ($git gui)
What are exactly git commands executed while clicking Repository/Compress Database in GUI ($git gui)

Time:12-20

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? enter image description here

CodePudding user response:

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.

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)

CodePudding user response:

I check 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

  • Related