1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 11:43:15 +02:00

Add a test for shallow Git clones

Also, don't return a revCount anymore for shallow or dirty Git trees,
since it's incorrect.

Closes #2988.
This commit is contained in:
Eelco Dolstra 2020-03-16 13:20:32 +01:00
parent 34c7645a58
commit fbcb897e21
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 21 additions and 6 deletions

View file

@ -67,8 +67,9 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va
auto rev2 = input2->getRev().value_or(Hash(htSHA1));
mkString(*state.allocAttr(v, state.symbols.create("rev")), rev2.gitRev());
mkString(*state.allocAttr(v, state.symbols.create("shortRev")), rev2.gitShortRev());
assert(tree.info.revCount);
mkInt(*state.allocAttr(v, state.symbols.create("revCount")), *tree.info.revCount);
// Backward compatibility: set 'revCount' to 0 for a dirty tree.
mkInt(*state.allocAttr(v, state.symbols.create("revCount")),
tree.info.revCount.value_or(0));
v.attrs->sort();
if (state.allowedPaths)