powerlevel10k
powerlevel10k copied to clipboard
git branch info disappears after submitting a github pull request
Hello!
I have p10k set up to show git information in my prompt:
![Screenshot 2022-03-29 at 23 18 06](https://user-images.githubusercontent.com/353427/160716266-a71b4211-37b0-4184-a99d-24be47cbf1a3.png)
I've noticed that after I use the official GitHub command line tool to submit a pull request for a branch, the git part of the prompt disappears:
![Screenshot 2022-03-29 at 23 19 47](https://user-images.githubusercontent.com/353427/160716448-8e207612-05e9-41b8-8211-9e55cb03d4a7.png)
Is there something I can do/run to collect some useful information about why this might be happening?
You can try enabling logs with GITSTATUS_LOG_LEVEL=DEBUG
in ~/.zshrc
and then checking them with less $GITSTATUS_DAEMON_LOG_POWERLEVEL9K
.
thanks. I checked out a branch that breaks it, set that debugging variable, spawned a new zsh and this looks to be the relevant portion of the log:
+_gitstatus_daemon_p9k_:63> HOME=/Users/cmsj /Users/cmsj/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.3.1 -s -1 -u -1 -d -1 -c -1 -m -1 -v DEBUG -t 32
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[0]: "/Users/cmsj/.cache/gitstatus/gitstatusd-darwin-x86_64"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[1]: "-G"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[2]: "v1.3.1"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[3]: "-s"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[4]: "-1"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[5]: "-u"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[6]: "-1"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[7]: "-d"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[8]: "-1"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[9]: "-c"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[10]: "-1"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[11]: "-m"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[12]: "-1"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[13]: "-v"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[14]: "DEBUG"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[15]: "-t"
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:177] argv[16]: "32"
[2022-03-30 11:09:00 0000000110499600 INFO src/thread_pool.cc:81] Spawning 32 thread(s)
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:192] Processing request: "}hello" for ""
[2022-03-30 11:09:00 0000000110499600 INFO src/response.cc:69] Replying without git status
[2022-03-30 11:09:00 0000000110499600 INFO src/timer.cc:64] Timing for: request: 0.031ms cpu
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:195] Successfully processed request: "}hello" for ""
+_gitstatus_daemon_p9k_:93> [[ -e /private/var/folders/p8/3nv05bxx1p5b2bhp9fdngy1w0000gn/T/gitstatus.POWERLEVEL9K.501.2551.1648634939.1.lock ]]
[2022-03-30 11:09:00 0000000110499600 INFO src/gitstatus.cc:192] Processing request: "1648634940.0264639854 _p9k_vcs_resume 0" for "/Users/cmsj/hacking/hammerspoon/hammerspoon" [no-diff]
[2022-03-30 11:09:00 0000000110499600 INFO src/repo_cache.cc:132] Initializing new repository: "/Users/cmsj/hacking/hammerspoon/hammerspoon/.git/"
[2022-03-30 11:09:00 0000000110499600 ERROR src/git.cc:207] std::strstr(branch, name.c_str()) == branch:
[2022-03-30 11:09:00 0000700000c75000 INFO src/tag_db.cc:188] Parsing "/Users/cmsj/hacking/hammerspoon/hammerspoon/.git/packed-refs"
[2022-03-30 11:09:00 0000000110499600 INFO src/response.cc:69] Replying without git status
[2022-03-30 11:09:00 0000000110499600 INFO src/timer.cc:64] Timing for: request: 3.339ms cpu
[2022-03-30 11:09:00 0000000110499600 ERROR src/gitstatus.cc:197] Error processing request: "1648634940.0264639854 _p9k_vcs_resume 0" for "/Users/cmsj/hacking/hammerspoon/hammerspoon" [no-diff]
[2022-03-30 11:09:01 0000700000bf2000 INFO src/check_dir_mtime.cc:149] All mtime checks have passes. Enabling untracked cache: "/Users/cmsj/hacking/hammerspoon/hammerspoon/.git/"
[2022-03-30 11:10:06 0000000110499600 INFO src/gitstatus.cc:192] Processing request: "1648635006.5338010788 _p9k_vcs_resume 0" for "/Users/cmsj/hacking/hammerspoon/hammerspoon" [no-diff]
[2022-03-30 11:10:06 0000000110499600 ERROR src/git.cc:207] std::strstr(branch, name.c_str()) == branch:
[2022-03-30 11:10:06 0000000110499600 INFO src/response.cc:69] Replying without git status
[2022-03-30 11:10:06 0000000110499600 INFO src/timer.cc:64] Timing for: request: 1.33ms cpu
[2022-03-30 11:10:06 0000000110499600 ERROR src/gitstatus.cc:197] Error processing request: "1648635006.5338010788 _p9k_vcs_resume 0" for "/Users/cmsj/hacking/hammerspoon/hammerspoon" [no-diff]
What's the branch name and what is it tracking?
❯ gb -vv | grep add-screen-serial
* add-screen-serial f11d64b5f [github/add-screen-serial] Preserve binary fields when converting display info to Lua types
Edit: if it's relevant, github
is not a remote that I've configured, I assume that's something gh
is doing:
❯ grv
cmsj ssh://[email protected]/cmsj/hammerspoon (fetch)
cmsj ssh://[email protected]/cmsj/hammerspoon (push)
cp [email protected]:CommandPost/CommandPost-App (fetch)
cp [email protected]:CommandPost/CommandPost-App (push)
latenitefilms https://github.com/latenitefilms/hammerspoon (fetch)
latenitefilms https://github.com/latenitefilms/hammerspoon (push)
origin ssh://[email protected]/hammerspoon/hammerspoon (fetch)
origin ssh://[email protected]/hammerspoon/hammerspoon (push)
origin_https https://[email protected]/hammerspoon/hammerspoon (fetch)
origin_https https://[email protected]/hammerspoon/hammerspoon (push)
upstream [email protected]:hammerspoon/hammerspoon.git (fetch)
upstream [email protected]:hammerspoon/hammerspoon.git (push)
So, your branch is tracking a remote branch from a remote that doesn't exist.
Naturally, it would be nice if gitstatusd didn't error out in this case. I should fix that. In the meantime you can work around this problem by adding "github" remote or removing the tracking branch.
Hmm, I wonder if there is deeper magic at work here. I added a github
remote and it didn't improve things, then I noticed:
❯ g config --get-regexp "^branch\\.$(git branch --show-current)\\." | cat
branch.add-screen-serial.remote upstream
branch.add-screen-serial.merge refs/heads/add-screen-serial
which suggests the remote is upstream
which existed already. The gitstatusd error is also the same:
[2022-03-30 12:07:50 000000010c4f9600 ERROR src/git.cc:207] std::strstr(branch, name.c_str()) == branch:
If it helps, my workflow is this:
-
git checkout -b fix-1234
- Hack some code
-
git commit -am "Closes # 1234"
-
gh pr create -a "@me" -l "pr-fix" -m "0.9.97"
And it's that final step that does... something to the state of the branch, to confuse gitstatusd.
The error message in gistatusd says that the name of the remote branch doesn't start with the name of the remote. This checks out: "github/add-screen-serial" does not start with "upstream".
Again, this is something I should fix but it may take a very long time before I do. So I highly recommend finding a workaround.
You can try enabling logs with
GITSTATUS_LOG_LEVEL=DEBUG
in~/.zshrc
and then checking them withless $GITSTATUS_DAEMON_LOG_POWERLEVEL9K
.
Thanks for this, I was able to quickly diagnose an issue in my gitconfig that was breaking my git status segment!