mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
GitInputScheme: Do not record 'ref' for dirty trees
The URLs 'git+file:///foo' and 'git+file:///foo?rev=bla' are not exactly the same. The former can use the dirty tree at /foo, while the latter won't (it will use the latest committed revision of branch 'bla'). So since we use the latter in the in-memory lock file, the subsequent call to fetchTree won't be able to see any dirty changes to /foo, which isn't what we want.
This commit is contained in:
parent
89f10212f6
commit
120bec5595
1 changed files with 7 additions and 7 deletions
|
@ -281,7 +281,7 @@ struct GitInputScheme : InputScheme
|
||||||
/* URL of the repo, or its path if isLocal. */
|
/* URL of the repo, or its path if isLocal. */
|
||||||
std::string url;
|
std::string url;
|
||||||
|
|
||||||
void checkDirty() const
|
void warnDirty() const
|
||||||
{
|
{
|
||||||
if (isDirty) {
|
if (isDirty) {
|
||||||
if (!fetchSettings.allowDirty)
|
if (!fetchSettings.allowDirty)
|
||||||
|
@ -753,12 +753,10 @@ struct GitInputScheme : InputScheme
|
||||||
return {accessor, input};
|
return {accessor, input};
|
||||||
}
|
}
|
||||||
|
|
||||||
repoInfo.checkDirty();
|
if (!repoInfo.isDirty) {
|
||||||
|
|
||||||
auto ref = getDefaultRef(repoInfo);
|
auto ref = getDefaultRef(repoInfo);
|
||||||
input.attrs.insert_or_assign("ref", ref);
|
input.attrs.insert_or_assign("ref", ref);
|
||||||
|
|
||||||
if (!repoInfo.isDirty) {
|
|
||||||
auto rev = updateRev(input, repoInfo, ref);
|
auto rev = updateRev(input, repoInfo, ref);
|
||||||
|
|
||||||
input.attrs.insert_or_assign(
|
input.attrs.insert_or_assign(
|
||||||
|
@ -769,11 +767,13 @@ struct GitInputScheme : InputScheme
|
||||||
"lastModified",
|
"lastModified",
|
||||||
getLastModified(repoInfo, repoInfo.url, rev));
|
getLastModified(repoInfo, repoInfo.url, rev));
|
||||||
} else {
|
} else {
|
||||||
|
repoInfo.warnDirty();
|
||||||
|
|
||||||
// FIXME: maybe we should use the timestamp of the last
|
// FIXME: maybe we should use the timestamp of the last
|
||||||
// modified dirty file?
|
// modified dirty file?
|
||||||
input.attrs.insert_or_assign(
|
input.attrs.insert_or_assign(
|
||||||
"lastModified",
|
"lastModified",
|
||||||
getLastModified(repoInfo, repoInfo.url, ref));
|
getLastModified(repoInfo, repoInfo.url, "HEAD"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {makeFSInputAccessor(CanonPath(repoInfo.url), listFiles(repoInfo), std::move(makeNotAllowedError)), input};
|
return {makeFSInputAccessor(CanonPath(repoInfo.url), listFiles(repoInfo), std::move(makeNotAllowedError)), input};
|
||||||
|
|
Loading…
Reference in a new issue