Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git branch info disappears after submitting a github pull request #1820

Open
cmsj opened this issue Mar 29, 2022 · 8 comments
Open

git branch info disappears after submitting a github pull request #1820

cmsj opened this issue Mar 29, 2022 · 8 comments

Comments

@cmsj
Copy link

cmsj commented Mar 29, 2022

Hello!

I have p10k set up to show git information in my prompt:

Screenshot 2022-03-29 at 23 18 06

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

Is there something I can do/run to collect some useful information about why this might be happening?

@romkatv
Copy link
Owner

romkatv commented Mar 29, 2022

You can try enabling logs with GITSTATUS_LOG_LEVEL=DEBUG in ~/.zshrc and then checking them with less $GITSTATUS_DAEMON_LOG_POWERLEVEL9K.

@cmsj
Copy link
Author

cmsj commented Mar 30, 2022

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]

@romkatv
Copy link
Owner

romkatv commented Mar 30, 2022

What's the branch name and what is it tracking?

@cmsj
Copy link
Author

cmsj commented Mar 30, 2022

❯ 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://git@github.com/cmsj/hammerspoon (fetch)
cmsj	ssh://git@github.com/cmsj/hammerspoon (push)
cp	git@github.com:CommandPost/CommandPost-App (fetch)
cp	git@github.com:CommandPost/CommandPost-App (push)
latenitefilms	https://github.com/latenitefilms/hammerspoon (fetch)
latenitefilms	https://github.com/latenitefilms/hammerspoon (push)
origin	ssh://git@github.com/hammerspoon/hammerspoon (fetch)
origin	ssh://git@github.com/hammerspoon/hammerspoon (push)
origin_https	https://cmsj@github.com/hammerspoon/hammerspoon (fetch)
origin_https	https://cmsj@github.com/hammerspoon/hammerspoon (push)
upstream	git@github.com:hammerspoon/hammerspoon.git (fetch)
upstream	git@github.com:hammerspoon/hammerspoon.git (push)

@romkatv
Copy link
Owner

romkatv commented Mar 30, 2022

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.

@cmsj
Copy link
Author

cmsj commented Mar 30, 2022

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.

@romkatv
Copy link
Owner

romkatv commented Mar 30, 2022

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.

@faelin
Copy link

faelin commented Jun 8, 2022

You can try enabling logs with GITSTATUS_LOG_LEVEL=DEBUG in ~/.zshrc and then checking them with less $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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants