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

Display actual commit hash #83

Closed
wants to merge 1 commit into from
Closed

Display actual commit hash #83

wants to merge 1 commit into from

Conversation

JohnTitor
Copy link
Member

It's useful to display fork commit hash when test-on-fork is enabled.

r? @pietroalbini

@JohnTitor
Copy link
Member Author

@pietroalbini I think it's useful when test-on-fork is enabled, it'd be great if you could review it when you have time.

@pietroalbini
Copy link
Member

This shouldn't be needed, most of the times GitHub fills the link anyway.

@JohnTitor
Copy link
Member Author

most of the times GitHub fills the link anyway.

Oh, really? I saw bors displayed the sha on fork repo directly and it didn't be linked properly like this: rust-lang/rust#70072 (comment)
I think we should add rust-lang-ci/rust@ before the sha, like rust-lang-ci/rust@4aa4d67.
But GitHub will do that if test-on-fork works well?

@pietroalbini
Copy link
Member

Not really: test-on-fork relies on an implementation detail of GitHub, as behind the scenes it stores all the forks in the same repo. So, when bors pushes a commit to the fork, the commit is also available on the main repo, so GitHub is able to generate a link to it.

My guess is that there is some eventual consistency in GitHub, and occasionally GitHub doesn't recognized the commit is there as soon as the comment is posted.

@camelid
Copy link
Member

camelid commented Sep 6, 2020

triage: Status?

@pietroalbini
Copy link
Member

This is not actually needed, once GitHub figures the commit was pushed it will show the correct link.

@camelid
Copy link
Member

camelid commented Oct 15, 2020

Really? IME the commit hash doesn’t get linked because it’s on rust-lang-ci/rust. Unless I’m thinking of something else...

@camelid
Copy link
Member

camelid commented Oct 15, 2020

Hmm, it looks like it autolinks to the merge commit only once it has been pushed to rust-lang/rust. It doesn’t seem to link to the commit on rust-lang-ci.

@pietroalbini
Copy link
Member

@camelid it's... weird.

Basically, GitHub internally stores all the forks in the same git directory as the main repository, to save storage space. This implementation detail leaks all over the UI though: for example, if you visit https://github.com/rust-lang/rust/commit/{HASH} with the hash of a commit only in your rustc fork, you'll still see the commit, even though it was never pushed to the main repository.

GitHub takes a couple of seconds to realize a commit pushed in a fork is also present in the main repository though, so if you try to read the "build in progress" comment as soon as it's posted you won't see the link. Once a couple of seconds have passed and the caches on GitHub's side expire, you'll see the linked commit.

@camelid
Copy link
Member

camelid commented Oct 16, 2020

That is weird :)

This implementation detail leaks all over the UI though: for example, if you visit https://github.com/rust-lang/rust/commit/{HASH} with the hash of a commit only in your rustc fork, you'll still see the commit, even though it was never pushed to the main repository.

Yeah, I've always wondered how that works! Although it is helpful in PRs to be able to easily refer to a particular commit, so it's probably not entirely intended to be an implementation detail ;)

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

Successfully merging this pull request may close these issues.

3 participants