Update nix flake documentation of ref handling

Update the documentation about how `ref` is resolved if it is not
specified.

Add a note about special handling of local workdirs with `git+file`.
This commit is contained in:
Kjetil Orbekk 2022-01-30 11:30:57 -05:00
parent 1203e48926
commit c21afd684c

View file

@ -153,7 +153,7 @@ Currently the `type` attribute can be one of the following:
git(+http|+https|+ssh|+git|+file|):(//<server>)?<path>(\?<params>)? git(+http|+https|+ssh|+git|+file|):(//<server>)?<path>(\?<params>)?
``` ```
The `ref` attribute defaults to `master`. The `ref` attribute defaults to resolving the `HEAD` reference.
The `rev` attribute must denote a commit that exists in the branch The `rev` attribute must denote a commit that exists in the branch
or tag specified by the `ref` attribute, since Nix doesn't do a full or tag specified by the `ref` attribute, since Nix doesn't do a full
@ -161,6 +161,11 @@ Currently the `type` attribute can be one of the following:
doesn't allow fetching a `rev` without a known `ref`). The default doesn't allow fetching a `rev` without a known `ref`). The default
is the commit currently pointed to by `ref`. is the commit currently pointed to by `ref`.
When `git+file` is used without specifying `ref` or `rev`, files are
fetched directly from the local `path` as long as they have been added
to the Git repository. If there are uncommitted changes, the reference
is treated as dirty and a warning is printed.
For example, the following are valid Git flake references: For example, the following are valid Git flake references:
* `git+https://example.org/my/repo` * `git+https://example.org/my/repo`