question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support getting spec Git info when active shell differs in syntax from bash

See original GitHub issue

What 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", ... 

Screen Shot 2022-06-22 at 10 31 44 AM

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:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mike-plummercommented, Jul 11, 2022

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 somewhere

base-shell-git-cmd-patch.txt

0reactions
cypress-bot[bot]commented, Jul 19, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found