Fix update commit for non-HEAD kegs with head spec (#644)

If we try to call `Formulary.from_keg(f, :head)` on the keg that
is not HEAD-keg itself, we don't need to update commit of
returned formula and should use just HEAD version with nil commit.

Same is true for `ARGV.resolved_formulae`
This commit is contained in:
Uladzislau Shablinski 2016-08-06 11:22:12 +03:00 committed by Xu Cheng
parent 8ec59253df
commit 63c563f970
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ module HomebrewArgvExtension
f.build = tab
if f.head? && tab.tabfile
k = Keg.new(tab.tabfile.parent)
f.version.update_commit(k.version.version.commit)
f.version.update_commit(k.version.version.commit) if k.version.head?
end
end
f

View File

@ -246,7 +246,7 @@ class Formulary
end
end
f.build = tab
f.version.update_commit(keg.version.version.commit) if f.head?
f.version.update_commit(keg.version.version.commit) if f.head? && keg.version.head?
f
end