@@ -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_VERIFY_BRANCH = "git -C {path} show-ref --quiet --verify refs/heads/{branch}"
129130
130131 PIP_INSTALL = "{python} -m pip install -U -t {target_dir} {reqs}"
131132
@@ -247,6 +248,25 @@ async def is_on_branch(self) -> bool:
247248 """
248249 return await self .latest_commit () == self .commit
249250
251+ async def is_branch (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 (
261+ self .GIT_VERIFY_BRANCH , branch = self .branch , path = self .folder_path
262+ )
263+ p = await self ._run (git_command )
264+
265+ return p .returncode == 0
266+
267+
268+
269+
250270 async def _get_file_update_statuses (
251271 self , old_rev : str , new_rev : Optional [str ] = None
252272 ) -> Dict [str , str ]:
@@ -815,6 +835,9 @@ async def update(self) -> Tuple[str, str]:
815835 -------
816836 `UpdateError` - if git pull results with non-zero exit code
817837 """
838+ if not await self .is_branch ():
839+ return self .commit , self .commit
840+
818841 old_commit = await self .latest_commit ()
819842
820843 await self .hard_reset ()
0 commit comments