[Other] update.sh: on any clone whose remote has no main, every failed pull is misdiagnosed as old history
Maintainers usually reply within 3 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
The bug is in update.sh: the old-history check at line 20 (git merge-base HEAD origin/main) also succeeds as a failure when origin/main does not exist, and the remedy at line 43 then points at that missing ref. Reproduce with a bare origin that has only a memory-core branch and a diverged clone, then run git pull --ff-only. Done means a divergence is reported as a divergence, a missing origin/main is handled separately, and the script no longer exits 1 with "Could not move to the new history" in that case.
Written by the indexing model from the issue text.
Description
Problem: update.sh gates its "old history" recovery on ! git merge-base HEAD origin/main (line 20). The condition was meant for "no commit in common with origin/main" — but it is equally true when origin/main DOES NOT EXIST: merge-base then exits 128. So on a source FORK whose remote has no main branch (any fork tracking its own default branch — e.g. memory-core), every ordinary git pull --ff-only failure (diverged local commit) takes the old-history path, which then tries git checkout -B <branch> origin/main (line 43) — a ref that does not exist there.
Environment:
Strata Version: 0.2.7 (source checkout at tag v0.2.7, commit 5e8a4cca; the file discussed is byte-identical to the tag)
OS: Linux x86-64
Reported from the Strata-Mnemosyne fork's merged tree; the offending code is upstream's own.
Reproduce (measured): live check — git merge-base HEAD origin/main → fatal: Not a valid object name origin/main, exit 128. Sandbox: bare origin with only branch memory-core, diverged clone → git pull --ff-only fails → the old-history branch is entered, a spurious pre-cleanup-backup branch is made and removed, and the remedy fails with exit 128 ('origin/main' is not a commit) → update.sh exits 1 with "Could not move to the new history".
Expected: distinguish "no common history" from "origin/main is absent here" (or use the real upstream ref), and name the actual remedy (merge/rebase the current branch).
Actual: an ordinary divergence on a fork reads as a corrupt clone.
Reproduction status: the condition and the failing remedy measured in a sandbox bare-origin clone; the Windows .bat twin of the same logic not checked.
- Dominant language
- C++
- Stars
- 11.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Niko1221/Strata
-
Difficulty 1/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
Similar issues
-
bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
chipsalliance/verible#2644 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
grafana/pyroscope-dotnet#470 ·
Maintainers usually reply within 1 day
-
documentation P5 XS
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-astro/AlpacaBridge#1848 ·
Maintainers usually reply within 1 day
-
DiskANN AnnIterator returns unconverted IP distances after the graph walk runs out of candidatesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
zilliztech/knowhere#1933 ·
Maintainers usually reply within 1 day