GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Z40 = '0' * 40 hardcoding breaks `git push --delete` on SHA-256 repos · Issue #3664 · pre-commit/pre-commit Open Dmao233/pre-commit #1Descriptionsearch you tried in the issue tracker
The closest related hit is #3434 (closed), but that is about fetching sha1-format hook repos into a sha256 local repo — a different codepath. describe your issue
Z40 = '0' * 40 It is compared against if local_sha == Z40: continue elif remote_sha != Z40 and _rev_exists(remote_sha): ... In a repository initialized with pre-commit surfaces these as Minimal reproducer: git init --object-format=sha256 repro cd repro git config user.email [email protected] && git config user.name T git commit --allow-empty -m init cat > .pre-commit-config.yaml <<'EOF' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace EOF git add .pre-commit-config.yaml && git commit -m "pc" pre-commit install --hook-type pre-push git checkout -b doomed git commit --allow-empty -m x SHA=$(git rev-parse HEAD) ZEROS=$(printf '0%.0s' $(seq 1 64)) # Feed git's pre-push stdin format directly — simulates `git push origin --delete doomed` printf '(delete) %s refs/heads/doomed %s\n' "$ZEROS" "$SHA" | .git/hooks/pre-push origin . # exit code 3, error above Suggested fix: accept an all-zero OID of either supported length (40 or 64), or (more general) read the repo's zero OID at runtime. A one-liner that covers both currently-supported object formats: def _is_zero_oid(oid: str) -> bool: return len(oid) in (40, 64) and set(oid) == {'0'} Callers become Happy to open a PR if helpful. pre-commit --versionpre-commit 4.5.1 (reproduced); .pre-commit-config.yamlrepos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace ~/.cache/pre-commit/pre-commit.log (if present)Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |