drewdeponte / git-ps-rs

Official git-ps Rust implementation - the future of git-ps
https://git-ps.sh
MIT License
79 stars 8 forks source link

show how far stack is behind in gps ls output #234

Closed Alizter closed 8 months ago

Alizter commented 11 months ago

We discussed having a git status -sb like status when doing gps ls on slack. It would be good to both show how many commits we are ahead and how many commits we are behind.

$ git status -sb
## main3...origin/main [ahead 31, behind 15]
drewdeponte commented 9 months ago

Here are my notes I had chillen locally for thils. Figured I would share them.

    // get the merge base between HEAD and the upstream tracking branch (e.g. origin/main) if we
    // were on main

    // if the merge base sha matches the sha of the upstream tracking branch (e.g. origin/main)
    // than the stack is not behind the upstream branch at all, so it would be 0 behind.

    // if the merge base sha does NOT match the sha of the upstream tracking branch (e.g.
    // origin/main) then the stack is behind the upstream branch by some number of commits. To
    // determine the number of commits we would have to walk from the upstream tracking branch
    // (e.g. origin/main) down the tree until we hit the merge base sha, counting the commits
    // along the way. This resulting count is the number of commits that the stack is behind its
    // upstream tracking branch.

    // We may already have something implemented that will facilitate this or may be similar to it.
    // When we do a `gps pull` it initially does a `gps fetch` which if I recall correctly shows
    // the commits that were pulled down and the stack rebased onto or something like that.
drewdeponte commented 8 months ago

This has been integrated into mainline so I am closing this issue.