@@ -126,6 +126,7 @@ class Repo(RepoJSONMixin):
126126 "git -C {path} log --diff-filter=D --pretty=format:%H -n 1 {descendant_rev}"
127127 " -- {module_name}/__init__.py"
128128 )
129+ GIT_LIST_TAGS = "git -C {path} tag -l"
129130
130131 PIP_INSTALL = "{python} -m pip install -U -t {target_dir} {reqs}"
131132
@@ -247,6 +248,28 @@ async def is_on_branch(self) -> bool:
247248 """
248249 return await self .latest_commit () == self .commit
249250
251+ async def is_branch_tag (self ) -> bool :
252+ """
253+ Check if the branch assosiated with the repo is a tag.
254+
255+ Returns
256+ -------
257+ bool
258+ `True` if branch is a tag or `False` otherwise
259+ """
260+ git_command = ProcessFormatter ().format (self .GIT_LIST_TAGS , path = self .folder_path )
261+ p = await self ._run (git_command )
262+
263+ if p .returncode != 0 :
264+ raise errors .GitException (
265+ "Git failed to get list of tags" ,
266+ git_command ,
267+ )
268+
269+ tags = p .stdout .decode (** DECODE_PARAMS ).strip ().split ("\n " )
270+
271+ return self .branch in tags
272+
250273 async def _get_file_update_statuses (
251274 self , old_rev : str , new_rev : Optional [str ] = None
252275 ) -> Dict [str , str ]:
@@ -815,6 +838,9 @@ async def update(self) -> Tuple[str, str]:
815838 -------
816839 `UpdateError` - if git pull results with non-zero exit code
817840 """
841+ if await self .is_branch_tag ():
842+ return self .commit , self .commit
843+
818844 old_commit = await self .latest_commit ()
819845
820846 await self .hard_reset ()
0 commit comments