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

Keep path references in merge_file_from_index #520

Merged
merged 1 commit into from
May 3, 2015

Conversation

cjwatson
Copy link
Contributor

IndexEntry._to_c requires its caller to hold a reference to the path it
returns until it no longer needs the C structure.
Repository.merge_file_from_index was not doing so, causing the merge
text to contain garbage from freed memory in some cases.

IndexEntry._to_c requires its caller to hold a reference to the path it
returns until it no longer needs the C structure.
Repository.merge_file_from_index was not doing so, causing the merge
text to contain garbage from freed memory in some cases.
@carlosmn
Copy link
Member

The single-line expression works fine for the simpler expression, but once we're getting into tuples and negations, it would look a lot more readable if we had a function which had the logic instead of copying on each line, something like

def entry_to_maybe_c(entry):
    if entry is None:
        return ffi.NULL, ffi.NULL

    return entry._to_c()

@jdavid jdavid merged commit efb49f8 into libgit2:master May 3, 2015
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.

None yet

3 participants