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

Added Docker build, updated libgit2 and added some custom commands #99

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rraab-dev
Copy link

@rraab-dev rraab-dev commented Aug 16, 2024

Hello,

nice work on here. Since I use this code in a project as well and needed to add some functionality / commands. I hope the changes made could also be useful for others.

Added Dockerfile for Docker build:

  • Dockerfile and docker_cleanup_and_build.sh.
  • Added documentation for Docker build.

Updated libgit2 from version 1.7.1 to 1.8.1:

  • Removed git_error_clear() call in examples/checkout.c cause method had been removed.

Added new commands:

  • examples/branch.c: List local and remote branches. Delete local branches.
  • examples/log-last-commit-of-branch.c: Log info about latest commit of a branch.
  • examples/rebase.c: Interactive rebase functionality.

Changed commands:

  • examples/push.c: Does have an optional parameter --force for force pushing. (Needed after a rebase.)
  • examples/fetch.c: Does now --prune by default.
  • examples/init.c: Change default branch to main.
  • examples/diff.c: Added --full-file-content option which allows printing old_file and new_file content if available.

Others

  • Added HTTP basic auth for authentication with password or pat.
  • Added method writeArrayToMemory manually to post.js cause it was not found.

Eager to hear your feedback.

Regards
Rafael

@rraab-dev rraab-dev force-pushed the master branch 3 times, most recently from 030f9f9 to 86db9cc Compare August 19, 2024 10:06
@rraab-dev rraab-dev changed the title Added Docker build, updated libgit2 and added some useful commands Added Docker build, updated libgit2 and added some custom commands Aug 19, 2024
* Dockerfile and docker_cleanup_and_build.sh.
* Added documentation for Docker build.

Updated libgit2 from version 1.7.1 to 1.8.1:
* Removed git_error_clear() call in examples/checkout.c cause method had been removed.

Added new commands:
* examples/branch.c: List local and remote branches. Delete local branches.
* examples/log-last-commit-of-branch.c: Log info about latest commit of a branch.
* examples/rebase.c: Interactive rebase functionality.

Changed commands:
* examples/push.c: Does have an optional parameter --force for force pushing. (Needed after a rebase.)
* examples/fetch.c: Does now --prune by default.
* examples/init.c: Change default branch to main.
* examples/diff.c: Added --full-file-content option which allows printing old_file and new_file content if available.

Others
* Added HTTP basic auth for authentication with password or pat.
* Added method writeArrayToMemory manually to post.js cause it was not found.
@kkoomen
Copy link

kkoomen commented Sep 8, 2024

Would be awesome if you could also implement support for --depth 1 :D

@rraab-dev
Copy link
Author

Would be awesome if you could also implement support for --depth 1 :D

I implemented in examples/log-last-commit-of-branch.c a log with depth 1 for a branch. You can pass a branch name as parameter and log the latest commit of it.

Usage:
lg2 log-last-commit-of-branch {branch}

https://github.com/petersalomonsen/wasm-git/pull/99/files#diff-ac905392268f36588a7045a34d8ca4d3b31ea46e252db801ce9e663eee6e166c

If you want to clone a repository / fetch with depth --1 you have to change the fetch_opts inside the git_clone_options when a clone is performed.

@petersalomonsen petersalomonsen self-requested a review September 9, 2024 07:47
@petersalomonsen
Copy link
Owner

@rraab-dev thanks for your contribution.

Upgrading of libgit2 is always useful, thanks for going through that !

Adding of new commands is great. Are any of these also already in the libgit2 codebase? And for the changed commands, are these changes also according to standard command line git ( which I've attempted to maintain until now ).

I also enabled running the tests, and I see failures. I haven't looked deeper into why. Would you take a look to see if you can find the reason for the failures?

Also tests for your new commands and enhancements of existing commands would be great. This way we can ensure that future contributions will not cause breaking changes to the contributions you've made here. I would also appreciate if your changes does not require any existing tests to be changed, as that would mean a breaking change for existing apps that use wasm-git.

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.

3 participants