Skip to content

Diff Options has same behaviour for no_locations and track_filename #2020

Open
@uberroot4

Description

@uberroot4

Current behavior 😯

Hi,

I just saw today that the Setters for the Diff-Options in gix/src/diff.rs has the same implementation for the no_locations and track_filename:

gitoxide/gix/src/diff.rs

Lines 67 to 78 in 5f9de52

impl Options {
/// Do not keep track of filepaths at all, which will leave all `location` fields empty.
pub fn no_locations(&mut self) -> &mut Self {
self.location = Some(Location::FileName);
self
}
/// Keep track of file-names, which makes `location` fields usable with the filename of the changed item.
pub fn track_filename(&mut self) -> &mut Self {
self.location = Some(Location::FileName);
self
}

The doc for the no_locations method says Do not keep track of filepaths at all [...], for the track_filename it says Keep track of [...].

Expected behavior 🤔

Based on the documentation of the no_locations method I would expect an impl like this:

/// Do not keep track of filepaths at all, which will leave all `location` fields empty.
pub fn no_locations(&mut self) -> &mut Self {
    self.location = None;
    self
}

Git behavior

/

Steps to reproduce 🕹

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedan issue is accepted as shortcoming to be fixedhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions