libgit2 프로젝트에 노드 바인딩.
안정 ([email protected]) : 0.28.3
slack.libgit2.org를 방문하여 가입 한 다음 #NodeGit에 참여하십시오.
Tyler Ang-Wanek @twwanek 수많은 굉장한 기고자들의 도움을받습니다!
Tim Branyen @tbranyen, John Haley @Johnhaley81, Max Korp @MaxKorp, Steve Smith @OrderedList, Michael Robinson @CodeofInterest 및 Nick Kallen @NK
http://www.nodegit.org/
Nodegit은 기본 종속성없이 대부분의 시스템에서 상자 외부 시스템에서 작동합니다.
npm install nodegitTravis-CI를 구축 할 때 일반적으로 경험되는 LibStdc ++에 대한 오류를받는 경우 최신 LIBSTDC ++ -4.9로 업그레이드하여이를 해결할 수 있습니다.
우분투에서 :
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libstdc++-4.9-dev트래비스에서 :
addons :
apt :
sources :
- ubuntu-toolchain-r-test
packages :
- libstdc++-4.9-devCircleci에서 :
dependencies :
pre :
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update
- sudo apt-get install -y libstdc++-4.9-devLifecyclescripts Preinstall/Install에 대한 오류를 받으면 Ubuntu에서 libssl-dev를 놓칠 것입니다.
sudo apt-get install libssl-dev
Linux 시스템에 다음 라이브러리가 설치되어야합니다.
로컬로 구축 할 때는 Kerberos 및 PCRE 용 개발 패키지가 필요 하므로이 유틸리티는 기계에 포함되어 있어야합니다.
설치 중에 여전히 문제가 발생하는 경우 소스 지침에서 건물을 사용해야합니다.
var Git = require ( "nodegit" ) ;
// Clone a given repository into the `./tmp` folder.
Git . Clone ( "https://github.com/nodegit/nodegit" , "./tmp" )
// Look up this known commit.
. then ( function ( repo ) {
// Use a known commit sha from this repository.
return repo . getCommit ( "59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5" ) ;
} )
// Look up a specific file within that commit.
. then ( function ( commit ) {
return commit . getEntry ( "README.md" ) ;
} )
// Get the blob contents from the file.
. then ( function ( entry ) {
// Patch the blob to contain a reference to the entry.
return entry . getBlob ( ) . then ( function ( blob ) {
blob . entry = entry ;
return blob ;
} ) ;
} )
// Display information about the blob.
. then ( function ( blob ) {
// Show the path, sha, and filesize in bytes.
console . log ( blob . entry . path ( ) + blob . entry . sha ( ) + blob . rawsize ( ) + "b" ) ;
// Show a spacer.
console . log ( Array ( 72 ) . join ( "=" ) + "nn" ) ;
// Show the entire file.
console . log ( String ( blob ) ) ;
} )
. catch ( function ( err ) { console . log ( err ) ; } ) ; var Git = require ( "nodegit" ) ;
// Open the repository directory.
Git . Repository . open ( "tmp" )
// Open the master branch.
. then ( function ( repo ) {
return repo . getMasterCommit ( ) ;
} )
// Display information about commits on master.
. then ( function ( firstCommitOnMaster ) {
// Create a new history event emitter.
var history = firstCommitOnMaster . history ( ) ;
// Create a counter to only show up to 9 entries.
var count = 0 ;
// Listen for commit events from the history.
history . on ( "commit" , function ( commit ) {
// Disregard commits past 9.
if ( ++ count >= 9 ) {
return ;
}
// Show the commit sha.
console . log ( "commit " + commit . sha ( ) ) ;
// Store the author object.
var author = commit . author ( ) ;
// Display author information.
console . log ( "Author:t" + author . name ( ) + " <" + author . email ( ) + ">" ) ;
// Show the commit date.
console . log ( "Date:t" + commit . date ( ) ) ;
// Give some space and show the message.
console . log ( "n " + commit . message ( ) ) ;
} ) ;
// Start emitting events.
history . start ( ) ;
} ) ; 더 많은 예를 보려면 examples/ 폴더를 확인하십시오.
테스트를 실행하기 전에 로컬로 구축해야합니다. 위를 참조하십시오.
npm test