Page MenuHomeFreeBSD

Fix arcgit when run from a worktree
ClosedPublic

Authored by rstone on Nov 11 2016, 7:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 15 2024, 5:44 PM
Unknown Object (File)
Jan 11 2024, 10:50 AM
Unknown Object (File)
Jan 11 2024, 10:50 AM
Unknown Object (File)
Jan 11 2024, 10:50 AM
Unknown Object (File)
Jan 11 2024, 10:45 AM
Unknown Object (File)
Jan 11 2024, 10:45 AM
Unknown Object (File)
Jan 11 2024, 10:17 AM
Unknown Object (File)
Dec 27 2023, 5:45 PM
Subscribers
None

Details

Summary

In a git worktree, the gitdir is in an entirely different location.
Use git rev-parse --git-dir to get the correct path to it always.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rstone retitled this revision from to Fix arcgit when run from a worktree.
rstone edited the test plan for this revision. (Show Details)
rstone added a reviewer: markj.
rstone updated this object.
markj edited edge metadata.
This revision is now accepted and ready to land.Nov 11 2016, 7:50 PM
rstone edited edge metadata.

Similar fix is needed in importgit

This revision now requires review to proceed.Nov 11 2016, 8:29 PM
tools/tools/git/importgit
98 ↗(On Diff #22158)

I think the quotation marks are unneeded, FWIW. Ditto in arcgit.

98 ↗(On Diff #22158)

Hm... this will print the path relative to the -C argument. Shouldn't it be git=${git_dir}/$(git ...) ?

106 ↗(On Diff #22158)

Looks like this check should come earlier?

tools/tools/git/importgit
98 ↗(On Diff #22158)

Hm, on my machine I get an absolute path. What version of git do you have? I have 2.8.1.

106 ↗(On Diff #22158)

Indeed

tools/tools/git/importgit
98 ↗(On Diff #22158)

Lovely, seems like a regression then:

$ cd /
$ git -C /home/markj/src/freebsd-dev rev-parse --git-dir
.git
$ git --version
git version 2.10.1
$

tools/tools/git/importgit
98 ↗(On Diff #22158)

Nope, I see the same behaviour from a native git tree. It's only work trees that give absolute paths. *sigh*

tools/tools/git/importgit
98 ↗(On Diff #22158)

Compounding my confusion, old-style worktrees created with git-new-workdir also give relative paths.

rstone edited edge metadata.

--git-dir is unreliable, so use -C $git_repo instead

markj edited edge metadata.

I'd consider setting git="git -C $git_repo" and using $git everywhere instead, but this looks like it works.

This revision is now accepted and ready to land.Nov 11 2016, 9:08 PM
This revision was automatically updated to reflect the committed changes.