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

Fix opening lazygit in a bare repo with specified worktree #2902

Merged
merged 2 commits into from
Aug 7, 2023

Conversation

jesseduffield
Copy link
Owner

@jesseduffield jesseduffield commented Aug 7, 2023

  • PR Description

I am confused. So far I've been working under the assumption that there are two kinds of worktrees:

  • main worktree in a non-bare repo
  • linked worktree in a bare or non-bare repo (which has a .git file pointing to its git-dir in the repo's own git-dir)

But there's a third kind of worktree which I'm calling a 'specified' worktree. This is used with dotfiles where you do git --git-dir=$HOME/.cfg --work-tree=$HOME <command>. You're specifying the worktree as part of each git command. The worktree has no idea that it's a worktree: it has no .git file and no entry in the bare repo's worktrees/ folder. I could git add a file in this worktree and then run git --git-dir=$HOME/.cfg --work-tree=/random/path status and it would say that the file has now been deleted.

Googling for this, I can't find anybody making this distinction.

This has got me thinking that we're in dire need of sorting out the right terminology here. It's bad enough that there are two senses of the word 'git-dir': one for the repo and one for each linked worktree.

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • Docs (specifically docs/Config.md) have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@jesseduffield jesseduffield changed the title Test bare repos with dotfile setup Fix opening lazygit in a bare repo with specified worktree Aug 7, 2023
// When an integration test first runs, we copy everything in the 'actual' directory,
// and copy it into the 'expected' directory so that future runs can be compared
// against what we expect.
func (self Paths) Expected() string {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a vestige of when we used snapshots. Now that we don't have an 'expected' path, it makes no sense to call the 'actual' path 'actual'. But I don't want to deal with that in this PR.

@jesseduffield jesseduffield added the bug Something isn't working label Aug 7, 2023
This was on oversight on my part: I assumed that the --work-tree arg was
always intended for use with linked worktrees which have a .git file
pointing back to the repo.

I'm honestly confused now: seems like there are three kinds of worktrees:
* the main worktree of a non-bare repo
* a linked worktree (with its own gitdir in the repo's worktrees/ dir)
* a random folder which you specify as a worktree with the --work-tree arg

I'm pretty sure the --work-tree arg is only intended to be used with this
third kind or workree
@jesseduffield jesseduffield merged commit 579791e into master Aug 7, 2023
@jesseduffield jesseduffield deleted the fix-bare-repo-support branch August 7, 2023 12:48
renovate bot referenced this pull request in scottames/dots Aug 10, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [aquaproj/aqua-registry](https://togithub.com/aquaproj/aqua-registry)
| minor | `v4.32.2` -> `v4.36.0` |
| [golangci/golangci-lint](https://togithub.com/golangci/golangci-lint)
| minor | `v1.53.3` -> `v1.54.0` |
| [helm/helm](https://togithub.com/helm/helm) | patch | `v3.12.2` ->
`v3.12.3` |
| [jesseduffield/lazygit](https://togithub.com/jesseduffield/lazygit) |
patch | `v0.40.0` -> `v0.40.2` |
| [twpayne/chezmoi](https://togithub.com/twpayne/chezmoi) | minor |
`v2.36.1` -> `v2.37.0` |

---

### Release Notes

<details>
<summary>aquaproj/aqua-registry (aquaproj/aqua-registry)</summary>

###
[`v4.36.0`](https://togithub.com/aquaproj/aqua-registry/releases/tag/v4.36.0)

[Compare
Source](https://togithub.com/aquaproj/aqua-registry/compare/v4.35.0...v4.36.0)


[Issues](https://togithub.com/aquaproj/aqua-registry/issues?q=is:issue milestone:v4.36.0)
| [Pull
Requests](https://togithub.com/aquaproj/aqua-registry/pulls?q=is:pr milestone:v4.36.0)
| aquaproj/aqua-registry@v4.35.0...v4.36.0

#### 🎉 New Packages


[#&#8203;14511](https://togithub.com/aquaproj/aqua-registry/issues/14511)
[ipld/go-car](https://togithub.com/ipld/go-car): A content addressible
archive utility [@&#8203;ponkio-o](https://togithub.com/ponkio-o)

#### Fixes


[#&#8203;14537](https://togithub.com/aquaproj/aqua-registry/issues/14537)
loft-sh/vcluster: Follow up changes of vcluster v0.15.4

[#&#8203;14538](https://togithub.com/aquaproj/aqua-registry/issues/14538)
dagu-dev/dagu: Rename the package `yohamta/dagu` to `dagu-dev/dagu`

https://github.com/yohamta/dagu was transferred to
https://github.com/dagu-dev/dagu


[#&#8203;14540](https://togithub.com/aquaproj/aqua-registry/issues/14540)
dagu-dev/dagu): Follow up changes of dagu v1.10.6

Asset names were changed.

###
[`v4.35.0`](https://togithub.com/aquaproj/aqua-registry/releases/tag/v4.35.0)

[Compare
Source](https://togithub.com/aquaproj/aqua-registry/compare/v4.34.0...v4.35.0)


[Issues](https://togithub.com/aquaproj/aqua-registry/issues?q=is:issue milestone:v4.35.0)
| [Pull
Requests](https://togithub.com/aquaproj/aqua-registry/pulls?q=is:pr milestone:v4.35.0)
| aquaproj/aqua-registry@v4.34.0...v4.35.0

#### 🎉 New Packages


[#&#8203;14493](https://togithub.com/aquaproj/aqua-registry/issues/14493)
[awslabs/mountpoint-s3](https://togithub.com/awslabs/mountpoint-s3): A
simple, high-throughput file client for mounting an Amazon S3 bucket as
a local file system [@&#8203;takumin](https://togithub.com/takumin)

:bulb: [aqua-renovate-config >= 1.8.0 supports this
package](https://togithub.com/aquaproj/aqua-renovate-config/releases/tag/1.8.0)

###
[`v4.34.0`](https://togithub.com/aquaproj/aqua-registry/releases/tag/v4.34.0)

[Compare
Source](https://togithub.com/aquaproj/aqua-registry/compare/v4.33.0...v4.34.0)


[Issues](https://togithub.com/aquaproj/aqua-registry/issues?q=is:issue milestone:v4.34.0)
| [Pull
Requests](https://togithub.com/aquaproj/aqua-registry/pulls?q=is:pr milestone:v4.34.0)
| aquaproj/aqua-registry@v4.33.0...v4.34.0

#### 🎉 New Packages


[#&#8203;14471](https://togithub.com/aquaproj/aqua-registry/issues/14471)
[uber-go/mock](https://togithub.com/uber-go/mock): GoMock is a mocking
framework for the Go programming language
[@&#8203;ichizero](https://togithub.com/ichizero)

[uber-go/mock](https://togithub.com/uber-go/mock) is a maintained fork
of [golang/mock](https://togithub.com/golang/mock) that has already been
archived.

https://github.com/golang/mock#gomock

> Update, June 2023: This repo and tool are no longer maintained. Please
see [go.uber.org/mock](https://togithub.com/uber/mock) for a maintained
fork instead.

###
[`v4.33.0`](https://togithub.com/aquaproj/aqua-registry/releases/tag/v4.33.0)

[Compare
Source](https://togithub.com/aquaproj/aqua-registry/compare/v4.32.2...v4.33.0)


[Issues](https://togithub.com/aquaproj/aqua-registry/issues?q=is:issue milestone:v4.33.0)
| [Pull
Requests](https://togithub.com/aquaproj/aqua-registry/pulls?q=is:pr milestone:v4.33.0)
| aquaproj/aqua-registry@v4.32.2...v4.33.0

#### 🎉 New Packages


[#&#8203;14383](https://togithub.com/aquaproj/aqua-registry/issues/14383)
[smallstep/certificates](https://togithub.com/smallstep/certificates): A
private certificate authority (X.509 & SSH) & ACME server for secure
automated certificate management, so you can use TLS everywhere & SSO
for SSH [@&#8203;scottames](https://togithub.com/scottames)

#### Fixes


[#&#8203;14368](https://togithub.com/aquaproj/aqua-registry/issues/14368)
danielgtaylor/restish: Follow up changes of restish v0.18.0

Asset names were changed.


danielgtaylor/restish@9c15903


[#&#8203;14385](https://togithub.com/aquaproj/aqua-registry/issues/14385)
smallstep/certificates Support old versions

#### 🎉 New Contributors

Thank you for your contribution!

[@&#8203;scottames](https://togithub.com/scottames)
[#&#8203;14383](https://togithub.com/aquaproj/aqua-registry/issues/14383)

</details>

<details>
<summary>golangci/golangci-lint (golangci/golangci-lint)</summary>

###
[`v1.54.0`](https://togithub.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1540)

[Compare
Source](https://togithub.com/golangci/golangci-lint/compare/v1.53.3...v1.54.0)

1.  updated linters:
    -   `decorder`: from 0.2.3 to 0.4.0
    -   `dupword`: from 0.0.11 to 0.0.12
    -   `errorlint`: from 1.4.2 to 1.4.3
    -   `exhaustruct`: from 2.3.0 to 3.1.0
    -   `forbidigo`: from 1.5.3 to 1.6.0
    -   `funlen`: from 0.0.3 to 0.1.0
    -   `gci`: from 0.10.1 to 0.11.0
    -   `ginkgolinter`: from 0.12.1 to 0.13.3
    -   `go-critic`: from 0.8.1 to 0.8.2
    -   `go-errorlint`: from 1.4.2 to 1.4.3
    -   `go-exhaustruct`: from 2.3.0 to 3.1.0
    -   `gocognit`: from 1.0.6 to 1.0.7
    -   `gocritic`: from 0.8.1 to 0.8.2
    -   `gofmt`: autofix missing newline at EOF
    -   `misspell`: 0.4.0 to 0.4.1
    -   `musttag`: from 0.7.0 to 0.7.1
    -   `paralleltest`: from 1.0.7 to 1.0.8
    -   `tagalign`: from 1.2.2 to 1.3.2
    -   `typecheck`: explain it and remove it from the linter list
    -   `zerologlint`: from 0.1.2 to 0.1.3
2.  misc.
    -   🎉 go1.21 support
    -   plugin: include custom linters in `enable-all`
    -   plugin: allow to use settings for plugins
3.  Documentation
    -   Add linter descriptions.

##### Important

`ruleguard` (a "rule" inside `gocritic`) is disabled, only with go1.21,
due to a bug of `ruleguard`

The Go version should be 1.21 inside `go.mod` or be defined inside the
`run` section:

<details><summary>go.mod</summary>

```go
module your/module/name

go 1.21

// ...

```

</details>

<details><summary>.golangci.yml</summary>

```yml
run:
    go: '1.21'
```

</details>

<details><summary>CLI flags</summary>

```bash
--go=1.21
```

</details>

You can follow this topic by subscribing to the [issue
#&#8203;3933](https://togithub.com/golangci/golangci-lint/issues/3933).

</details>

<details>
<summary>helm/helm (helm/helm)</summary>

### [`v3.12.3`](https://togithub.com/helm/helm/releases/tag/v3.12.3):
Helm v3.12.3

[Compare
Source](https://togithub.com/helm/helm/compare/v3.12.2...v3.12.3)

Helm v3.12.3 is a patch release. Users are encouraged to upgrade for the
best experience. Users are encouraged to upgrade for the best
experience.

The community keeps growing, and we'd love to see you there!

- Join the discussion in [Kubernetes
Slack](https://kubernetes.slack.com):
    -   for questions and just to hang out
    -   for discussing PRs, code, and bugs
- Hang out at the Public Developer Call: Thursday, 9:30 Pacific via
[Zoom](https://zoom.us/j/696660622)
- Test, debug, and contribute charts:
[ArtifactHub/packages](https://artifacthub.io/packages/search?kind=0)

#### Installation and Upgrading

Download Helm v3.12.3. The common platform binaries are here:

- [MacOS amd64](https://get.helm.sh/helm-v3.12.3-darwin-amd64.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-darwin-amd64.tar.gz.sha256sum)
/ 1bdbbeec5a12dd0c1cd4efd8948a156d33e1e2f51140e2a51e1e5e7b11b81d47)
- [MacOS arm64](https://get.helm.sh/helm-v3.12.3-darwin-arm64.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-darwin-arm64.tar.gz.sha256sum)
/ 240b0a7da9cae208000eff3d3fb95e0fa1f4903d95be62c3f276f7630b12dae1)
- [Linux amd64](https://get.helm.sh/helm-v3.12.3-linux-amd64.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-linux-amd64.tar.gz.sha256sum)
/ 1b2313cd198d45eab00cc37c38f6b1ca0a948ba279c29e322bdf426d406129b5)
- [Linux arm](https://get.helm.sh/helm-v3.12.3-linux-arm.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-linux-arm.tar.gz.sha256sum)
/ 6b67cf5fc441c1fcb4a860629b2ec613d0e6c8ac536600445f52a033671e985e)
- [Linux arm64](https://get.helm.sh/helm-v3.12.3-linux-arm64.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-linux-arm64.tar.gz.sha256sum)
/ 79ef06935fb47e432c0c91bdefd140e5b543ec46376007ca14a52e5ed3023088)
- [Linux i386](https://get.helm.sh/helm-v3.12.3-linux-386.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-linux-386.tar.gz.sha256sum)
/ cb789c4753bf66c8426f6be4091349c0780aaf996af0a1de48318f9f8d6b7bc8)
- [Linux ppc64le](https://get.helm.sh/helm-v3.12.3-linux-ppc64le.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-linux-ppc64le.tar.gz.sha256sum)
/ 8f2182ae53dd129a176ee15a09754fa942e9e7e9adab41fd60a39833686fe5e6)
- [Linux s390x](https://get.helm.sh/helm-v3.12.3-linux-s390x.tar.gz)
([checksum](https://get.helm.sh/helm-v3.12.3-linux-s390x.tar.gz.sha256sum)
/ f5d5c7a4e831dedc8dac5913d4c820e0da10e904debb59dec65bde203fad1af0)
- [Windows amd64](https://get.helm.sh/helm-v3.12.3-windows-amd64.zip)
([checksum](https://get.helm.sh/helm-v3.12.3-windows-amd64.zip.sha256sum)
/ f3e2e9d69bb0549876aef6e956976f332e482592494874d254ef49c4862c5712)

This release was signed with ` 672C 657B E06B 4B30 969C 4A57 4614 49C2
5E36 B98E ` and can be found at
[@&#8203;mattfarina](https://togithub.com/mattfarina) [keybase
account](https://keybase.io/mattfarina). Please use the attached
signatures for verifying this release using `gpg`.

The [Quickstart Guide](https://helm.sh/docs/intro/quickstart/) will get
you going from there. For **upgrade instructions** or detailed
installation notes, check the [install
guide](https://helm.sh/docs/intro/install/). You can also use a [script
to
install](https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3)
on any system with `bash`.

#### What's Next

-   3.13.0 is the next feature release and be on September 13, 2023.

#### Changelog

- bump kubernetes modules to v0.27.3
[`3a31588`](https://togithub.com/helm/helm/commit/3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e)
(Joe Julian)
- Add priority class to kind sorter
[`fb74155`](https://togithub.com/helm/helm/commit/fb7415543b910e5661337e187e2be9d3f383638d)
(Stepan Dohnal)

</details>

<details>
<summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary>

###
[`v0.40.2`](https://togithub.com/jesseduffield/lazygit/releases/tag/v0.40.2)

[Compare
Source](https://togithub.com/jesseduffield/lazygit/compare/v0.40.1...v0.40.2)

<!-- Release notes generated using configuration in .github/release.yml
at v0.40.2 -->

#### What's Changed

##### Fixes 🔧

- Fix seg-fault when opening submodule in nested folder by
[@&#8203;jesseduffield](https://togithub.com/jesseduffield) in
[https://github.com/jesseduffield/lazygit/pull/2903](https://togithub.com/jesseduffield/lazygit/pull/2903)

**Full Changelog**:
jesseduffield/lazygit@v0.40.1...v0.40.2

###
[`v0.40.1`](https://togithub.com/jesseduffield/lazygit/releases/tag/v0.40.1)

[Compare
Source](https://togithub.com/jesseduffield/lazygit/compare/v0.40.0...v0.40.1)

<!-- Release notes generated using configuration in .github/release.yml
at v0.40.1 -->

#### What's Changed

##### Fixes 🔧

- update worktree icons for NerdFont V3 by
[@&#8203;Saafo](https://togithub.com/Saafo) in
[https://github.com/jesseduffield/lazygit/pull/2895](https://togithub.com/jesseduffield/lazygit/pull/2895)
- Fix opening lazygit in a bare repo with specified worktree by
[@&#8203;jesseduffield](https://togithub.com/jesseduffield) in
[https://github.com/jesseduffield/lazygit/pull/2902](https://togithub.com/jesseduffield/lazygit/pull/2902)

##### Maintenance ⚙️

- Import stefanhaller's tcell fork for real rather than just replacing
it by [@&#8203;stefanhaller](https://togithub.com/stefanhaller) in
[https://github.com/jesseduffield/lazygit/pull/2888](https://togithub.com/jesseduffield/lazygit/pull/2888)
- Don't run the check-required-label check on master by
[@&#8203;stefanhaller](https://togithub.com/stefanhaller) in
[https://github.com/jesseduffield/lazygit/pull/2896](https://togithub.com/jesseduffield/lazygit/pull/2896)
- Use nerdfont version 3 in demos by
[@&#8203;jesseduffield](https://togithub.com/jesseduffield) in
[https://github.com/jesseduffield/lazygit/pull/2901](https://togithub.com/jesseduffield/lazygit/pull/2901)

##### Other Changes

- Fix README.md typo backkground -> background by
[@&#8203;mattiasJohnson](https://togithub.com/mattiasJohnson) in
[https://github.com/jesseduffield/lazygit/pull/2884](https://togithub.com/jesseduffield/lazygit/pull/2884)

#### New Contributors

- [@&#8203;mattiasJohnson](https://togithub.com/mattiasJohnson) made
their first contribution in
[https://github.com/jesseduffield/lazygit/pull/2884](https://togithub.com/jesseduffield/lazygit/pull/2884)
- [@&#8203;Saafo](https://togithub.com/Saafo) made their first
contribution in
[https://github.com/jesseduffield/lazygit/pull/2895](https://togithub.com/jesseduffield/lazygit/pull/2895)

**Full Changelog**:
jesseduffield/lazygit@v0.40.0...v0.40.1

</details>

<details>
<summary>twpayne/chezmoi (twpayne/chezmoi)</summary>

###
[`v2.37.0`](https://togithub.com/twpayne/chezmoi/releases/tag/v2.37.0)

[Compare
Source](https://togithub.com/twpayne/chezmoi/compare/v2.36.1...v2.37.0)

#### What's Changed

- feat: Read personal mackup config files by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3133](https://togithub.com/twpayne/chezmoi/pull/3133)
- chore(deps): bump github/codeql-action from 2.20.1 to 2.21.2 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/twpayne/chezmoi/pull/3135](https://togithub.com/twpayne/chezmoi/pull/3135)
- chore: Build with Go 1.20.7 by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3140](https://togithub.com/twpayne/chezmoi/pull/3140)
- feat: Add support for Doppler by
[@&#8203;equals03](https://togithub.com/equals03) in
[https://github.com/twpayne/chezmoi/pull/3134](https://togithub.com/twpayne/chezmoi/pull/3134)
- feat: Extend re-add command to accept an optional list of targets by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3146](https://togithub.com/twpayne/chezmoi/pull/3146)
- chore: Update dependencies by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3150](https://togithub.com/twpayne/chezmoi/pull/3150)
- fix: Avoid concurrent map access when evaluating multiple templates by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3155](https://togithub.com/twpayne/chezmoi/pull/3155)
- feat: Add isExecutable template function by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3157](https://togithub.com/twpayne/chezmoi/pull/3157)
- chore: Fix isExecutable tests on Windows by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3158](https://togithub.com/twpayne/chezmoi/pull/3158)
- chore: Update dependencies by
[@&#8203;twpayne](https://togithub.com/twpayne) in
[https://github.com/twpayne/chezmoi/pull/3159](https://togithub.com/twpayne/chezmoi/pull/3159)

#### New Contributors

- [@&#8203;equals03](https://togithub.com/equals03) made their first
contribution in
[https://github.com/twpayne/chezmoi/pull/3134](https://togithub.com/twpayne/chezmoi/pull/3134)

**Full Changelog**:
twpayne/chezmoi@v2.36.1...v2.37.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 4pm on thursday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/scottames/dots).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi40MC4zIiwidXBkYXRlZEluVmVyIjoiMzYuNDAuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614 renovate[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

1 participant