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

safe.bareRepository = explicit makes it impossible to "Edit Commit Message" #1690

Open
stdedos opened this issue Jan 3, 2023 · 7 comments
Open

Comments

@stdedos
Copy link

stdedos commented Jan 3, 2023

Version info

  • OS: [e.g. macOS 10.14, Windows 10, Ubuntu 18.04] Ubuntu 20.04
  • Build: [e.g. 1062 - type "About" in the command palette] 2079

Description

A description of what the bug is.

Using "Edit Commit Message" while safe.bareRepository = explicit is set, leads to:
image
image

Steps to reproduce

Steps to reproduce the behavior:

  1. Open repository ...
  2. Run command ...
  3. Click on ...

Expected behavior

A description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem. This section may be omitted/removed.

@gschaffner
Copy link

this regression was introduced between 2074 (good) and 2077 (bad). i can confirm it's also still broken in the latest release (2091).

@dpjohnst
Copy link
Member

Hi all, could you confirm if you're using worktrees for your repository?

Additionally, could you confirm if there is any output in the Sublime Merge console when the command fails?
This can be opened via Tools > Show Console

Kind regards,
- Dylan from Sublime HQ

@stdedos
Copy link
Author

stdedos commented Nov 20, 2023

image

first paint time: 0.717802
head changed to 88820af38b4fe098017398ed076011b5d7eb54b0
Error loading scope:source.diff: Unable to find syntax file for scope "source.diff" in Packages/MarkdownLight/MarkdownLight.tmLanguage
Error loading scope:source.coffee: Unable to find syntax file for scope "source.coffee" in Packages/MarkdownLight/MarkdownLight.tmLanguage
Error loading scope:source.swift: Unable to find syntax file for scope "source.swift" in Packages/MarkdownLight/MarkdownLight.tmLanguage
Error loading scope:source.css.less: Unable to find syntax file for scope "source.css.less" in Packages/MarkdownLight/MarkdownLight.tmLanguage
Error loading Packages/Diff/Diff.sublime-syntax: Unable to read Packages/Diff/Diff.sublime-syntax in Packages/Default/Commit Message.sublime-syntax
Executing: git commit-tree -m ... -p b224e3e0b47d1ed271348c44d366e61a4c8d4212 2a53dd640663469eae354259ed640d2c16bacff6
Working dir: /.../.git
  Env vars: GIT_AUTHOR_DATE=1699973391 +0200 GIT_AUTHOR_NAME=... ... GIT_AUTHOR_EMAIL=,,, GIT_COMMITTER_DATE =1700469522 +0200 GIT_COMMITTER_NAME=... ... GIT_COMMITTER_EMAIL=,,,
Result: failed with exit code 128

And

$  git worktree list | wc -l
1

(i.e, no)

@ismell
Copy link

ismell commented Feb 27, 2024

This also started happening to me.
bare repo error

This happens when editing a commit message.

It looks like this happens because the command is being executed in the .git directory instead of the worktree:

rrangel@rrangel920:~/chromiumos/src/third_party/chromiumos-overlay/.git$ git commit-tree -m "hello" -p dc42b6d356e9b703f082934603a58cc6737e44f0 fe827a213eea7195d2b2a58febfdbda4bb0aea57
fatal: cannot use bare repository '/home/rrangel/chromiumos/.repo/projects/src/third_party/chromiumos-overlay.git' (safe.bareRepository is 'explicit')

rrangel@rrangel920:~/chromiumos/src/third_party/chromiumos-overlay/.git$ cd ..

rrangel@rrangel920:~/chromiumos/src/third_party/chromiumos-overlay$ git commit-tree -m "hello" -p dc42b6d356e9b703f082934603a58cc6737e44f0 fe827a213eea7195d2b2a58febfdbda4bb0aea57
33f8717d66dac99ca93f07ca92c71e9d8315b97b

The fix is to pass in --git-dir when executing the command:

rrangel@rrangel920:~/chromiumos/src/third_party/chromiumos-overlay/.git$ git --git-dir . commit-tree -m "hello" -p dc42b6d356e9b703f082934603a58cc6737e44f0 fe827a213eea7195d2b2a58febfdbda4bb0aea57
7201008330ab2c1d64a8ab3a65db52e20bcd4618

or better yet, pass in the full path instead of relying on CWD:

rrangel@rrangel920:~$ git --git-dir ~/chromiumos/src/third_party/chromiumos-overlay/.git commit-tree -m "hello world" -p dc42b6d356e9b703f082934603a58cc6737e44f0 fe827a213eea7195d2b2a58febfdbda4bb0aea57
bf5be44da58aaab4e51c9a5d13bf685d4884ca16

See https://github.com/justinsteven/advisories/blob/main/2022_git_buried_bare_repos_and_fsmonitor_various_abuses.md for more details.

@ismell
Copy link

ismell commented Feb 27, 2024

Just FYI, if you want to repo add the following to your .gitconfig:

[safe]
	bareRepository = explicit

@stdedos
Copy link
Author

stdedos commented Feb 27, 2024

Can we expect you'll fix this ... within this century? 🙄

@dmitshur
Copy link

This still happens with Build 2096 for me.

I also noticed something strange: this happens reproducibly as soon as I change safe.bareRepository to explicit on my primary macOS machine (so I'm unable to keep it because it breaking Sublime Merge is too disruptive), but somehow it doesn't happen on another macOS machine where safe.bareRepository is set to explicit. They're both on macOS 14 and I haven't yet found an explanation for why it happens on one but not the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants