Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

'--HEAD' does not install HEAD #7613

Closed
mybuddymichael opened this issue Sep 13, 2011 · 3 comments
Closed

'--HEAD' does not install HEAD #7613

mybuddymichael opened this issue Sep 13, 2011 · 3 comments

Comments

@mybuddymichael
Copy link
Contributor

In installing rbenv with "--HEAD", brew does not install the actual HEAD, but instead installs the most recently tagged commit, despite a "head" url being declared in the formula.

@Sharpie
Copy link
Contributor

Sharpie commented Sep 13, 2011

Looks like the latest commit is being fetched to me:

grendel:~ sharpie$ brew fetch rbenv --HEAD
==> Cloning https://github.com/sstephenson/rbenv.git
Cloning into /Users/sharpie/Library/Caches/Homebrew/rbenv--git...
remote: Counting objects: 139, done.
remote: Compressing objects: 100% (109/109), done.
remote: Total 139 (delta 66), reused 73 (delta 24)
Receiving objects: 100% (139/139), 45.01 KiB, done.
Resolving deltas: 100% (66/66), done.
grendel:~ sharpie$ git ls-remote https://github.com/sstephenson/rbenv.git HEAD
b4f8906b246711db4c5116a12b6d9b0772084b97    HEAD
grendel:~ sharpie$ cd `brew --cache`/rbenv--git && git log --oneline | head -n 1
b4f8906 Update zsh completion adapter

What are you seeing that suggests the latest version is not being used?

@mybuddymichael
Copy link
Contributor Author

The problem was that there were previous versions of rbenv in my brew --cache. Even with the --HEAD flag, it still used the cached tar files. Once I removed those cached tar files, brew installed HEAD fine. So perhaps this issue should now be, "brew doesn't respect the --HEAD flag if there are cached tars."

@jacknagel
Copy link
Contributor

Ah, found the bug.

When updating a git checkout, Homebrew does a git reset --hard without specifying a revision, so it just resets to what is currently in HEAD. Which isn't what it just fetched. It should probably be git reset --hard origin/HEAD.

Sharpie pushed a commit to Sharpie/homebrew that referenced this issue Sep 19, 2011
When installing with --HEAD, cached repo clones do "git fetch origin"
followed by "git reset --hard". This will only reset the working tree
and index to the state of the local HEAD, but Homebrew will think it's
updated and install anyway. "git reset --hard origin/master" will
achieve the desired result.

Should fix Homebrew#7613.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
martinploeger pushed a commit to martinploeger/homebrew that referenced this issue Oct 8, 2011
When installing with --HEAD, cached repo clones do "git fetch origin"
followed by "git reset --hard". This will only reset the working tree
and index to the state of the local HEAD, but Homebrew will think it's
updated and install anyway. "git reset --hard origin/master" will
achieve the desired result.

Should fix Homebrew#7613.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Dec 27, 2011
When installing with --HEAD, cached repo clones do "git fetch origin"
followed by "git reset --hard". This will only reset the working tree
and index to the state of the local HEAD, but Homebrew will think it's
updated and install anyway. "git reset --hard origin/master" will
achieve the desired result.

Should fix Homebrew#7613.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012
When installing with --HEAD, cached repo clones do "git fetch origin"
followed by "git reset --hard". This will only reset the working tree
and index to the state of the local HEAD, but Homebrew will think it's
updated and install anyway. "git reset --hard origin/master" will
achieve the desired result.

Should fix Homebrew#7613.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants