eclipse-jgit / jgit

JGit, the Java implementation of git
https://www.eclipse.org/jgit/
Other
121 stars 34 forks source link

Submodules: use relative paths as worktree and gitdir instead of absolute ones #78

Open eder-s opened 1 month ago

eder-s commented 1 month ago

Description

Support relative paths for:

Motivation

Using relative paths allows copying the super project to a different locations w/o worrying about the submodules. With absolute paths the submodules do still point to the "old" location after the superpoject is copied.

Alternatives considered

No response

Additional context

This issue was addressed previously at: https://bugs.eclipse.org/bugs/show_bug.cgi?id=463437

"cgit" also uses relative paths for worktree and gitdir.

tomaswolf commented 1 month ago

This is at

https://github.com/eclipse-jgit/jgit/blob/299a7348eb318a0199226c1e633cc46c659d76d3/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java#L296-L304

Reading core.worktree and the .git file already resolves them.

msohn commented 2 weeks ago

Simon proposed a fix in https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/1198661