diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
index 1b329f8c7b2479425150f79c2d4a9bc11de9ea74_aGdleHQvbGFyZ2VmaWxlcy9sZmNvbW1hbmRzLnB5..0848be1f1aad3eb8e8c5cace140616cd7b70ada8_aGdleHQvbGFyZ2VmaWxlcy9sZmNvbW1hbmRzLnB5 100644
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -502,7 +502,8 @@
         # lfile is added to the repository again. This happens when a
         # largefile is converted back to a normal file: the standin
         # disappears, but a new (normal) file appears as the lfile.
-        if os.path.exists(abslfile) and lfile not in repo[None]:
+        if (os.path.exists(abslfile) and
+            repo.dirstate.normalize(lfile) not in repo[None]):
             util.unlinkpath(abslfile)
             ret = -1
     state = repo.dirstate[lfutil.standin(lfile)]
diff --git a/tests/test-casefolding.t b/tests/test-casefolding.t
index 1b329f8c7b2479425150f79c2d4a9bc11de9ea74_dGVzdHMvdGVzdC1jYXNlZm9sZGluZy50..0848be1f1aad3eb8e8c5cace140616cd7b70ada8_dGVzdHMvdGVzdC1jYXNlZm9sZGluZy50 100644
--- a/tests/test-casefolding.t
+++ b/tests/test-casefolding.t
@@ -106,6 +106,28 @@
   [255]
   $ cat a
   gold
+  $ rm a
+
+test that normal file in different case on target context is not
+unlinked by largefiles extension.
+
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > largefiles=
+  > EOF
+  $ hg update -q -C 1
+  $ hg status -A
+  $ echo 'A as largefiles' > A
+  $ hg add --large A
+  $ hg commit -m '#3'
+  created new head
+  $ hg manifest -r 3
+  .hglf/A
+  $ hg manifest -r 0
+  a
+  $ hg update -q -C 0
+  $ hg status -A
+  C a
 
   $ cd ..