Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use on repos without commits #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jtojnar
Copy link

@jtojnar jtojnar commented Nov 13, 2020

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
Copy link
Author

jtojnar commented Nov 13, 2020

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.

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.

1 participant