k33g / gh3

Client-side Javascript API wrapper for GitHub API V3
370 stars 79 forks source link

Cannot fetch second level and up directory information or files #3

Closed ravishanker closed 12 years ago

ravishanker commented 12 years ago

The issue seems to be that branchname is being set to parent level directory and not the sub dir level

branchName: "master"

       var user = new Gh3.User("hogehoge");
        var repo = "hogehoge" ;

        var userRepo = new Gh3.Repository(repo, user);

        userRepo.fetch(function(err, res){
          userRepo.fetchBranches(function (err, res) {

            var master = userRepo.getBranchByName("master");

            master.fetchContents(function (err, res) {              
              var app = master.getDirByName("app");

              app.fetchContents(function(err, res){
                var views = app.getDirByName("views");  

               // this is needed to be work.
                views.branchName = "master";              

                views.fetchContents(function(err, res){

                  var users = views.getDirByName("users");

                  users.branchName = "master";

                  users.fetchContents(function(err, res){

                   console.log(users);

                  });

                }); // views

              }); //app

            }); //fetch header

          }) //fetch branches

        }); // fetch repo
k33g commented 12 years ago

Ouch, i've made a very nasty cut and paste :( ok it's fixed. Thanks a lot for the issue