diff options
| author | Mike McQuaid | 2017-05-29 15:13:08 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2017-05-29 15:13:08 +0100 |
| commit | d7e2d5be36f2c14ddf4e2e8c5cc34001ab8b4ac5 (patch) | |
| tree | 8e378168273ba1517483857c1b429dd2b46c4532 | |
| parent | dbf10cc06e12d415f9913f24040566555242463d (diff) | |
| download | brew-d7e2d5be36f2c14ddf4e2e8c5cc34001ab8b4ac5.tar.bz2 | |
update-test: tweak more edge cases.
Don't try to `fetch --depth=1` unless we've confirmed the repository is
already shallow. Otherwise this can discard history from a full clone.
Additionally, if the repository wasn't shallow but there's no tags found
assume that Git is too old and try a naive sort if on Linux where `sort`
is able to sort versions.
| -rw-r--r-- | Library/Homebrew/dev-cmd/update-test.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index e65820750..aa7fe6a92 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -36,8 +36,12 @@ module Homebrew tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname") previous_tag = tags.lines[1] previous_tag ||= begin - safe_system "git", "fetch", "--tags", "--depth=1" - tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname") + if (HOMEBREW_REPOSITORY/".git/shallow").exist? + safe_system "git", "fetch", "--tags", "--depth=1" + tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname") + elsif OS.linux? + tags = Utils.popen_read("git tag --list | sort -rV") + end tags.lines[1] end previous_tag = previous_tag.to_s.chomp |
