Skip to content

Sync: use a dotfiles repo that is already cloned and has data - #25

Merged
VictorGSchneider merged 1 commit into
mainfrom
claude/youthful-tesla-gbhv5o
Oct 15, 2026
Merged

VictorGSchneider merged 1 commit into
mainfrom
claude/youthful-tesla-gbhv5o

Conversation

@VictorGSchneider

@VictorGSchneider VictorGSchneider commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Why

GitHub Sync could only create a new repo or clone <user>/dotfiles into ~/.dotfiles. Someone who already keeps their dotfiles in a cloned repo (elsewhere, with data, maybe not on GitHub) had no way to use it. Looking at the code also showed that pointing DFM at such a repo would have been unsafe: Pull copied every file in the repo into ~ (an install.sh or scripts/ would land in the home folder) and Push ran git add -A, committing unrelated work in progress.

What

  • Setup > Use an Existing Local Repo: choose the folder (starts at ~/.dotfiles, ~/dotfiles... when one exists). DFM validates it is the root of a git clone, shows remote, branch, layout, number of dotfiles and uncommitted changes, and links it after confirmation. No network; gh is only required when the remote is on github.com (require_remote_access).
  • Layouts (dfm/core/github_sync/layout.py): mirror (files laid out like ~, what DFM creates) and GNU Stow-style (zsh/.zshrc). In a stow repo a tracked file keeps its package; new files go in a dfm/ package.
  • Push stages and commits only the files DFM copied, so other changes in the repo are untouched.
  • Pull installs only dotfiles (names starting with a dot, excluding .git*, .github...), skips files identical to home (no pointless backups), and the preview dialog uses the same logic (pull_preview).
  • Diff preview resolves the repo copy through the layout.
  • README and CHANGELOG ([Unreleased]) updated.

Test plan

  • 20 new tests (tests/test_existing_repo.py): linking a clone with data, no gh, non-repo / missing / subfolder / no-remote / dirty cases, layout detection and mapping, pull ignoring install.sh/README/scripts/.github, stow pull and push, push committing only DFM files, no-change push, diff preview
  • Full unit suite passes on 3.12 and 3.13 (171 tests); sync tests pass on 3.10
  • UI smoke/edit tests pass under Xvfb; pyflakes clean
  • The folder chooser (Gtk.FileDialog) needs a desktop session; not exercised headless

Not covered: stow packages that keep dotfiles in non-dot top-level paths (e.g. bin/), and chezmoi-style repos (dot_bashrc).

🤖 Generated with Claude Code

https://claude.ai/code/session_01UB8ouAGs45EfpwJjttj6yY


Generated by Claude Code

- Setup > Use an Existing Local Repo: pick the folder, see remote/branch/
  layout/dotfile count, then link it. Any git host; gh only for GitHub remotes.
- Understand mirror and GNU Stow-style layouts (new layout module).
- Push stages/commits only the files DFM copied instead of git add -A.
- Pull installs only dotfiles, skips scripts/READMEs/CI files and files
  identical to home, and previews exactly that.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UB8ouAGs45EfpwJjttj6yY
@VictorGSchneider VictorGSchneider self-assigned this Oct 15, 2026
@VictorGSchneider
VictorGSchneider merged commit 3738385 into main Oct 15, 2026
7 checks passed
@VictorGSchneider
VictorGSchneider deleted the claude/youthful-tesla-gbhv5o branch October 15, 2026 23:57
@VictorGSchneider VictorGSchneider mentioned this pull request Oct 16, 2026
2 tasks done
VictorGSchneider added a commit that referenced this pull request Oct 16, 2026
## Resumo
Publica a versão **2.2.0**: a opção de usar um repositório de dotfiles
que já existe e já está clonado (#25).

## Mudanças
- `dfm/__init__.py`: `__version__` passa de `2.1.0` para `2.2.0` (fonte
única da versão; `setup.py`, `dfm --version` e o diálogo Sobre leem
dali).
- `CHANGELOG.md`: as notas de `[Unreleased]` passam para `## [2.2.0]` e
os links de comparação são atualizados.

## O que entra na 2.2.0
- **Added:** "Use an Existing Local Repo" em GitHub Sync > Setup, para
qualquer host git. O `gh` só é exigido para remotes do GitHub. Reconhece
repos no formato espelho da home e no estilo GNU Stow.
- **Changed:** o Push faz stage e commit só dos arquivos que o DFM
copiou, em vez de `git add -A`. O Pull instala só dotfiles (nomes que
começam com ponto) e pula arquivos idênticos aos da home.

## Teste
- [x] `python -m unittest tests.test_version` (versão, CHANGELOG e links
coerentes)
- [x] CI verde

## Depois do merge
Criar e enviar a tag a partir da `main`, o que dispara o workflow
`Release` e publica o "DFM 2.2.0" com as notas desta seção:

    git fetch origin
    git tag -a v2.2.0 origin/main -m "DFM 2.2.0"
    git push origin v2.2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants