You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
It simply has no effect.
Versions
Steps to Reproduce
Set the value of
gitlens.advanced.similarityThresholdto 10.mkdir similarity-index-threshold-testcd similarity-index-threshold-testgit initCreate a file named
dummy.txtwith the content:git add dummy.txt && git commit -m "Create file"Rename
dummy.txttodummy-new.txt.Edit
dummy-new.txtso that it will become:Stage your changes.
From terminal, run
git diff --cached -M10%. The output will be:However, even though we set the value of
gitlens.advanced.similarityThresholdto 10, which is the same as the value of the-Margument of thegit-diffcommand that we have just ran, Source Control panel in Visual Studio Code will showdummy.txtas deleted, anddummy-new.txtas added, instead of showingdummy.txtto be renamed todummy-new.txt.Now, remove the dot after 5 in
dummy-new.txt. That is, editdummy-new.txtso that it will become: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.