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)
Wed, Dec 4, 9:15 AM
Unknown Object (File)
Nov 18 2024, 6:58 AM
Unknown Object (File)
Nov 17 2024, 5:56 PM
Unknown Object (File)
Nov 16 2024, 5:33 PM
Unknown Object (File)
Nov 11 2024, 1:52 AM
Unknown Object (File)
Nov 9 2024, 9:37 PM
Unknown Object (File)
Nov 9 2024, 10:16 AM
Unknown Object (File)
Nov 9 2024, 9:25 AM
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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5927
Build 6211: arc lint + arc unit

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.