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

Fix crash when filtering unrelated histories by refs #330

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matejcik
Copy link

This is a sort of weird condition.

Consider repository main-repo, into which, at some point, another repository side-repo was merged via --allow-unrelated-histories. main-repo now has two root commits and two histories that converge at some point.
Next, pick a commit from side-repo's own history, tag it with side-tag for convenience.

If you want to filter by --refs=side-tag..HEAD, for example, i.e., the selection starts inside side-repo's history, then the output from fast-export is not sorted ideally. I forget the details right now, it made sense at the time ... in any case, the result is that an entry in parents can be an untranslated commit hash instead of ID.

So line 3461 will fail because ID_TO_HASH[parent] does not exist.

Fortunately we don't actually care because get_file_changes wants a commit hash, so it's sufficient to use the raw entry.

@newren
Copy link
Owner

newren commented Sep 24, 2022

Wow, nice find! Thanks so much for digging this down and sending in a PR!

And I'm sorry for being so slow to respond.

In any event, I really need the Signed-off-by line in the commit message before I can merge. If you can amend and add that, I'll be happy to merge it!

@matejcik
Copy link
Author

thanks for your response :) this works, I hope? b07b17f

@newren
Copy link
Owner

newren commented Sep 26, 2022

this works, I hope?

That's almost what I need, but it looks like you used a username rather than a real name. Is that right? As per https://github.com/git/git/blob/4fd6c5e44459e6444c2cd93383660134c95aabd1/Documentation/SubmittingPatches#L284-L286, I need a real name for author/committer/signoff.

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.

2 participants