forked from nodegit/nodegit
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
feat: support node 22 #14
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
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            30 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      16e7f1f
              
                feat: patch zlib to build on node 22
              
              
                llimllib 7349c27
              
                format
              
              
                llimllib 1dc6b15
              
                add tests for node 22
              
              
                llimllib 65ead1b
              
                chore: try running the tests on mac 26
              
              
                llimllib 889318b
              
                fix: remove windows and beos patches
              
              
                llimllib 8fe0aa3
              
                fix: update test to not expect specific SHA
              
              
                llimllib aca7691
              
                chore: add a CLAUDE.md
              
              
                llimllib 1c2041a
              
                chore: bump to version 2
              
              
                llimllib 25ad787
              
                chore: run tests on publish job to test every arch
              
              
                llimllib beeef92
              
                fix: lint errors
              
              
                llimllib a8a80ce
              
                fix: do test setup to run tests
              
              
                llimllib 6b8c034
              
                feat: add node 22 builds to publish job
              
              
                llimllib 462e1af
              
                add arm-linux tests to CI
              
              
                llimllib 241af0f
              
                fix: attempt to fix memory issue on linux-arm
              
              
                llimllib 5d6bf27
              
                try just using atomic
              
              
                llimllib 4e07245
              
                remove tests from dockerignore
              
              
                llimllib cd384d9
              
                fix: try another fix, I dunno
              
              
                llimllib 09558f3
              
                revert: changes to generate
              
              
                llimllib 44a7fbb
              
                skip failing linux-arm tests
              
              
                llimllib 6452e0f
              
                fix: don't dockerignore test files
              
              
                llimllib 57d7b39
              
                chore: remove tests from publish job
              
              
                llimllib 41661ab
              
                Revert "chore: remove tests from publish job"
              
              
                llimllib 35db3b4
              
                chore: remove tests from publish job (actually)
              
              
                llimllib dcb8ca4
              
                chore: update package-lock
              
              
                llimllib 3d98bf0
              
                fix: try tagging node version
              
              
                llimllib c31d364
              
                feat: rename builds manually
              
              
                llimllib 6b8fa94
              
                fix: dockerfile syntax
              
              
                llimllib 027321b
              
                fix: gha var not bash var
              
              
                llimllib 8b192b5
              
                fix: try removing --napi
              
              
                llimllib 755004a
              
                fix: --napi=false gets abi version embedded
              
              
                llimllib File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,2 +1 @@ | ||
| node_modules | ||
| test | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| # NodeGit Development Guide | ||
|  | ||
| ## Overview | ||
|  | ||
| This is [@readme/nodegit](https://www.npmjs.com/package/@readme/nodegit), a fork of the original NodeGit library that provides Node.js bindings to libgit2. This fork is maintained by Readme and includes compatibility updates for Node.js 20 and 22. | ||
|  | ||
| ## Quick Start | ||
|  | ||
| ### Prerequisites | ||
| - Node.js >= 20 (supports Node 20 and 22) | ||
| - Git installed on your system | ||
| - Build tools (automatically handled during install) | ||
|  | ||
| ### Installation | ||
| ```bash | ||
| npm install | ||
| ``` | ||
|  | ||
| The install process automatically: | ||
| 1. Runs preinstall scripts | ||
| 2. Builds native bindings using node-gyp | ||
| 3. Runs postinstall scripts | ||
|  | ||
| ## Running Tests | ||
|  | ||
| ### Full Test Suite | ||
| ```bash | ||
| npm test | ||
| ``` | ||
| This runs linting followed by the complete test suite. | ||
|  | ||
| ### Tests Only (Skip Linting) | ||
| ```bash | ||
| npm run mocha | ||
| ``` | ||
|  | ||
| ### Debug Tests | ||
| ```bash | ||
| npm run mochaDebug | ||
| ``` | ||
| Runs tests with inspector for debugging. | ||
|  | ||
| ### Run Specific Tests | ||
| ```bash | ||
| # Run tests matching a pattern | ||
| npm run mocha -- --grep "pattern" | ||
|  | ||
| # Example: Run only commit tests | ||
| npm run mocha -- --grep "commit" | ||
|  | ||
| # Example: Run a specific test | ||
| npm run mocha -- --grep "can amend commit" | ||
| ``` | ||
|  | ||
| ### Linting Only | ||
| ```bash | ||
| npm run lint | ||
| ``` | ||
|  | ||
| ## Development Commands | ||
|  | ||
| ### Building | ||
| ```bash | ||
| # Full rebuild (includes code generation) | ||
| npm run rebuild | ||
|  | ||
| # Debug build | ||
| npm run rebuildDebug | ||
|  | ||
| # Recompile only (skip code generation) | ||
| npm run recompile | ||
| ``` | ||
|  | ||
| ### Code Generation | ||
| ```bash | ||
| # Generate missing tests | ||
| npm run generateMissingTests | ||
|  | ||
| # Generate native code bindings | ||
| npm run generateNativeCode | ||
|  | ||
| # Generate JSON API definitions | ||
| npm run generateJson | ||
| ``` | ||
|  | ||
| ## Test Structure | ||
|  | ||
| Tests are located in: | ||
| - `test/tests/` - Main test files | ||
| - `test/utils/` - Test utilities | ||
| - `test/repos/` - Test repositories | ||
|  | ||
| ### Common Test Issues | ||
|  | ||
| **macOS Version Compatibility**: Tests may fail when upgrading macOS versions due to differences in Git behavior, file system precision, or system libraries. Hardcoded expected commit IDs are particularly sensitive to environment changes. | ||
|  | ||
| **Memory Management**: Tests use `--expose-gc` flag to test garbage collection behavior with native bindings. | ||
|  | ||
| **SSH Tests**: Some tests require SSH keys located in `test/id_rsa*` files. | ||
|  | ||
| ## CI/CD | ||
|  | ||
| GitHub Actions workflows: | ||
| - **tests.yml**: Runs tests on Ubuntu 22.04 and macOS-26 | ||
| - **publish.yml**: Handles package publishing | ||
|  | ||
| ## Architecture | ||
|  | ||
| This library provides JavaScript bindings to the libgit2 C library: | ||
| - `src/` - C++ binding code | ||
| - `lib/` - Generated JavaScript APIs | ||
| - `generate/` - Code generation scripts | ||
| - `include/` - C++ headers | ||
| - `vendor/` - Vendored dependencies (libgit2) | ||
|  | ||
| ## Troubleshooting | ||
|  | ||
| ### Build Issues | ||
| ```bash | ||
| # Clean rebuild | ||
| rm -rf build node_modules | ||
| npm install | ||
| ``` | ||
|  | ||
| ### Test Failures | ||
| - Check that Git is properly configured: | ||
| ```bash | ||
| git config --global user.name "Test User" | ||
| git config --global user.email "test@example.com" | ||
| ``` | ||
| - Ensure SSH agent is running for SSH tests | ||
|  | ||
| ### Platform-Specific Issues | ||
| - **Linux**: May require libssl-dev, libkrb5-dev, and pcre development packages | ||
| - **macOS**: Uses clang compiler, may require Xcode command line tools | ||
| - **Windows**: Requires Visual Studio build tools | ||
|  | ||
| ## Contributing | ||
|  | ||
| 1. Run tests locally: `npm test` | ||
| 2. Ensure linting passes: `npm run lint` | ||
| 3. Test on target Node versions (20, 22) | ||
| 4. Update tests if adding new functionality | ||
|  | ||
| For more detailed API documentation, visit [nodegit.org](http://www.nodegit.org/). | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exclude
node_modulesbut allowtest? Are we running tests in the Docker container?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node_modulesis excluded because the docker container may have a different arch so native builds will not worktestwas excluded to speed up cross-compilation but: