Support getting spec Git info when active shell differs in syntax from bash
See original GitHub issueWhat would you like?
I’d like to be able to see Git info for my project even if my active shell uses a different syntax than bash. Currently I use Fish Shell as my default shell on Mac. When Cypress tries to load Git info for my project, it uses syntax that isn’t supported by my active shell (Fish in this case).
The result is that my project’s Git info doesn’t show in the spec list
[cy:open:dev:95630]: cypress:data-context:sources:GitDataSource command execution error: { stdout: '', stderr: "fish: Unsupported use of '='. In fish, please use 'set IFS $'\n''.", code: 0, failed: false, killed: false, signal: null, cmd: "IFS=$'\n" + `'; for file in {"/Users/adams/projects/cypress-example-kitchensink/cypress/e2e/2-advanced-examples/actions.cy.js", ...
Why is this needed?
This improvement would be useful for people who use different default shells and run Cypress on their machine.
Other
When we execute the command to get the Git info, we use the active shell and fall back to bash.
const result = await execa(cmd, { shell: process.env.SHELL || '/bin/bash', cwd: this.#gitBaseDir })
Forcing the use of bash fixes the issue in my case but I imagine that there are some cases where we need to use the active shell.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
git-diff Documentation - Git
This form is to view the changes you made relative to the index (staging area for the next commit). In other words, the...
Read more >git-status Documentation - Git
DESCRIPTION. Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree...
Read more >git-config Documentation - Git
Defaults to off when a specific file is given (e.g., using --file , --global , etc) and on when searching all config files....
Read more >git-log Documentation - Git
When no <revision-range> is specified, it defaults to HEAD (i.e. the whole history leading to the current commit). origin..HEAD specifies all the commits ......
Read more >git-commit Documentation - Git
Create a new commit containing the current contents of the index and the given log message describing the changes. The new commit is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the context, @lmiller1990. I poked at this a little bit before the break and it seems like we should be able to use
/bin/sh
with a minor tweak to the variable syntax - I’ve attached a patch with the changes I made which appear to work locally. I didn’t really run it through all the edge cases though (unusual filenames, etc) so maybe there’s a gotcha somewherebase-shell-git-cmd-patch.txt
Released in
10.3.1
.This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v10.3.1, please open a new issue.