-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
hardware config: fix git add logic #424
Conversation
The CI failure is related to a test case where we have git but the local repo is not git-tracked. I guess we should check if the local repo is git-tracked before failing? |
188183a
to
35f99c9
Compare
CI fixed. This is ready for review. |
pushd "$(dirname "$hardwareConfigPath")" | ||
git add --intent-to-add --force -- "$hardwareConfigPath" >/dev/null 2>&1 || true | ||
popd | ||
if git rev-parse --is-inside-work-tree >/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does this mean users have to change into the repository for this to work?
I can imagine that users would do something like
nixos-anywhere --flake $HOME/git/my-config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Riiight, I get the pushd/popd part now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
b1d192d
to
bae44b6
Compare
Fixing the git add hardware config logic in case the user provides a relative path. We're doing two things: 1. Failing loudly if we're in a git repo and the git add command fails. At that point, we already know git is in $PATH. If the git add fails, the evaluation will likely fail in a flake setting. Better fail early with a helpful git error message. 2. We're resolving the hardware config path in the CLI parsing layer to make sure this path has the meaning the user intented it to have.
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 548b4a9 |
Fixing the git add hardware config logic in case the user provides a relative path. We're doing two things: