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

Support nixpkgs shallow clone and make use of github pull/<pr>/merge ref #426

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

azuwis
Copy link
Contributor

@azuwis azuwis commented Oct 27, 2024

Fix #267

@azuwis
Copy link
Contributor Author

azuwis commented Oct 27, 2024

$ git clone --depth=1 https://github.com/NixOS/nixpkgs
$ cd nixpkgs
$ nix run github:Mic92/nixpkgs-review/pull/426/head -- pr 351518
$ git -c fetch.prune=false fetch --no-tags --force https://github.com/NixOS/nixpkgs --depth=1 master:refs/nixpkgs-review/0 pull/351518/merge:refs/nixpkgs-review/1
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 5), reused 1 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (7/7), 1.22 KiB | 1.22 MiB/s, done.
From https://github.com/NixOS/nixpkgs
 * [new branch]          master                 -> refs/nixpkgs-review/0
 * [new ref]             refs/pull/351518/merge -> refs/nixpkgs-review/1
$ git worktree add /home/azuwis/.cache/nixpkgs-review/pr-351518-20/nixpkgs 1825613c2c01eee21c60a3311777595248749e62
Preparing worktree (detached HEAD 1825613c2)
Updating files: 100% (43824/43824), done.
HEAD is now at 1825613c2 Merge 5860fb10e356ed9ec92378f4a476cd19cd0568c5 into abe4b94d28bfe39b0b2cfa7217af260b7bc8626e

$ nom build --file /nix/store/7ycribm20g147m94w6aa5j6xgkkdaljl-nixpkgs-review/lib/python3.12/site-packages/nixpkgs_review/nix/review-shell.nix --nix-path 'nixpkgs=/home/azuwis/.cache/nixpkgs-review/pr-351518-20/nixpkgs nixpkgs-overlays=/tmp/tmpitb204xx' --extra-experimental-features 'nix-command no-url-literals' --no-link --keep-going --no-allow-import-from-derivation --option build-use-sandbox relaxed --argstr local-system x86_64-linux --argstr nixpkgs-path /home/azuwis/.cache/nixpkgs-review/pr-351518-20/nixpkgs --argstr nixpkgs-config-path /tmp/tmpvja4ylsy.nix --argstr attrs-path /home/azuwis/.cache/nixpkgs-review/pr-351518-20/attrs.nix
Finished at 23:11:59 after 0s

Link to currently reviewing PR:
https://github.com/NixOS/nixpkgs/pull/351518

--------- Report for 'x86_64-linux' ---------
2 packages built:
git-up git-up.dist


$ /home/azuwis/.nix-profile/bin/nom-shell --argstr local-system x86_64-linux --argstr nixpkgs-path /home/azuwis/.cache/nixpkgs-review/pr-351518-20/nixpkgs --argstr nixpkgs-config-path /tmp/tmpvja4ylsy.nix --argstr attrs-path /home/azuwis/.cache/nixpkgs-review/pr-351518-20/attrs.nix --nix-path 'nixpkgs=/home/azuwis/.cache/nixpkgs-review/pr-351518-20/nixpkgs nixpkgs-overlays=/tmp/tmpitb204xx' /nix/store/7ycribm20g147m94w6aa5j6xgkkdaljl-nixpkgs-review/lib/python3.12/site-packages/nixpkgs_review/nix/review-shell.nix


[nix-shell:~/.cache/nixpkgs-review/pr-351518-20]$

@azuwis azuwis force-pushed the push-snpnlpltsnsk branch from ace78ad to d2c0b50 Compare October 28, 2024 01:44
@azuwis
Copy link
Contributor Author

azuwis commented Oct 28, 2024

The CI tests should be fixed in latest push.

@azuwis azuwis force-pushed the push-snpnlpltsnsk branch from d6f4eeb to a218ae9 Compare October 28, 2024 09:26
base_rev, pr_rev = fetch_refs(
self.remote,
pr["base"]["ref"],
f"pull/{pr['number']}/merge",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact there is a race condition with this ref sometimes as github needs some time to compute it. But this is probably only relevant for CIs. So we should be unlikely to when humans run nixpkgs-review (except for @SuperSandro2000 maybe)

@Mic92
Copy link
Owner

Mic92 commented Oct 29, 2024

@mergify queue

Copy link
Contributor

mergify bot commented Oct 29, 2024

queue

🛑 The pull request has been merged manually

The pull request has been merged manually at 055465e

@Mic92 Mic92 merged commit 055465e into Mic92:master Nov 5, 2024
3 checks passed
@azuwis azuwis deleted the push-snpnlpltsnsk branch November 5, 2024 09:47
@azuwis
Copy link
Contributor Author

azuwis commented Nov 27, 2024

I've found one regression, if the PR is merged, pull/<PR>/merge will be gone, and won't be able to run nixpkgs-review against a merged PR after this.

@Mic92
Copy link
Owner

Mic92 commented Nov 27, 2024

Can we detect if /pull/<PR>/merge is available and otherwise fallback?

@azuwis
Copy link
Contributor Author

azuwis commented Nov 27, 2024

We can use git ls-remote origin refs/pull/<PR>/merge, and checkout the output.

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.

respect shallow/grafted nixpkgs repositories
2 participants