Skip to content

One cause of "The reference 'refs/heads/master' cannot be peeled - Cannot retrieve reference target" #4293

@dirk-de-bugger

Description

@dirk-de-bugger

I played with libgit2 and came around this error and debugged it a bit. In the end cmake found an ancient zlib header and lib burried in %PATH%.

Here is a record of my findings in hope it may help.

ERROR:

Call to git_status_list_new() fails.

Message from git_reference_peel(): "the reference 'refs/heads/master' cannot be peeled - Cannot retrieve reference target"

ISSUE:

Primary error message overwritten:
Message from inflate_disk_obj(): "failed to inflate disk object"

CAUSED BY:

start_inflate(): inflateInit() returns 661 (?), inflate() then -6 (Z_VERSION_ERROR)

CAUSED BY:

cmake ..
-- Found ZLIB: C:/gnuwin32/lib/zlib.lib (found version "1.2.3")

QUICK FIX:

Disable package searching in CMakeLists.txt:

#FIND_PACKAGE(ZLIB)
#IF (ZLIB_FOUND)
# INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
# LINK_LIBRARIES(${ZLIB_LIBRARIES})
# IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
# LIST(APPEND LIBGIT2_PC_LIBS "-lz")
# ELSE()
# SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} zlib")
# ENDIF()
#ELSE()
MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
INCLUDE_DIRECTORIES(deps/zlib)
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
FILE(GLOB SRC_ZLIB deps/zlib/*.c deps/zlib/*.h)
#ENDIF()

SUGGESTED FIX:

Add cmake option to disable package searching.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions