christkv / node-git

A node.js git implementation modeled on ruby-git
242 stars 42 forks source link

Fixes node-git for node v0.10 #25

Closed gierschv closed 11 years ago

gierschv commented 11 years ago

I didn't replaced the embedded zlib calls since these one are synchronous and I don't have to rewrite half of the module with an asynchronous design.

Cheers, Vincent

test_actor
✔ Should create actor from string seperating name and email
✔ Should create actor from string only containing name
✔ Should correctly return name when calling toString()

test_blame
✔ Should correctly provide simple blame
✔ Should correctly provide deep blame

test_blame_tree
✔ Should correctly retrieve blame tree
✔ Should correctly retrieve blame tree path
✔ Should correctly retrieve blame tree for multiple paths

test_blob
✔ Should not locate blob
✔ Should correctly return blob contents
✔ Should correctly cache data
✔ Should correctly return the file size
✔ Should correctly return mime_type for known types
✔ Should correctly return text plain for unknown types
✔ Should correctly grab the blame
✔ Should correctly return the base name

test_commit
✔ Test commit bake
✔ Test abbreviation of id
✔ Test commit count
✔ Test correct execution of diff
✔ Test diff with two commits
✔ Test diff with files
✔ Test diff with two commits and files
✔ Test diffs
✔ Test diffs on initial import
✔ Test diffs on initial import with empty commit
✔ Test diffs with mode only change
✔ Test toString() override for the commit
✔ Test create patch from commit

test_commit_stats
✔ Should correctly retrieve commit stats
✔ Should correctly match the content

test_commit_write
✔ Should correctly fetch commit index
✔ Should correctly commit all

test_config
✔ Should correctly return an assoc array
✔ Should correctly set value

test_diff
✔ Test list from string new mode

test_file_index
✔ Count all entries
✔ Count for a given sha
✔ Retrieve all files for a commit
✔ Retrieve all commits for a given file
✔ Retrieve array of last commits
✔ Retrieve array of last commits based on regexp pattern
✔ Retrieve last commits containing a directory in array

test_git
✔ Should correctly call native git method
✔ Should fail to call wrong native method
✔ Should fail to call wrong native function with skip timeout
✔ Should correctly transform options
✔ Should correctly escape calls to the git shell
✔ Should correctly escape standalone argument

test_git_alt
✔ Should correctly execute basic
✔ Should correctly work with clone of clone

test_git_basic
✔ Should correctly init gitdir
✔ Should correctly merge logs
✔ Should correctly honor max count
✔ Should correctly retrieve the diff between two commits
✔ Should correctly perform single diff
✔ Should correctly perform full diff
✔ Should correctly perform add diff
✔ Should correctly perform remove diff
✔ Should correctly cat file contents from commit
✔ Should correctly cat file contents from tree
✔ Should correctly cat file contents from blob
✔ Should correctly cat file size
✔ Should correctly execute ls_tree
✔ Should correctly execute ls_tree with blobs
✔ Should correctly execute ls_tree with treeish
✔ Should correctly execute ls_tree with ls_tree_paths
✔ Should correctly execute ls_tree with ls_tree_paths multi single
✔ Should correctly execute ls_tree with recursive
✔ Should correctly execute ls_tree with recursive and a commit
✔ Should correctly execute rev_list pretty
✔ Should correctly execute rev_list raw since
✔ Should correctly execute rev_list raw
✔ Should correctly execute rev_list
✔ Should correctly execute rev_list range
✔ Should correctly execute ls_tree_paths multi
✔ Should correctly execute ls_tree_path
✔ Should correctly execute ls_tree_path deep
✔ Should correctly retrieve file type
✔ Should correctly execute ls_tree and return no sha found tree

test_git_iv2
✔ Should correctly execute basic test
✔ Should correctly test objects

test_head
✔ Should correctly fetch master
✔ Should correctly fetch submaster
✔ Should correctly fetch heads with slashes
✔ Should correctly test is_head function
✔ Should correctly test head count
✔ Should correctly include non-pack

test_index_status
✔ Should correctly add a file
✔ Should correctly add an array
✔ Should correctly remove a file
✔ Should correctly remove an array
✔ Should correctly execute status

test_merge
✔ Should correctly create merge from string

test_raw
✔ Should correctly parse the raw object

test_remote
✔ Should correctly parse the raw object

test_repo
✔ Should update refs packed
✔ Should raise error on invalid repo location
✔ Should raise error on non existing path
✔ Should correctly retrieve the description
✔ Should correctly return array of ref objects
✔ Should correctly return the current head
✔ Should correcty return array of head objects
✔ Should populate head data
✔ Should correctly fetch commits
✔ Should correctly retrieve the commit
✔ Should correctly retrieve the commit count
✔ Should correctly retrieve the repo tree
✔ Should correctly fetch blog instance
✔ Should correctly init bare
✔ Should correctly init bare with options
✔ Should correctly fork_bare
✔ Should correctly do a commit diff
✔ Should correctly locate alternates
✔ Should fail to retrieve alternates
✔ Should correctly set alternates
✔ Should fail to set alternates
✔ Should set empty alternates
✔ Should correctly test log
✔ Should test log with path and options
✔ Should correctly extract commit deltas from nothing new
✔ Should commit deltas from when other has new
✔ Should correctly select existing objects

test_submodule
✔ Should correctly extract the config
✔ Should correctly fetch config with windows lineendings
✔ Should correctly test no config
✔ Should correctly test empty config
✔ Should correctly extract base name

test_tag
✔ Should correctly fetch tag list and have correct string size
✔ Should correctly fetch tag list from string
✔ Should correctly fetch signed tag
✔ Should correctly fetch annotated tag
✔ Should correctly fetch packed tag
✔ Should correctly fetch packed annotated tag

test_tree
✔ Should correctly handle a no tree
✔ Should correctly return a tree from a content to string call
✔ Should correctly return blob from tree from string
✔ Should correctly return submodule from tree from string
✔ Should correctly return error due to invalid type
✔ Should correctly find file in tree
✔ Should correctly test find file with commits
✔ Should correctly extract base name

OK: 499 assertions (3670ms)
jankeromnes commented 11 years ago

Hi Vincent, thank you so much for fixing all this! I have a couple of minor nits below, but I'm actually really happy :)

gierschv commented 11 years ago
gierschv commented 11 years ago

The last issue is due do this fs.readdir that cannot guarantee the file order:

... and this fs.stat and the included syscalls (that can have a random execution time).

I tried a chain of asynchronous calls here to fix the second potential problem but since the original order of the file is random, I don't think we can have a guarantee order of the arrays in the tests.

jankeromnes commented 11 years ago

Thank you for investigating this. Indeed, one of the first comments in the node docs is "With the asynchronous methods there is no guaranteed ordering".

I think we could either sort the array (as suggested in this issue on stackoverflow) or perform our checks independently of order.