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

Can't sync repo with 'main' branch #407

Closed
sbuehnemann opened this issue Sep 16, 2021 · 10 comments
Closed

Can't sync repo with 'main' branch #407

sbuehnemann opened this issue Sep 16, 2021 · 10 comments

Comments

@sbuehnemann
Copy link

Hi, I'm using the following config to pull a repo that was created with 'main' as the default branch:

{
  "max-concurrent-indexers": 2,
  "dbpath": "data",
  "health-check-uri": "/healthz",
  "ms-between-poll": 120000,
  "repos": {
    "grp/myrepo": {
      "url": "[email protected]:myorg/grp/myrepo.git",
      "vcs-config" : {
        "ref" : "main"
      }
    }
  }
}

Initial sync starts and I can search the code. But on the next sync cycle the logs tell that it doesn't work:

2021/09/16 15:28:29 Searcher started for grp/myrepo
2021/09/16 15:28:30 merge 0 files + mem
2021/09/16 15:28:30 9274 data bytes, 41852 index bytes
2021/09/16 15:28:30 All indexes built!
2021/09/16 15:28:30 running server at http://localhost:6080...
2021/09/16 15:29:02 Failed to git fetch /data/data/vcs-8f4c4ff10bd1cff3080eac3b8382cc80532d171d, see output below
fatal: Couldn't find remote ref master
fatal: the remote end hung up unexpectedly
Continuing...
2021/09/16 15:29:02 vcs pull error (grp/myrepo - [email protected]:myorg/grp/myrepo.git): exit status 128
2021/09/16 15:29:33 Failed to git fetch /data/data/vcs-8f4c4ff10bd1cff3080eac3b8382cc80532d171d, see output below
fatal: Couldn't find remote ref master
fatal: the remote end hung up unexpectedly
Continuing...

The link in the search results also points to master, so it leads to a 404.

Any clues?

@salemhilal
Copy link
Contributor

That's weird. Can you tell me if replacing "ref": "main" with "detect-ref" : true stops the errors from happening?

@sbuehnemann
Copy link
Author

Unfortunately still the same behavior:

021/09/16 18:48:30 Searcher started for grp/myrepo
2021/09/16 18:48:32 merge 0 files + mem
2021/09/16 18:48:32 9274 data bytes, 41852 index bytes
2021/09/16 18:48:32 All indexes built!
2021/09/16 18:48:32 running server at http://localhost:6080...
2021/09/16 18:49:05 Failed to git fetch /data/data/vcs-8f4c4ff10bd1cff3080eac3b8382cc80532d171d, see output below
fatal: Couldn't find remote ref master
fatal: the remote end hung up unexpectedly
Continuing...
2021/09/16 18:49:05 vcs pull error (grp/myrepo - [email protected]:unicepta/grp/myrepo.git): exit status 128
2021/09/16 18:49:37 Failed to git fetch /data/data/vcs-8f4c4ff10bd1cff3080eac3b8382cc80532d171d, see output below
fatal: Couldn't find remote ref master
fatal: the remote end hung up unexpectedly
Continuing...
2021/09/16 18:49:37 vcs pull error (grp/myrepo - [email protected]:unicepta/grp/myrepo.git): exit status 128

Can I enable debugging for more verbose logging?

@sbuehnemann
Copy link
Author

I just created a public repo you can use for debugging:

{
  "max-concurrent-indexers": 2,
  "dbpath": "data",
  "title": "Unihound",
  "health-check-uri": "/healthz",
  "ms-between-poll": 120000,
  "repos": {
    "grp/myrepo": {
      "url": "[email protected]:m2887/grp/myrepo.git",
      "vcs-config" : {
        "detect-ref" : true
      }
    }
  }
}

@dereckson
Copy link

I can repro the same behavior, both with detect-ref and a specific ref.

Minimal log entry:

2022/01/16 03:25:25 Failed to git fetch /data/data/vcs-9f9271ce172eba04b863d2fbc9981b6f2e3a527b, see output below
warning: redirecting to https://github.com/nasqueron/notifications.git/
fatal: Couldn't find remote ref master
Continuing...
2022/01/16 03:25:25 vcs pull error (notifications - https://www.github.com/nasqueron/notifications.git): exit status 128

dereckson added a commit to dereckson/hound that referenced this issue Jan 16, 2022
@dereckson
Copy link

Relevant code to determine the branch (with defaultRef hardcoded to master):

func (g *GitDriver) targetRef(dir string) string {
    var targetRef string
    if g.Ref != "" {
        targetRef = g.Ref
    } else if g.DetectRef {
        targetRef = g.refDetetector.detectRef(dir)
    }

    if targetRef == "" {
        targetRef = defaultRef
    }

    return targetRef
}

To debug this, could be interesting to add some debug logging there.

@dereckson
Copy link

dereckson commented Jan 16, 2022

@sbuehnemann How did you start Hound?

I've added debug info at dereckson@1c99508 and it works perfectly fine with the same configuration file.

Then I've got an illumination flash: I've started by hound server with the etsy/hound image, updated 3 years ago, as documented in the README.

The issue you describe matches the behavior of older versions of Hound, like the one still used in etsy/hound image.

If so, it should be fixed by #405.

@sbuehnemann
Copy link
Author

Thanks for the hint, I'll try it out tomorrow.

@salemhilal
Copy link
Contributor

@sbuehnemann let me know if that doesn't solve your problem. I'm going to close this in favor of #405 instead.

@salemhilal
Copy link
Contributor

@sbuehnemann we've updated the README — try using the Docker instructions again and see if that works for you.

@salemhilal
Copy link
Contributor

(Thank you for your help @dereckson, much appreciated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants