Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Diff.Delta status type binding incorrect #177

@atom2ueki

Description

@atom2ueki

the status for Diff.Delta bind to a wrong type,

self.status = Status(rawValue: UInt32(git_diff_status_char(delta.status)))

delta.status should be git_delta_t

but Status.type is refer to git_status_t in libgit2

public struct Status: OptionSet {
// This appears to be necessary due to bug in Swift
// https://bugs.swift.org/browse/SR-3003
public init(rawValue: UInt32) {
self.rawValue = rawValue
}
public let rawValue: UInt32
public static let current = Status(rawValue: GIT_STATUS_CURRENT.rawValue)
public static let indexNew = Status(rawValue: GIT_STATUS_INDEX_NEW.rawValue)
public static let indexModified = Status(rawValue: GIT_STATUS_INDEX_MODIFIED.rawValue)
public static let indexDeleted = Status(rawValue: GIT_STATUS_INDEX_DELETED.rawValue)
public static let indexRenamed = Status(rawValue: GIT_STATUS_INDEX_RENAMED.rawValue)
public static let indexTypeChange = Status(rawValue: GIT_STATUS_INDEX_TYPECHANGE.rawValue)
public static let workTreeNew = Status(rawValue: GIT_STATUS_WT_NEW.rawValue)
public static let workTreeModified = Status(rawValue: GIT_STATUS_WT_MODIFIED.rawValue)
public static let workTreeDeleted = Status(rawValue: GIT_STATUS_WT_DELETED.rawValue)
public static let workTreeTypeChange = Status(rawValue: GIT_STATUS_WT_TYPECHANGE.rawValue)
public static let workTreeRenamed = Status(rawValue: GIT_STATUS_WT_RENAMED.rawValue)
public static let workTreeUnreadable = Status(rawValue: GIT_STATUS_WT_UNREADABLE.rawValue)
public static let ignored = Status(rawValue: GIT_STATUS_IGNORED.rawValue)
public static let conflicted = Status(rawValue: GIT_STATUS_CONFLICTED.rawValue)
}

correct one should be

typedef enum {
    GIT_DELTA_UNMODIFIED = 0,  /**< no changes */
    GIT_DELTA_ADDED = 1,	   /**< entry does not exist in old version */
    GIT_DELTA_DELETED = 2,	   /**< entry does not exist in new version */
    GIT_DELTA_MODIFIED = 3,    /**< entry content changed between old and new */
    GIT_DELTA_RENAMED = 4,     /**< entry was renamed between old and new */
    GIT_DELTA_COPIED = 5,      /**< entry was copied from another old entry */
    GIT_DELTA_IGNORED = 6,     /**< entry is ignored item in workdir */
    GIT_DELTA_UNTRACKED = 7,   /**< entry is untracked item in workdir */
    GIT_DELTA_TYPECHANGE = 8,  /**< type of entry changed between old and new */
    GIT_DELTA_UNREADABLE = 9,  /**< entry is unreadable */
    GIT_DELTA_CONFLICTED = 10, /**< entry in the index is conflicted */
} git_delta_t;

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