#8095 Search for files in ForgeGit

unreleased
open
None
SCM
nobody
2016-07-12
2016-07-07
Rohan Verma
No

https://github.com/blog/793-introducing-the-file-finder

I have currently started to implement this by searching for blobs in the root tree with matching file names. This can be extended by searching the child trees to a certain depth to find the file. This is in the patch attached below.

So yesterday, I was looking to further implement this patch on the internet and was able to read the documentation of git python to use the git ls-files command and found this http://gitpython.readthedocs.io/en/stable/reference.html#git.cmd.Git

But i'm not sure if this is the way to go about it since this will be limited to git repositories and I guess the previous method will be useful for all SCM repos.

Also, I'm thinking that we should just expose this function via REST and use JS to display the search results instead on demand.

Would like to know suggestions on how to further go about this.

1 Attachments

Discussion

  • Rohan Verma - 2016-07-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,7 +4,7 @@
    
     So yesterday, I was looking to further implement this patch on the internet and was able to read the documentation of git python to use the git ls-files command and found this http://gitpython.readthedocs.io/en/stable/reference.html#git.cmd.Git
    
    -But i'm not sure if this is the way to go about it.
    +But i'm not sure if this is the way to go about it since this will be limited to git repositories and I guess the previous method will be useful for all SCM repos.
    
     Also, I'm thinking that we should just expose this function via REST and use JS to display the search results instead on demand.
    
    • Component: General --> SCM
     
  • Dave Brondsema

    Dave Brondsema - 2016-07-12

    In general we have been slowly working to use repo commands directly (like git ls-files) and implement each variation (git, hg, svn) rather than relying indexing of data into mongo (like the blob objects). Some simple caching in mongo might still be necessary though. More info at https://forge-allura.apache.org/p/allura/wiki/Goals/#make-githgsvn-repositories-indexless

    But since the blob data is already there, that is of course is going to be a lot easier than implementing direct access (like git python ls-files command, and svn and hg too). So I would suggest adding an all_files method to RepositoryImplementation which uses the blobs for now. And then later if we want to change it we can just change the all_files implementation (and not have to modify the file search code)

    Doing it via REST and JS makes a lot of sense to me. Instead of doing the search on the server, what if the rest api returned all the files in the repo, and the JS filtered through them? Then the JS would be able to show partial matches and autocomplete and things like that if we wanted.

     

    Last edit: Dave Brondsema 2016-07-12

Log in to post a comment.