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

StringIndexOutOfBoundsException during repository identifying on startup #552

Closed
gitblit opened this issue Aug 12, 2015 · 8 comments
Closed

Comments

@gitblit
Copy link
Collaborator

gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 256

What steps will reproduce the problem:
1. I have manually copied my local .git repo (2.5Gb) to Gitblit git folder
2. Gitblit was restarted
3. During Gitblit startup exception is thrown, Gitblit exits
4. If added repo is removed, Gitblit is started normally

This is a part of gitblit startup log:
 INFO  Gitblit base folder     = C:\incoming\gitblit-1.2.1\data
 INFO  Git repositories folder = C:\incoming\gitblit-1.2.1\data\git
 INFO  Gitblit settings        = C:\incoming\gitblit-1.2.1\data\gitblit.properties
 INFO  Identifying available repositories...
 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index
out of range: 0
         at java.lang.String.charAt(String.java:686)
         at com.gitblit.utils.StringUtils.getRelativePath(StringUtils.java:334)
         at com.gitblit.utils.FileUtils.getRelativePath(FileUtils.java:248)
         at com.gitblit.GitBlit.loadRepositoryModel(GitBlit.java:1657)
         at com.gitblit.GitBlit.getRepositoryModel(GitBlit.java:1346)
         at com.gitblit.GitBlit.getRepositoryList(GitBlit.java:1203)
         at com.gitblit.GitBlit.configureContext(GitBlit.java:3065)
         at com.gitblit.GitBlitServer.start(GitBlitServer.java:382)
         at com.gitblit.GitBlitServer.main(GitBlitServer.java:120)
         at com.gitblit.Launcher.main(Launcher.java:103)

Reported by micheal.zub on 2013-06-18 19:07:46

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Thanks for the report, but this is not a bug.  You can't put a ".git" folder into the
repositories folder.

You can...
1. rename ".git" to somerepo.git
2. copy the entire working tree to a folder within the repositories folder
3. clone the source repo into the repositories folder

Reported by James.Moger on 2013-06-18 21:03:01

  • Status changed: WontFix

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Well, I suppose it is a bug so I will ignore ".git" if i find it.

Reported by James.Moger on 2013-06-18 21:04:49

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Reported by James.Moger on 2013-06-18 21:07:53

  • Status changed: Started
  • Labels added: Milestone-1.3.0

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Hello, thanks for the answer, but is seems another type of issue than you mention. I
have tried both separately:
1. Renamed my .git folder to test.git folder
2. Created new folder under repositories folder and copied my .git folder contents
there

The exception was still thrown. So could it be another limitations for repo contents
that I should check?

Reported by micheal.zub on 2013-06-19 15:02:37

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Hmmm.  I pushed a fix for the IOOB exception in stringutils... but this won't help you.
 Gitblit thinks there is no relative path relationship between your repositories folder
and your repo.

How about cloning a mirror into your repositories folder instead of messing with dir
copying?  Anything else different about your win filesystem?  Are you using symlinks?

Reported by James.Moger on 2013-06-19 19:23:11

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Okay, I have finally resolved my issue under next workflow:

1. Copy my repo .git folder to gitblit\data\git
2. Rename .git folder to repo.git
3. Start Gitblit, the exception is thrown on startup, Gitblit exits
4. Open the shell in repo.git and execute command: git config --bool core.bare true
5. Start the Gitblit, everything works fine, repos are fully accessible

Seems Gitblit differs bare and non-bare repos and my bare repo was marked as non-bare.

Reported by micheal.zub on 2013-06-20 12:54:28

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Gitblit can work with both bare and non-bare repositories, but Gitblit depends on JGit
which must have been confused by your "half-bare" repo.  I'm glad you figured it out
and we both learned something new.

Reported by James.Moger on 2013-06-20 13:11:54

  • Status changed: Queued

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Fix or enhancement released in v1.3.0

Reported by James.Moger on 2013-07-14 16:52:58

  • Status changed: Fixed

@gitblit gitblit closed this as completed Aug 12, 2015
@flaix flaix modified the milestone: 1.3.0 Dec 13, 2016
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

2 participants