Giter VIP home page Giter VIP logo

Comments (6)

hanwen avatar hanwen commented on May 24, 2024

I don't understand the bug report. Per

repo.LineFragmentTemplate = "#L{{.LineNumber}}"

the line fragment for github already uses capital L, and the Gitiles format is already as you describe,

repo.LineFragmentTemplate = "#{{.LineNumber}}"

from zoekt.

robinp-tw avatar robinp-tw commented on May 24, 2024

Thanks Hanwen for the pointer - did some debug printing, seems like https://github.com/google/zoekt/blob/master/web/snippets.go#L116 always calls getTemplate with f.Repository, but the fragment map gets populated with what seems to be f.SubRepositoryName?

In my case, f.Repository is github.com/the-org, while f.SubRepositoryName is github.com/the-org/a-repo, and fragmentmap indeed has keys from latter ones.

If that looks right, then it is a bug (should call getTemplate with subrepo, if exists?). If doesn't look right, maybe I called the zoekt-repo-indexer with wrong parameters?

from zoekt.

hanwen avatar hanwen commented on May 24, 2024

github.com/the-org normally never is a repository, right? The REpository vs SubRepositoryName distinction is for submodules. Are you indexing submodules?

you can look at the data that controls this by looking at the .git/config file (it has the template settings, IIRC). You can also look at the end of the shard file (it should have a JSON with all metadata).

from zoekt.

robinp-tw avatar robinp-tw commented on May 24, 2024

Yeah, that's odd. Small repro:

$ ~/go/bin/zoekt-mirror-github -org google -name zoekt -dest repo

$ ~/go/bin/zoekt-repo-index -repo_cache repo -index idx -base_url https://github.com/google --rev_prefix=  some.xml
2020/10/19 20:49:19 finished idx/github.com%2Fgoogle_v15.00000.zoekt: 1779261 index bytes (overhead 3.5)

$ ~/go/bin/zoekt-webserver -index idx
2020/10/19 20:49:42 loading 1 shards
2020/10/19 20:49:42 serving HTTP on :6070

$ curl 'http://localhost:6070/search?q=search&num=0' | grep -oi 'go#l' | sort -u
go#l

I notice that it is the result.Files iterator f's f.Repository and f.SubRepositoryName that is odd (here github.com/google and github.com/google/zoekt, respectively). Where is that metadata coming from? Am I invoking the indexer with the right arguments? Thanks for bearing with me.

Edit: some.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote name="google" fetch="https://github.com/google/" />
  <default revision="HEAD" remote="google" sync-j="4" />
  <project remote="google" name="zoekt" />
</manifest>

from zoekt.

hanwen avatar hanwen commented on May 24, 2024

are you sure you want to use the repo indexer? Normally, you'd simply index the git repository directly, using zoekt-git-index.

from zoekt.

robinp-tw avatar robinp-tw commented on May 24, 2024

You are right! In retrospect, I don't know why I was using the repo-indexer. Thank you!

from zoekt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.