Skip to content

similarityThreshold option does not work. Also, it should be renamed to similarityIndexThreshold #1469

@ugultopu

Description

@ugultopu

It simply has no effect.

Versions

  • GitLens: 11.4.1
  • VSCode: 1.55.2

Steps to Reproduce

  • Set the value of gitlens.advanced.similarityThreshold to 10.

  • mkdir similarity-index-threshold-test

  • cd similarity-index-threshold-test

  • git init

  • Create a file named dummy.txt with the content:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
  • git add dummy.txt && git commit -m "Create file"

  • Rename dummy.txt to dummy-new.txt.

  • Edit dummy-new.txt so that it will become:

    1.
    2.
    3.
    4.
    5.
    6
    7
    8
    9
    10
    
  • Stage your changes.

  • From terminal, run git diff --cached -M10%. The output will be:

    diff --git a/dummy.txt b/dummy-new.txt
    similarity index 42%
    rename from dummy.txt
    rename to dummy-new.txt
    index f00c965..1f440aa 100644
    --- a/dummy.txt
    +++ b/dummy-new.txt
    @@ -1,8 +1,8 @@
    -1
    -2
    -3
    -4
    -5
    +1.
    +2.
    +3.
    +4.
    +5.
    6
    7
    8
    
  • However, even though we set the value of gitlens.advanced.similarityThreshold to 10, which is the same as the value of the -M argument of the git-diff command that we have just ran, Source Control panel in Visual Studio Code will show dummy.txt as deleted, and dummy-new.txt as added, instead of showing dummy.txt to be renamed to dummy-new.txt.

  • Now, remove the dot after 5 in dummy-new.txt. That is, edit dummy-new.txt so that it will become:

    1.
    2.
    3.
    4.
    5
    6
    7
    8
    9
    10
    
  • Stage your changes. Now Source Control panel in Visual Studio Code will show the file as renamed. This is the proof that GitLens will always use 50% as the value of similarity index threshold, regardless of what we set as the value of gitlens.advanced.similarityThreshold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-bugEither not a bug or not related to the project

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions