Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active April 9, 2020 09:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMCDragonkai/8966e26bcc147a0dca8e367a9e13a01a to your computer and use it in GitHub Desktop.
Save CMCDragonkai/8966e26bcc147a0dca8e367a9e13a01a to your computer and use it in GitHub Desktop.
Journey into Nix Package Repository #nix

Journey into Nix Package Repository

There are 2 commits that I need in my build:

  • 8d0e3ad603dda85462161bba1351893b84339462
  • 83e01aa5e48a9107f3b988c9d4c1c21d610626fb

Clone nixpkgs and add the nixpkgs-channels as a remote.

> git branch --all --contains 8d0e3ad603dda85462161bba1351893b84339462
  * master
    remotes/channels/nixos-unstable
    remotes/channels/nixos-unstable-small
    remotes/channels/nixpkgs-unstable
    remotes/origin/HEAD -> origin/master
    remotes/origin/master
    remotes/upstream/haskell-updates
    remotes/upstream/kevincox-hash-fix
    remotes/upstream/master
    remotes/upstream/staging
    remotes/upstream/staging-next
> git branch --all --contains 83e01aa5e48a9107f3b988c9d4c1c21d610626fb
  * master
    remotes/channels/nixos-unstable
    remotes/channels/nixos-unstable-small
    remotes/channels/nixpkgs-unstable
    remotes/origin/HEAD -> origin/master
    remotes/origin/master
    remotes/upstream/haskell-updates
    remotes/upstream/master
    remotes/upstream/staging
    remotes/upstream/staging-next

Both commits are unrelated:

> git merge-base --is-ancestor 83e01aa5e48a9107f3b988c9d4c1c21d610626fb 8d0e3ad603dda85462161bba1351893b84339462 && echo true || echo false
false
> git merge-base --is-ancestor 8d0e3ad603dda85462161bba1351893b84339462 83e01aa5e48a9107f3b988c9d4c1c21d610626fb && echo true || echo false
false

So to find the common descendant. We use:

> a=8d0e3ad603dda85462161bba1351893b84339462
> b=83e01aa5e48a9107f3b988c9d4c1c21d610626fb
> cmp <(git rev-list $a..master --ancestry-path) <(git rev-list $b..master --ancestry-path)
/proc/self/fd/11 /proc/self/fd/12 differ: byte 1313, line 33
> git rev-list $a..master --ancestry-path | sed -n '33p'
> git rev-list $b..master --ancestry-path | sed -n '33p'
> git rev-list $a..master --ancestry-path | sed -n '32p'
> git rev-list $b..master --ancestry-path | sed -n '32p'
28a09189166c767ad284adb9f7e137a3f98546a4
cff544bc99c2cc64a21bf1f305fa329632593945
87783a2900ba49a120730fc85fea7f268c38e528
87783a2900ba49a120730fc85fea7f268c38e528

But this common descendant only exists on master.

> git branch --all --contains 87783a2900ba49a120730fc85fea7f268c38e528
  * master
    remotes/channels/nixos-unstable-small
    remotes/origin/HEAD -> origin/master
    remotes/origin/master
    remotes/upstream/master

And it also has problems.

@CMCDragonkai
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment