Skip to content
New issue

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

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

Already on GitHub? # to your account

merge commits in the SoT repo obliterate actual git history #314

Open
petergaultney opened this issue Feb 12, 2025 · 3 comments
Open

merge commits in the SoT repo obliterate actual git history #314

petergaultney opened this issue Feb 12, 2025 · 3 comments

Comments

@petergaultney
Copy link

we have an internal repo that we open source parts of.

the internal repo has the correct git blame on every line.

the external repo has the correct current code - but completely wrong git blame. Every line is a merge commit that had nothing to do with the file (indeed, nothing to do with anything anywhere near the file!).

the relevant bit of our config is

core.workflow(
    name="open-source",
    mode="ITERATIVE",
    origin=git.origin(
        url="file://INTERNAL_REPO_PATH_PLACEHOLDER",
        # this looks goofy, but I have been unable to find any alternative that will work
        # with dynamic input paths.
        # see https://github.com/google/copybara/issues/142#issuecomment-1782115935
        ref="HEAD",
        first_parent=False,  # try to get the underlying branch commits instead of just the merge commits.
        partial_fetch=True,
    ),
    destination=git.destination(
        url="file://EXTERNAL_REPO_PATH_PLACEHOLDER",
        fetch="main",
        push="open-source",
    ),
)

there must be something i'm doing wrong with our config, but I can't figure out what it is...

@petergaultney
Copy link
Author

the public repo in question, where merges are messing with the git history. https://github.com/TrilliantHealth/trilliant-data-science/blob/main/libs/mops/docs/magic.adoc

we changed nothing in this merged PR that touches anything in this library at all.

@hsudhof
Copy link
Collaborator

hsudhof commented Feb 21, 2025

I suspect this might be due to using HEAD here, with different fetch and push refs, but have to think about this.

@petergaultney
Copy link
Author

I can try using the same ref (main) on Monday. this is only set up this way so that somebody manually verifying a new set of files to open source can run copybara on a branch locally. but the final run config can look different if that helps.

though I think in practice it generally ends up running on main in CI anyway.

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

No branches or pull requests

2 participants