ChimeraCoder / gitgo

A Go implementation of Git functions
Other
346 stars 25 forks source link

Switch baseDir to http.FileSystem #4

Open cryptix opened 9 years ago

cryptix commented 9 years ago

Hi!

http.FileSystem would allow to operate in remotes, too.

For locals you would just throw in 'http.Dir(baseDir)'.

dmitshur commented 8 years ago

FWIW, I think this is a fantastic idea. :+1:

ChimeraCoder commented 8 years ago

@shurcooL Thanks for the feedback! This looks feasible, and #5 was the first step towards this.

The challenge is that some of the original functions were written with the assumption that the file would be available locally. Any calls to os.Open (or even os.Stat) will need to be replaced.

I also need to think of how we would test for this given our current testing setup. As I understand it, we can't just test that the current tests work with the new logic. Since our test environment does provide access to the local filesystem, even if we pass in the base directory with http.Dir(baseDir) it will still allow hidden calls to functions that won't work with a remote repository (like os.Open called with a relative path). So we can't use the current tests to be sure that we have eliminated these.

There's probably a way around this; I'll need to think what it would be.

imranansari commented 7 years ago

any more thoughts/plans on this one?