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

major: Use git cli instead of grgit #111

Merged
merged 3 commits into from
Oct 6, 2024
Merged

major: Use git cli instead of grgit #111

merged 3 commits into from
Oct 6, 2024

Conversation

ajoberstar
Copy link
Owner

grgit is not really necessary for this plugin, decoupling it will improve a lot of things.

The expectation is for behavior equivalence, but I expect there will be some quirks from switching so this is considered a major version.

@ajoberstar ajoberstar force-pushed the no-grgit branch 3 times, most recently from 5d9bad2 to 185703d Compare October 6, 2024 04:20
grgit is not really necessary for this plugin, decoupling it will
improve a lot of things.

The expectation is for behavior equivalence, but I expect there will be
some quirks from switching so this is considered a major version.
@ajoberstar ajoberstar marked this pull request as ready for review October 6, 2024 04:29
@ajoberstar ajoberstar merged commit 381a2d1 into main Oct 6, 2024
1 check passed
@ajoberstar ajoberstar deleted the no-grgit branch October 6, 2024 04:29
@ciscoo
Copy link

ciscoo commented Oct 18, 2024

I think this change will help in resolving an issue I'm having internally at my company. Currently, publishing our documentation fails with an unhelpful error:

* What went wrong:
Execution failed for task ':documentation:gitPublishPush'.
  > org.ajoberstar.grgit.PushException: Failed to push: refs/heads/gh-pages to refs/heads/gh-pages (pre-receive hook declined)

JGit doesn't support several Git hooks and currently, any error raised is lost. Enabling debug logs for JGit also doesn't help either:

[DEBUG] [org.eclipse.jgit.transport.PacketLineIn] git< unpack ok
[DEBUG] [org.eclipse.jgit.transport.PacketLineIn] git< ng refs/heads/gh-pages pre-receive hook declined
[DEBUG] [org.eclipse.jgit.transport.PacketLineIn] git< 0000

We use owasp/sedated which is a pre-receive hook. It is a bit of a pain to figure out what is being blocked when the only log from JGit doesn't provide any information.

By using the git CLI directly, this should surface the error and anything else really which should help.

@ciscoo
Copy link

ciscoo commented Nov 13, 2024

Some early feedback from trying out 5.0.0-beta.1, it does not seem to work with the lightweight checkout in Jenkins. Previously it did without issue.

Disabling that and manually cloning the repo yields a different error:

hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
fatal: couldn't find remote ref refs/heads/gh-pages

Doing a git branch -a before ./gradlew gitPublishPush yields:

+ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/gh-pages
  remotes/origin/master

So, to me there is some regression here I think since the previous implementation worked when using grgit/jgit.

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.

2 participants