Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not open a debugger if libgit2 is not present #1731

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BaselineOfIceberg/BaselineOfIceberg.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ BaselineOfIceberg >> libgit: spec [
baseline: 'LibGit'
with: [
spec
repository: 'github://pharo-vcs/libgit2-pharo-bindings:v3.0.6';
repository: 'github://pharo-vcs/libgit2-pharo-bindings:v3.0.7';
loads: 'default' ].
spec
project: 'LibGit-Tests'
Expand Down
5 changes: 5 additions & 0 deletions Iceberg-Libgit/IceLibgitRepository.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,11 @@ IceLibgitRepository >> remoteTrackedBranches [
{ #category : #'API - remotes' }
IceLibgitRepository >> remotes [

LGitLibrary uniqueInstance isAvailable
ifFalse: [
'No libgit2 available, skipping.' crTrace.
^ #() ].

self handleLibgitError: [ | gitRemotes |
self isValid ifFalse: [ ^ #() ].
gitRemotes := self repositoryHandle allRemotes.
Expand Down
19 changes: 18 additions & 1 deletion Iceberg-TipUI/IceTipRepositoriesBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Class {
#superclass : #IceTipBrowser,
#instVars : [
'currentGroupPanel',
'repositoryNotebook'
'repositoryNotebook',
'notifyPanel'
],
#category : #'Iceberg-TipUI-View-Repository'
}
Expand Down Expand Up @@ -103,6 +104,14 @@ IceTipRepositoriesBrowser class >> newOnRepositoryProvider: aProvider [
yourself
]

{ #category : #initialization }
IceTipRepositoriesBrowser >> addLibGitNotAvailableWarning [

notifyPanel layout add: (notifyPanel newLabel
label: 'There is no libgit2 available in your system! Please verify everything is fine before continue.';
yourself)
]

{ #category : #initialization }
IceTipRepositoriesBrowser >> connectPresenters [

Expand All @@ -127,6 +136,7 @@ IceTipRepositoriesBrowser >> defaultKeyboardFocus [
IceTipRepositoriesBrowser >> defaultLayout [

^ SpBoxLayout newTopToBottom
add: notifyPanel expand: false;
add: repositoryNotebook;
yourself
]
Expand Down Expand Up @@ -155,6 +165,10 @@ IceTipRepositoriesBrowser >> initialExtentForWindow [
{ #category : #initialization }
IceTipRepositoriesBrowser >> initializePresenters [

notifyPanel := self newPresenter.
notifyPanel layout: SpBoxLayout newVertical.
notifyPanel addStyle: 'libgit2NotAvailable'.

repositoryNotebook := self newNotebook
]

Expand Down Expand Up @@ -259,6 +273,9 @@ IceTipRepositoriesBrowser >> titleForWindow [
{ #category : #initialization }
IceTipRepositoriesBrowser >> updatePresenter [

LGitLibrary uniqueInstance isAvailable
ifFalse: [ self addLibGitNotAvailableWarning ].

self model repositoryGroups do: [ :group |
repositoryNotebook
addPageTitle: group label
Expand Down
17 changes: 13 additions & 4 deletions Iceberg-TipUI/IceTipRepositoryModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ IceTipRepositoryModel >> branchModelFor: aBranch [

{ #category : #accessing }
IceTipRepositoryModel >> branchName [
self entity isMissing ifTrue: [ ^ self class unknownBranchLabel ].

^ self entity head description.
(self isLibGitAvailable not or: [ self entity isMissing ])
ifTrue: [ ^ self class unknownBranchLabel ].

^ self entity head description
]

{ #category : #accessing }
Expand Down Expand Up @@ -110,15 +112,15 @@ IceTipRepositoryModel >> description [
| text |

text := self displayString.
self entity isModified
(self isLibGitAvailable and: [ self entity isModified ])
ifTrue: [ text := '*', text ].
^ text
]

{ #category : #accessing }
IceTipRepositoryModel >> descriptionDecorator [

self entity isModified
(self isLibGitAvailable and: [ self entity isModified ])
ifTrue: [ ^ IceTipDescriptionDecorator modified ].
^ super descriptionDecorator
]
Expand Down Expand Up @@ -175,6 +177,12 @@ IceTipRepositoryModel >> isDetached [
or: [ self entity head isDetached ]
]

{ #category : #'private - testing' }
IceTipRepositoryModel >> isLibGitAvailable [

^ LGitLibrary uniqueInstance isAvailable
]

{ #category : #'private - testing' }
IceTipRepositoryModel >> isLoaded [
^ self entity loadedPackages notEmpty
Expand Down Expand Up @@ -425,6 +433,7 @@ IceTipRepositoryModel >> status [
| status incoming outgoing |

self verifyDirectoryStructureIfMissing: [ :message | ^ message asString ].
self isLibGitAvailable ifFalse: [ ^ 'Unknown (No libgit2)' ].

entity workingCopy workingCopyState isUnknownCommitState
ifTrue: [ ^ entity workingCopy workingCopyState description ].
Expand Down
19 changes: 11 additions & 8 deletions Iceberg-TipUI/IceTipStyleContributor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ Class {
IceTipStyleContributor >> styleSheetContribution [

^ SpStyle newApplication
addClass: 'textInputField' with: [ :textClass |
textClass addClass: 'iceTipReadonly' with: [ :iceTipReadonly |
iceTipReadonly addPropertyDrawWith: [ :draw | draw color: Color transparent ] ]] ;
addClass: 'text' with: [ :textClass |
textClass addClass: 'iceTipReadonly' with: [ :iceTipReadonly |
iceTipReadonly addPropertyDrawWith: [ :draw | draw color: Color transparent ].
textClass addClass: 'iceTipText4Lines' with: [ :iceTipText4Lines |
iceTipText4Lines addPropertyGeometryWith: [ :geo | geo height: 80 ] ] ] ];
addClass: 'libgit2NotAvailable' with: [ :aClass | aClass
addPropertyDrawWith: [ :draw | draw backgroundColor: Color orange ];
addPropertyFontWith: [ :font | font color: Color white ] ];
addClass: 'textInputField' with: [ :textClass | textClass
addClass: 'iceTipReadonly' with: [ :iceTipReadonly | iceTipReadonly
addPropertyDrawWith: [ :draw | draw color: Color transparent ] ] ];
addClass: 'text' with: [ :textClass | textClass
addClass: 'iceTipReadonly' with: [ :iceTipReadonly | iceTipReadonly
addPropertyDrawWith: [ :draw | draw color: Color transparent ];
addClass: 'iceTipText4Lines' with: [ :iceTipText4Lines | iceTipText4Lines
addPropertyGeometryWith: [ :geo | geo height: 80 ] ] ] ];
yourself
]