mob
mob copied to clipboard
Does not work with repositories cloned with `git-repo`
Warning I'm not a git expert at all, the following message may be very stupid 😄
I am using git-repo to bootstrap my repositories.
This tool clone all repositories ~~as bare~~, and unfortunately, mob does not seem to work with these repositories.
When I try to do a mob next :
git add --all
ERROR git status --short
ERROR fatal: This operation must be run in a work tree
ERROR exit status 128
Is it possible to make mob work in that context ?
Thanks !
A bare repo has no working tree. Why would you want to use the mob tool without a work tree? Can you share with me your use case, please?
My bad, these repositories are not bare !
I can commit with the basic git commit/git push commands, but when I use mob next it does not work ...
You can reproduce it by installing repo:
brew install repo
# or
apt install repo
And then :
repo init -u [email protected]:cpoissonnier/manifest-example.git -m example.xml
repo sync
repo start main --all
cd mob
mob start
echo "test" > test.txt
mob next
@cpoissonnier can you please help me understand this better? If its a git repo, but it is not bare, and it has no worktree, what is it then? I am not a git-repo expert.
Hello,
The issue is related to the gitRootDir function.
This function does not work when the .git is a symlink to an other directory (which is what git-repo is doing).
You should use something like:
func gitRootDir() string {
return silentgit("rev-parse", "--show-toplevel")
}
to make it work in all situations.
Thanks !
Thank you @freekk