Skip to content

Commit

Permalink
fetch_request_check
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcmarrow committed Aug 23, 2023
1 parent 720edbf commit 9366833
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions salt/utils/gitfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,18 @@ def get_url(self):
else:
self.url = self.id

def fetch_request_check(self):
fetch_request = salt.utils.path.join(self._salt_working_dir, "fetch_request")
if os.path.isfile(fetch_request):
log.debug(f"Fetch request: {self._salt_working_dir}")
try:
os.remove(fetch_request)
except Exception: # pylint: disable=broad-except
pass
self.fetch()
return True
return False

@property
def linkdir_walk(self):
"""
Expand Down Expand Up @@ -1280,6 +1292,7 @@ def checkout(self, fetch_on_fail=True):
GitPython when running these functions vary in different versions of
GitPython.
"""
self.fetch_request_check()
tgt_ref = self.get_checkout_target()
try:
head_sha = self.repo.rev_parse("HEAD").hexsha
Expand Down Expand Up @@ -1614,6 +1627,7 @@ def checkout(self, fetch_on_fail=True):
"""
Checkout the configured branch/tag
"""
self.fetch_request_check()
tgt_ref = self.get_checkout_target()
local_ref = "refs/heads/" + tgt_ref
remote_ref = "refs/remotes/origin/" + tgt_ref
Expand Down

0 comments on commit 9366833

Please sign in to comment.