#4290 Increase logging and support the reference returning a commit
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

file modified
+1
@@ -2729,6 +2729,7 @@ 

              archive_folder, project.fullname, tag_path, commit

          )

          if not os.path.exists(target_path):

+             _log.info("Creating folder: %s", target_path)

              os.makedirs(target_path)

          fullpath = os.path.join(target_path, name)

  

file modified
+6 -2
@@ -3443,9 +3443,13 @@ 

      if ref_string in repo_obj.listall_references():

          reference = repo_obj.lookup_reference(ref_string)

          tag = repo_obj[reference.target]

-         if not isinstance(tag, pygit2.Tag):

+         if isinstance(tag, pygit2.Tag):

+             commit = tag.peel(pygit2.Commit)

+         elif isinstance(tag, pygit2.Commit):

+             commit = tag

+         else:

+             _log.debug("Found %s instead of a tag", tag)

              flask.abort(400, "Invalid reference provided")

-         commit = tag.peel(pygit2.Commit)

      else:

          try:

              commit = repo_obj.get(ref)

We had a case where the reference given wasn't pointing to a tag
but to a commit. Which as a matter of fact, is fine since when
we are given a tag we want to go to the underlying commit.
So if we're given a commit, keep going.

Fixes https://pagure.io/pagure/issue/4278

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

pretty please pagure-ci rebuild

5 years ago

rebased onto 7c59e94

5 years ago

Pull-Request has been merged by pingou

5 years ago