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

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

Open
eder-s opened this issue Jul 31, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@eder-s
Copy link

eder-s commented Jul 31, 2024

Description

Support relative paths for:

  • a submodule's worktree configuration entry
  • a submodule's gitdir link

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
Copy link
Contributor

This is at

cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_WORKTREE, getWorkTree()
.getAbsolutePath());
LockFile dotGitLockFile = new LockFile(new File(workTree,
Constants.DOT_GIT));
try {
if (dotGitLockFile.lock()) {
dotGitLockFile.write(Constants.encode(Constants.GITDIR
+ getDirectory().getAbsolutePath()));

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

@msohn
Copy link
Member

msohn commented Aug 29, 2024

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

@msohn msohn added the bug Something isn't working label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants