Files
skillshare/internal/git
Willie 6f3d6a310e fix(pull): keep files-only local commits on first pull (#352)
* fix(pull): keep files-only local commits on first pull

FirstPull decided whether local history was worth keeping by looking only
for root-level directories. Agents and extras repos hold their content as
root-level files, so a repo with real local commits but no directories was
treated as empty and reset --hard onto the remote, discarding that work
without --force.

Count any root entry except .git and the scaffold .gitignore as local
content, matching how init already distinguishes a scaffold commit from
real content. A scaffold-only repo still resets for a clean linear history.

* docs(i18n): describe first-pull local content rule in translations

Keep the ja, ko, zh-Hans and zh-Hant pull references in line with the English page now that any root file, not only a directory, counts as local content worth merging.

* fix(pull): ignore git-ignored files when detecting local content

A raw directory scan counted ignored files such as .DS_Store as local content, so a scaffold-only repo merged unrelated history instead of resetting onto the remote and could fail when the remote tracks that path. Ask git for tracked and non-ignored files instead.

init --remote also told users that 'skillshare pull' replaces local with remote, but with local content pull merges both sides; replacement needs --force. Show both options accurately.

* fix(pull): keep local ignore rules when first pull resets

With empty directories no longer counting as local content, a root-scope repo holding only its scaffold .gitignore now resets onto the remote. If the remote .gitignore lacks the config.yaml rule, the reset drops it and the machine-local config.yaml shows up as untracked, so the next pull fails as dirty.

Carry any rule the reset drops into .git/info/exclude: it stays local, keeps the tree clean, and needs no automatic commit. init --remote's reset path uses the same helper.

* fix(pull): keep leading whitespace in migrated ignore rules

Leading whitespace is part of a gitignore pattern, so trimming ' foo' to 'foo' before writing it to info/exclude made a plain foo file ignored and silently left out of later commits. Copy raw lines and only normalize to detect blanks.

* fix(pull): keep counting directories as local content

Dropping directories from the local-content check made a scaffold-only root-scope repo (empty skills/ and agents/) reset onto the remote, where it used to merge. Patching that new reset path kept surfacing edge cases (dropped ignore rules, whitespace-sensitive patterns, an ignored config.yaml overwritten by --hard).

Count directories again, so root scope keeps its previous merge behavior, and drop ResetKeepingIgnores, which existed only to patch that path. The original fix stays: tracked or non-ignored root-level files now also count.
2026-10-03 17:38:04 +08:00
..