openlawlibrary / taf

The Archive Framework
GNU Affero General Public License v3.0
10 stars 10 forks source link

fix is_branch_with_unpushed_commits #415

Closed renatav closed 5 months ago

renatav commented 6 months ago

Description (e.g. "Related to ...", etc.)

This bug was introduced by unreleased changes, which made it impossible to run update after cloning in cases where there are authenticated commits that do not get merged. The check needs to be more complex than just checking if top commits are the same.

Fix #414

Code review checklist (for code reviewer to complete)

renatav commented 6 months ago

@n-dusan I added a test, and it's passing locally, but failing on CI. I don't know why. Would require debugging. It does not appear to be failing due to an error with this updated function

n-dusan commented 6 months ago

It's failing on my Windows locally.

Looks like repo can't find the local git branch name?

local_branch = repo.branches.get(branch_name)
        if local_branch is None:
            print(f"Branch '{branch_name}' not found in the repository.")
upstream_full_name = local_branch.upstream_name

E AttributeError: 'NoneType' object has no attribute 'upstream_name'

renatav commented 5 months ago

@n-dusan So it turned out that .default_branch was returning renatav/fix-clean-checks and not master. That caused the tests to fail. I have never experienced any problems with default_branch until now. The tests are passing now.