|
21 | 21 |
|
22 | 22 | logger = get_logger('Commit Range Collector') |
23 | 23 |
|
24 | | -COMMIT_RANGE_ALL = '--all' |
25 | | - |
26 | | - |
27 | 24 | def get_safe_head_reference_for_diff(repo: 'Repo') -> str: |
28 | 25 | """Get a safe reference to use for diffing against the current HEAD. |
29 | 26 | In repositories with no commits, HEAD doesn't exist, so we return the empty tree hash. |
@@ -353,10 +350,10 @@ def calculate_pre_push_commit_range(push_update_details: str) -> Optional[str]: |
353 | 350 | return f'{merge_base}..{local_object_name}' |
354 | 351 |
|
355 | 352 | logger.debug('Failed to find merge base with any default branch') |
356 | | - return COMMIT_RANGE_ALL |
| 353 | + return consts.COMMIT_RANGE_ALL_COMMITS |
357 | 354 | except Exception as e: |
358 | 355 | logger.debug('Failed to get repo for pre-push commit range calculation: %s', exc_info=e) |
359 | | - return COMMIT_RANGE_ALL |
| 356 | + return consts.COMMIT_RANGE_ALL_COMMITS |
360 | 357 |
|
361 | 358 | # If deleting a branch (local_object_name is all zeros), no need to scan |
362 | 359 | if local_object_name == consts.EMPTY_COMMIT_SHA: |
@@ -456,7 +453,7 @@ def parse_commit_range(commit_range: str, path: str) -> tuple[Optional[str], Opt |
456 | 453 |
|
457 | 454 | # Handle '--all' special case: scan all commits from first to HEAD |
458 | 455 | # Usually represents an empty remote repository |
459 | | - if commit_range == COMMIT_RANGE_ALL: |
| 456 | + if commit_range == consts.COMMIT_RANGE_ALL_COMMITS: |
460 | 457 | try: |
461 | 458 | head_commit = repo.rev_parse(consts.GIT_HEAD_COMMIT_REV).hexsha |
462 | 459 | all_commits = repo.git.rev_list('--reverse', head_commit).strip() |
|
0 commit comments