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

Add LGitRemote>>defaultBranchName (WIP) #40

Closed
wants to merge 1 commit into from

Conversation

tinchodias
Copy link
Collaborator

I tested it locally with this code:

| aRepo aRemote |

aRepo := LGitRepository on: '/Users/tinchodias/d/iceberg-shared-repositories/iceberg' asFileReference.
aRepo open.

aRemote := LGitRemote of: aRepo named: 'pharo-vcs'.
aRemote lookup; connectFetch.
aRemote defaultBranchName. "'refs/heads/dev-1.8'"

TODO:

  • Add test.
  • Answer a LGitBranch instead of only a String.
  • Need to disconnect after connectFetch?
  • Support libgit < 1.0.0?

Answer the name of the remote's default branch.
@tinchodias
Copy link
Collaborator Author

Tried to implement it after the following chat in #iceberg channel in Discord:

Screen Shot 2020-12-02 at 12 26 40

@tinchodias
Copy link
Collaborator Author

  • Need to disconnect after connectFetch?

There is an API function to disconnect but there is no requirement about disconnecting (neither in connect or the example).
I guess it's done by the free.

--- update --

Yes, when the remote is freed the connection is closed: https://libgit2.org/libgit2/#v1.0.0/group/remote/git_remote_free

@tinchodias
Copy link
Collaborator Author

  • Support libgit < 1.0.0?

No, we shouldn't care of it for next versions of Iceberg.

@tesonep
Copy link

tesonep commented Mar 25, 2021

@tinchodias is this still relevant?

@tinchodias
Copy link
Collaborator Author

Yes, I'd do a little pass again. But it doesn't harm to have it... it's API provided by libgit2 that wasn't bound yet.

IIRC, after this is available, it would be possible that Metacello uses it to determine what's the branch to load when there is no explicit :commitish...

Anyway, I have no idea of how possible is to have that modification in Metacello. It may break something.

@pdebruic
Copy link

Could also use the .project file and have Metacello look for that.

@guillep
Copy link
Member

guillep commented Sep 6, 2022

Hi @tinchodias are there news on this front?

@astares
Copy link

astares commented Dec 16, 2022

@tinchodias Any update on this?

Comment on lines +4 to +9
ifTrue: [
self shouldBeImplemented.
self remote_connect_v0251: remote direction: direction callbacks: remoteCallbacks ]
ifFalse: [
self remote_connect_v100: remote direction: direction callbacks: remoteCallbacks ]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tesonep @guillep @astares do we still need to support <v1.0.0 ?
I don't remember now details but evidently I needed to add this version-dependent code... And I suspect we can assume >=v1.0.0.

buf := LGitBuf new.
[ self withReturnHandlerDo: [
self remote_default_branch: buf ].
defaultBranchName := buf prim_ptr readStringUTF8.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This readStringUTF8 needs update, I think

@tinchodias
Copy link
Collaborator Author

Please check #71

@tinchodias tinchodias closed this Dec 25, 2022
@tinchodias tinchodias deleted the remote-default-branch-name branch December 26, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants