diff options
| author | Dabrien 'Dabe' Murphy | 2014-07-22 18:14:03 -0400 | 
|---|---|---|
| committer | Jack Nagel | 2014-07-23 21:07:02 -0500 | 
| commit | 2837c8abe38b784fc27a6048de2720497809255c (patch) | |
| tree | b589f11032302ace45a2f5aa4de13a2d71b7bfa3 /Library/Homebrew/download_strategy.rb | |
| parent | e603e5a8c97bbfb5fef66b3936a237d541381a08 (diff) | |
| download | homebrew-2837c8abe38b784fc27a6048de2720497809255c.tar.bz2 | |
Modify "git rev-parse --verify" args in "has_ref?"
Per the `git-rev-parse(1)` manpage:
  --verify Verify that exactly one parameter is provided, and that it
  can be turned into a raw 20-byte SHA-1 that can be used to access the
  object database. If so, emit it to the standard output; otherwise,
  error out.
  If you want to make sure that the output actually names an object in
  your object database and/or can be used as a specific type of object
  For example, git rev-parse "$VAR^{commit}" will make sure $VAR names
  an existing object that is a commit-ish (i.e. a commit, or an
  annotated tag that points at a commit).
That actually means that:
  git rev-parse --verify af8e768e2bd3b4398bca033998f83b0eb8874914
will _always_ return the SHA-1 hash — regardless of whether or not
that's actually a valid reference!
Thus, when `GitDownloadStragtegy#update_repo` tries to check
`has_ref?`, it mistakenly succeeds, and doesn't actually do a `git fetch
origin`.
The fix is to use:
  git rev-parse --verify "af8e768e2bd3b4398bca033998f83b0eb8874914^{commit}"
Fixes #31045.
Closes #31054.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index b61a994a3..e7478bb4f 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -515,7 +515,7 @@ class GitDownloadStrategy < VCSDownloadStrategy    end    def has_ref? -    quiet_system 'git', '--git-dir', git_dir, 'rev-parse', '-q', '--verify', @ref +    quiet_system 'git', '--git-dir', git_dir, 'rev-parse', '-q', '--verify', "#{@ref}^{commit}"    end    def repo_valid? | 
