git: make sure to fsdecode bookmark names everywhere (issue6723) stable
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 04 Jul 2022 15:01:52 +0400
branchstable
changeset 49384 3b8fce9a74df
parent 49380 55adff810546
child 49385 3c4d36a96a3e
git: make sure to fsdecode bookmark names everywhere (issue6723)
hgext/git/__init__.py
tests/test-git-interop.t
--- a/hgext/git/__init__.py	Mon Jul 11 09:50:32 2022 +0200
+++ b/hgext/git/__init__.py	Mon Jul 04 15:01:52 2022 +0400
@@ -204,7 +204,9 @@
 
     @active.setter
     def active(self, mark):
-        githead = mark is not None and (_BMS_PREFIX + mark) or None
+        githead = None
+        if mark is not None:
+            githead = _BMS_PREFIX + pycompat.fsdecode(mark)
         if githead is not None and githead not in self.gitrepo.references:
             raise AssertionError(b'bookmark %s does not exist!' % mark)
 
@@ -254,7 +256,7 @@
                 )
 
     def checkconflict(self, mark, force=False, target=None):
-        githead = _BMS_PREFIX + mark
+        githead = _BMS_PREFIX + pycompat.fsdecode(mark)
         cur = self.gitrepo.references['HEAD']
         if githead in self.gitrepo.references and not force:
             if target:
--- a/tests/test-git-interop.t	Mon Jul 11 09:50:32 2022 +0200
+++ b/tests/test-git-interop.t	Mon Jul 04 15:01:52 2022 +0400
@@ -119,6 +119,10 @@
 and bookmarks:
   $ hg bookmarks
    * master                    1:3d9be8deba43
+  $ hg up master
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg bookmarks
+   * master                    1:3d9be8deba43
 
 diff even works transparently in both systems:
   $ echo blah >> alpha