Page MenuHomePhabricator

PR branches are imported when mirroring a GitHub repo ignoring "Track Only" settings
Closed, InvalidPublic

Description

To reproduce:

  • Create a new Diffusion repo that mirrors a GitHub repo and only tracks the master branch
  • Notice how commits in PR branches in GitHub are still imported into Diffusion

This becomes a real problem if PRs are landed squashed or rebased instead of the default merged in GitHub UI. This means new commits are created with the same diffs / messages / author and now you end up with twice the commits in Diffusion, which confuses users when searching for commits based on their messages.

Event Timeline

Does my email about refs/pull/68/head explain this behavior?

That is, I suspect the real reproduction steps are:

  • Track only "master".
  • Push a commit to a ref or tag.
  • It's imported, because "Track Only" only covers branches (specifically: refs in refs/heads), not tags (in refs/tags) or other exotic refs (in refs/pull from GitHub, or refs/changes from Gerrit).

As described, the reproduction steps suggest that "Track Only" simply has no effect. I suspect this will not be reproducible.

Yes, your email explains the real behavior under the hood. I filed this task from the perspective of what it looks to the user, not from the engineering implementation perspective. Feel free to change title / description of course.

Is there any reasons why the current setting could not be changed from "branches" to "references" for Git repos?

I filed this task from the perspective of what it looks to the user, not from the engineering implementation perspective.

I'm going to close this task because I don't think it's helpful.

It incorrectly describes a behavior (this is not related to "branches") and provides misleading reproduction steps.

The behavior is expected. See T6878#180701, and this quote from the separate email chain:

Note that Git tags and refs are currently imported regardless of "Track Only" (which only applies to branches) and refs in GitHub repositories tend to include changes in pull requests since they appear in "refs/pull/", so this may not really do anything.

This ground is also generally better covered elsewhere, like T11314, which I also referenced earlier in the email thread.

Is there any reasons why the current setting could not be changed from "branches" to "references" for Git repos?

Yes. This is discussed in greater detail in several of the tasks linked here and in the email chain if you're interested in learning more.