GitTorrent icon indicating copy to clipboard operation
GitTorrent copied to clipboard

gittorrentd: Check cwd for .git/, too.

Open splinterofchaos opened this issue 9 years ago • 12 comments

From the commit message:

.git/git-daemon-export-ok may exist relative to the current directory, and the user may not want to supply all repositories from its parent.

Also, if you have a slow computer like I do and have hundreds of cloned repositories, glob('*/...') can take a very long time, making it seem like nothing's happening.

Will this file ever contain useful information, because it also might conversely be nice to allow users to pass a flag, like --export-all, to supply all repositories whether or not it has a .git/git-daemon-export-ok file.

splinterofchaos avatar May 31 '15 22:05 splinterofchaos

lol, looks like @anarcat made a PR for the same issue right when I did. (#26)

I like that solution more. Still curious about the --export-all flag, too, though.

splinterofchaos avatar May 31 '15 22:05 splinterofchaos

well, my thing is different: you seem to be wanting to torrent the git repository in the current directory. my PR adds bare repository support.

i think your PR is still relevant because of POLA...

anarcat avatar May 31 '15 22:05 anarcat

Oh, I misread your PR (and misunderstood what "bare" meant). I had looked for a way to express the subdirectory being option, without using **, in glob(...), but couldn't find one.

splinterofchaos avatar May 31 '15 22:05 splinterofchaos

maybe ?(*/)?(.git/)git-daemon-export-ok?

anarcat avatar May 31 '15 22:05 anarcat

?() doesn't seem to do what i think it does. try this instead: {,*/,*/.git/}git-daemon-export-ok.

anarcat avatar May 31 '15 22:05 anarcat

That's perfect. How about you just add that to #29 or #26 and I'll close this.

splinterofchaos avatar May 31 '15 22:05 splinterofchaos

Oh wait, doesn't work if the .git is in the current directory.

splinterofchaos avatar May 31 '15 23:05 splinterofchaos

Use this:

glob.sync('{,.git/,*/.git/}git-daemon-export-ok')

splinterofchaos avatar May 31 '15 23:05 splinterofchaos

:+1: but it's requires a reponame.

amirouche avatar Jun 01 '15 02:06 amirouche

@splinterofchaos #29 was merged, i suggest you reroll this PR...

anarcat avatar Jun 01 '15 18:06 anarcat

the reason why i didn't do it was that i wasn't sure it would work with no subdirs... and i couldn't test it easily.

anarcat avatar Jun 01 '15 18:06 anarcat

Rebased.

but it's requires a reponame.

Thanks, fixed.

EDIT: Actually, fixed is not the word I'd use: better. Do we use the information of the repository's name to inform peers that our branches/sha's beling to it? I think we need a better way of identifying them as directory names might not correspond one-to-one with repositories.

splinterofchaos avatar Jun 02 '15 03:06 splinterofchaos