Keep path references in merge_file_from_index #520

Merged
merged 1 commit into from May 3, 2015

Conversation

Projects
None yet
3 participants

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.

Keep path references in merge_file_from_index
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.
Owner

carlosmn commented Apr 25, 2015

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment