Update aosp->github bot to replicate both master and main

GIT_DIR is requires after git 2.38, which by default prevents
the use of bare repositories as that can be used in attacks.
See https://github.com/git/git/commit/8d1a7448206e11cdea657c35b04cc49db39be933

Change-Id: Ia5478b123d7ca9b3ccdd87868014872a9b73d7e8
diff --git a/infra/git_mirror_bot/mirror_aosp_to_ghub_repo.py b/infra/git_mirror_bot/mirror_aosp_to_ghub_repo.py
index 8a3e061..341a06c 100644
--- a/infra/git_mirror_bot/mirror_aosp_to_ghub_repo.py
+++ b/infra/git_mirror_bot/mirror_aosp_to_ghub_repo.py
@@ -42,7 +42,10 @@
 POLL_PERIOD_SEC = 60
 
 # The actual key is stored into the Google Cloud project metadata.
-ENV = {'GIT_SSH_COMMAND': 'ssh -i ' + os.path.join(CUR_DIR, 'deploy_key')}
+ENV = {
+    'GIT_SSH_COMMAND': 'ssh -i ' + os.path.join(CUR_DIR, 'deploy_key'),
+    'GIT_DIR': WORKDIR,
+}
 
 
 def GitCmd(*args, **kwargs):
@@ -94,14 +97,14 @@
   for line in all_refs.splitlines():
     ref_sha1, ref = line.split()
 
-    FILTER_REGEX = r'(heads/main|heads/releases/.*|tags/v\d+\.\d+)$'
-    m = re.match('refs/' + FILTER_REGEX, ref)
+    FILT_REGEX = r'(heads/main|heads/master|heads/releases/.*|tags/v\d+\.\d+)$'
+    m = re.match('refs/' + FILT_REGEX, ref)
     if m is not None:
       branch = m.group(1)
       current_heads['refs/' + branch] = ref_sha1
       continue
 
-    m = re.match('refs/remotes/upstream/' + FILTER_REGEX, ref)
+    m = re.match('refs/remotes/upstream/' + FILT_REGEX, ref)
     if m is not None:
       branch = m.group(1)
       future_heads['refs/' + branch] = ref_sha1