ADR 0001: Repository aliases¶
Status¶
Proposed. 2026-12-05.
Context¶
An entry’s key does three jobs. It is the name a term matches on the command line, the directory the repository is checked out to, and part of the identity vcspull uses to decide that two files describe the same entry (the parent of the checkout path plus the name).
~/work/libtmux/:
docs:
repo: git+https://github.com/example/libtmux-docs.git
~/study/python/:
docs:
repo: git+https://github.com/example/python-docs.git
Generic directory names repeat across workspace roots: docs, assets,
central, design. vcspull sync docs selects every one of them, and
vcspull status prints docs once per checkout with nothing to tell them
apart. The only unambiguous term is the full path.
#586 asks for a way to
address ~/work/libtmux/docs as libtmux-docs while the directory stays
docs. Three questions decide what that means for a user:
Does
docsstill match once the entry has another handle?Is the handle an added
alias, the existingname, or a uniqueid?What happens when two entries hold the same handle, in one file or across configuration scopes?
Two keys that look like answers exist in v1.70.1 and are not:
name:renames the entry and its directory.name: libtmux-docsunder the keydocschecks out to~/work/libtmux/libtmux-docs, anddocsstops matching. Adding it to an entry that is already cloned leaves the old directory behind and clones again.path:sets the checkout path verbatim, with no~or$HOMEexpansion, so aname:pluspath:pair that keeps the directory needs an absolute path and cannot be shared between machines.
Each of the three designs was built as a prototype on v1.70.1 and used from a
shell in every scope (user dotfile, user config directory, project file,
-f FILE), through the commands that read configuration and the commands that
write it. The decision below is the design that was still standing, refined
through repeated adversarial review. It records behaviour, not an
implementation.
Decision¶
An entry may carry alias:, one extra handle. An alias adds a way to select
the entry and changes nothing else: not the directory, not the name, not the
identity used to merge files.
~/work/libtmux/:
docs:
repo: git+https://github.com/example/libtmux-docs.git
alias: libtmux-docs
docs still matches. There is no id. name: keeps its meaning: name:
renames the entry and its directory; alias: adds a handle and changes
neither.
The rest of this section uses three terms. A handle is a name or an alias. A term is what you type after a command. A shared handle is an alias that equals another entry’s alias or name.
The value¶
An alias is one string. It starts with a letter, digit, or underscore, contains only letters, digits,
_,., and-, and is at most 255 characters. Aliases are case-sensitive. Any other value fails when the file loads, with a message that states the rule. Directory names stay unrestricted.An alias equal to its own entry’s name adds nothing. It is ignored, vcspull fmt
--writeremoves it, and it counts as “no alias” when one is attached.An entry holds one alias.
Matching¶
vcspull sync, vcspull list, vcspull status, and vcspull worktree match a term against the name and the alias with the same glob rules, so
'libtmux-*'selects by alias. vcspull search matches its regular expression against the alias too, with analias:prefix and--field alias.The same name under different workspace roots is normal and is never reported. Only an alias can make a handle shared.
Scopes¶
A nearer file replaces the same entry whole, as it does today, so a redefinition in one of your own files that omits the alias loses it. A term that names the lost alias gets a warning that says which file replaced the entry.
A project file never removes or replaces an alias that a user or system file declares. Your alias keeps working from inside a project that redefines the checkout.
Writing an alias¶
vcspull add PATH --alias Xadds a new entry with the alias. When PATH is already configured, it attaches the alias to that entry instead: it matches by directory, whatever the key or howeverpath:is written, edits the definition vcspull uses, keeps key order, and changes nothing but the alias.An attach is refused before any prompt, with the entry and file to edit by hand, when the answer is not one unambiguous edit:
Situation
Result
Two or more entries reach the directory
Refused, naming each by workspace root and key
-f FILEnames a file whose definition loses at loadRefused, naming the file that wins
-f FILEnames a file vcspull does not read, and a file it reads defines the entryRefused, naming that file
-f FILEnames a file vcspull does not read, and nothing else defines the entryEdited; the alias selects the entry in commands run with the same
-fThe entry is defined only in a project or system file
Refused unless
-fnames that fileThe entry already has an alias
Refused; edit the file to change it
The entry is pinned
Refused; a pin protects it from every writer
--pin,--depth,--shallow,--name,-w, or a different URL is passedRefused
Before it asks for confirmation, an attach renders the edited file and loads it the way a reading command would. It writes only when the entry has the alias and every other entry is unchanged.
addnever changes or removes an alias; edit the file.discoverandimportnever write one, and both treat an aliased checkout as already configured.
Output¶
Human-readable rows show the alias after the name:
• docs (alias libtmux-docs) → ~/work/libtmux/docs
JSON rows carry
alias,nullwhen unset.nameis unchanged, so a script that readsnamekeeps working.
Options considered¶
alias:, an added handle (chosen)¶
A configuration without the key behaves exactly as before, and a term that matched yesterday matches today. The directory path stays the single identity of an entry, so the scope rules in Configuration scopes stay true as written.
The cost is that an alias is not guaranteed unique. Rule 6 accepts that: a
shared alias behaves like a shared directory name, and rules 8 to 10 make it
visible. An earlier draft made a shared alias inside one file a load error.
That was withdrawn, because one mistake committed to a configuration shared
between machines made list, status, and sync exit 1 on every machine
that pulled it, and no vcspull command could repair the file.
name: as a replacing handle¶
The handle replaces the name for matching and display while the directory stays put. Rejected:
sync docsin a script or scheduled job stops selecting the repository, with no error.name:already means “rename the entry and its directory”. Giving it a second meaning changes what existing configurations do.A replaced name has to be unique or something silently loses it, and the prototype’s uniqueness error let a project file stop every command in its tree.
id:, a unique identifier¶
An exact handle that outranks names and never globs. Rejected:
It adds a second identity beside the path-based one, and the two disagree across scopes. In the prototype, a project file that reused an id removed your checkout from
listand pointedsyncat its own, with exit 0.An id that outranks names lets a new entry retarget an existing term: adding an id
centralchanges whatsync centralselects.Globs do not reach ids, so
'libtmux-*'cannot select a family of repositories.
A unique alias would do the job of an id without a second identity. Rule 6 gives up enforced uniqueness on reads for the reason above; rule 7 keeps vcspull’s own writers from creating a duplicate.
Consequences¶
You can run
vcspull sync libtmux-docs, andstatusrows for same-named checkouts are distinguishable.Configurations without
alias:are unaffected, apart from the newaliasfield in JSON rows.The published configuration schema gains
aliaswith the same pattern the loader enforces.A handle can select more than one entry. Scripts that need exactly one repository keep using a path term.
addgains a second behaviour, attaching to an existing entry. Rules 13 to 15 exist because that is the part of the design where a wrong edit is possible.Removing or renaming an alias is a manual edit.
Not decided here¶
Aliases that start with
git,http,svn, orhg.syncreads such a term as a URL, the same limit a directory namedgit-toolshas today (#559). An alias such asgit-toolscannot be selected bysyncuntil that is settled.Where warnings print. vcspull writes warnings to stdout, next to
--jsonpayloads. A handle warning in front of a JSON payload breaks a parser that reads stdout, and a shared alias makes that reachable. Moving warnings to stderr is a separate decision.Conflicts between entries with the same name (#232). This record covers aliases only.
More than one alias per entry. A single string can widen to a list later without changing any rule above.
Case-insensitive filesystems. Aliases compare case-sensitively. The prototype was not run on Windows or macOS.
References¶
#586: Config has no way to give a repository an alias
#559:
synccannot match a name that starts withhttp,git,svn, orhg#232: Name conflicts
#592: roadmap, which lists repository aliases
Configuration scopes: how files in different scopes merge