Allow use on repos without commits #14

Closed
jtojnar wants to merge 1 commit from jtojnar/fresh-repos into master
jtojnar commented 2020-11-13 17:52:11 +00:00 (Migrated from github.com)

When starting a new repository, it does not have any branches in .git/refs/heads and .git/refs/HEAD contains a broken ref: refs/heads/master reference.

This means that cloning a repo like we do for cleaning will fail with very unhelpful message for freshly created repo:

fatal: bad revision 'HEAD'

This is quite confusing when you create a new repo by copying Nix files from another, working one, make some trivial changes, stage them and then try to test a shell.

When starting a new repository, it does not have any branches in `.git/refs/heads` and `.git/refs/HEAD` contains a broken `ref: refs/heads/master` reference. This means that cloning a repo like we do for cleaning will fail with very unhelpful message for freshly created repo: fatal: bad revision 'HEAD' This is quite confusing when you create a new repo by copying Nix files from another, working one, make some trivial changes, stage them and then try to test a shell.
jtojnar commented 2020-11-13 18:01:29 +00:00 (Migrated from github.com)

Test this by cloning a flake repo, remove the .git repository and stage all the files and then let nix-shell do its work.

# only reproducible with nix-direnv for some reason
nix-env -iA nix-direnv
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' >> ~/.direnvrc

git clone https://github.com/jtojnar/graby-double-images.git
cd graby-double-images
gio trash .git
git init
git add -A
direnv allow

Weirdly, I could not reproduce it with nix-shell or plain direnv but nix-direnv triggers it consistently with latest flake-compat and it is consistently not triggered by flake-compat from this branch.

Test this by cloning a flake repo, remove the `.git` repository and stage all the files and then let `nix-shell` do its work. ```bash # only reproducible with nix-direnv for some reason nix-env -iA nix-direnv echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' >> ~/.direnvrc git clone https://github.com/jtojnar/graby-double-images.git cd graby-double-images gio trash .git git init git add -A direnv allow ``` Weirdly, I could not reproduce it with `nix-shell` or plain `direnv` but [`nix-direnv`](https://github.com/nix-community/nix-direnv) triggers it consistently with latest flake-compat and it is consistently not triggered by flake-compat from this branch.
jade closed this pull request 2024-05-03 02:57:55 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.