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

Disable git advice on detached checkout #1878

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

artem-zinnatullin
Copy link

We're seeing this git advice in our build logs about detached HEAD state due to how BuildKite agent checks out build commits. It isn't really helpful for automated flows, it's aimed at new git users I guess.

PR should save 16 lines of output for Buildkite users, we're trying to reduce noise in our build logs so they're more actionable when a developer opens the log 😬

$ git clone XXXX
Cloning into '.'...
Warning: Permanently added the ECDSA host key for IP address '' to the list of known hosts.
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 45 (delta 13), reused 38 (delta 7), pack-reused 0
Receiving objects: 100% (45/45), done.
Resolving deltas: 100% (13/13), completed with 7 local objects.
Updating files: 100% (xx/xx), done.
$ git clean -ffxdq
# Fetch and checkout pull request head from GitHub
$ git fetch -- origin refs/pull/xxxxxx/head
Warning: Permanently added the ECDSA host key for IP address 'xxxx' to the list of known hosts.
From github.com:lyft/instant-android
 * branch                      refs/pull/xxx/head -> FETCH_HEAD
# FETCH_HEAD is now `yyy`
$ git checkout -f yyy
Note: switching to 'yyy'.
 
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
 
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
 
  git switch -c <new-branch-name>
 
Or undo this operation with:
 
  git switch -
 
Turn off this advice by setting config variable advice.detachedHead to false

@artem-zinnatullin
Copy link
Author

Sorry, didn't find how to run tests in your setup in the docs, so it might fail on CI 😰 and I don't seem to have permissions to open CI checks in this repo nor don't they run on my PR w/o your approval it seems, filed an issue for that #1879

@moskyb
Copy link
Contributor

moskyb commented Dec 15, 2022

hi there! thanks for your contribution, i see this all the time and it annoys me too.

For the moment at least, we're keeping the agent CI private. This branch is currently failing go fmt, and some of the tests are failing. If you could fix these up we'd be happy to merge :)

@artem-zinnatullin
Copy link
Author

I've updated the test and formatting, but again want to note that there are no instructions on this in the repo (I don't write Go usually) and I can't view what's wrong on CI, please fix this on your end :)

@moskyb
Copy link
Contributor

moskyb commented Dec 20, 2022

want to note that there are no instructions on this in the repo

this is a really good callout - i have a PR up to polish the contribution guide a little bit here: #1885

@artem-zinnatullin
Copy link
Author

I've fixed the errors you mentioned and locally everything passes for me, I can't view the CI error (filed #1879 for that), can you please copy-paste the error from CI log so I could fix it? Thanks

@DrJosh9000 DrJosh9000 added the quality of life Little improvements label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality of life Little improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants