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

keys is not consistent with git-fs-db@0.2.0 #2

Open
bryanburgers opened this issue Jul 16, 2014 · 0 comments · May be fixed by #3
Open

keys is not consistent with git-fs-db@0.2.0 #2

bryanburgers opened this issue Jul 16, 2014 · 0 comments · May be fixed by #3

Comments

@bryanburgers
Copy link

The result of the keys method with a prefix is different than the result of the keys method with a prefix for git-fs-db version 0.2.0. See output from the following bit of code:

var platform = require('git-node-platform');
var memdb = require('git-memdb');
var fsDb = require('git-fs-db')(platform);
var fs = platform.fs;

var filesystemDb = fsDb(fs('tmp'));
var memoryDb = memdb();

function doit(db, callback) {
    db.set('refs/heads/master', 'a874178823acbf493d12f44fc6aac5b3869903f1', function() {
        db.set('refs/heads/old', 'a874178823acbf493d12f44fc6aac5b3869903f1', function() {
            db.set('refs/tags/v1.0.0', 'a874178823acbf493d12f44fc6aac5b3869903f1', function() {
                db.keys('refs', function(err, list) {
                    callback(null, list);
                });
            });
        });
    });
}

memoryDb.init(function() {
    doit(filesystemDb, function(err, list) {
        console.log(list);
        doit(memoryDb, function(err, list) {
            console.log(list);
        });
    });
});

Outputs:

[ 'heads', 'tags' ]
[ '/heads/master', '/heads/old', '/tags/v1.0.0' ]

So while git-fs-db normalizes the output from keys, git-memdb does not.

This causes js-git@0.5.4#fetch to fetch more than it needs to.

@bryanburgers bryanburgers linked a pull request Jul 16, 2014 that will close this issue
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 a pull request may close this issue.

1 participant