pop-os / cosmic-files

COSMIC file manager
GNU General Public License v3.0
113 stars 86 forks source link

Error: not within a suitable 'git' worktree! #250

Open gl-yziquel opened 5 months ago

gl-yziquel commented 5 months ago

Hi.

I get this error when trying to build cosmic-files with cargo build:

error: failed to run custom build command for `cosmic-files v0.1.0 (/home/mini-me/home/cellar/cosmic-files)`

Caused by:
  process didn't exit successfully: `/home/mini-me/home/cellar/cosmic-files/target/release/build/cosmic-files-084983508b6afa21/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=i18n
  cargo:rerun-if-env-changed=VERGEN_GIT_COMMIT_DATE
  cargo:rerun-if-env-changed=VERGEN_GIT_SHA

  --- stderr
  Error: not within a suitable 'git' worktree!

The meaning of this error is pretty unclear.

Moreover, it happens when trying to build redox from source.

jackpot51 commented 5 months ago

vergen is used to include information in the program about what git commit was used to build it. Are you building from a git clone'd repository or did you get the source code another way?

gl-yziquel commented 5 months ago

vergen is used to include information in the program about what git commit was used to build it. Are you building from a git clone'd repository or did you get the source code another way?

I performed a brutal redox build with the following instructions:

gix clone ttps://gitlab.redox-os.org/redox-os/redox
cd redox
git submodule update --init --recursive --force
./bootstrap.sh
time make all

cosmic-files appears as a dependency within that build, and fails with that error.

I build from git HEAD.

Jomosoto commented 4 months ago

I get the same error. I followed the instructions in the readme.

Edit: OS: Artix Linux

Eclextic commented 3 months ago

ditto: Arch Linux

I think this all comes from the Arch Distro Family...

gl-yziquel commented 3 months ago

ditto: Arch Linux

I think this all comes from the Arch Distro Family...

I do not use Arch Linux. Got this on Ubuntu trying to build redox from source.

Jomosoto commented 3 months ago

I found the reason why this happens on my system: In the build script, to check if it's in a git worktree, vergen executes a git command and parses the output. To do this they execute whatever $SHELL points with "-c git rev-parse --is-inside-work-tree" as argument. In my case I have some custom text printed whenever I start my shell, so the output never matches and the check always fails.

Edit: Normally this is not a problem with bash, because .bashrc is only sourced in an interactive session, but I use fish and do a print in my config.fish without checking if the session is interactive.

Eclextic commented 3 months ago

Wait wtf are you serious? I use fish as well and print my Neofetch no matter if the session is interactive or not... Let me check real quick...

Eclextic commented 3 months ago

Holy fuck you're totally right... This fixed it for me... I have never had something like this happen, ever!

I suppose we should notify vergen about this bug?

Jomosoto commented 3 months ago

Yeah, I'll open an issue later :+1: