felixSchl/git-fiddle

Support shells other than bash

Closed this issue · 6 comments

The git rebase exec command runs with the user's default shell. git-fiddle uses bash syntax, so it'd probably be wise to explicitly invoke bash. Otherwise, git-fiddle won't work for people who use, for example, the fish shell.

Yeah sure, but the actual code run with exec is a one liner to git commit --amend. I haven't used fish much, but it works fine with zsh which I use. I wonder if we can get travis to run it through a couple of shells to test this out. Also all shell code should be bash 3 compatible since that's what ships with OSX. I also have to use a version of awk from 2007 (not that I use it much in this project).

It doesn't work with fish because you set an environment variable temporarily using the syntax "VAR=foo command". zsh is largely compatible with bash, but fish isn't, and that syntax doesn't work.

I think it's simpler to invoke "bash -c" than to worry about configuring travis to run your code through multiple shells, but you're the boss. =)

FWIW, here's the error from fish, scrubbed of the info about the particular commit:

Executing: GIT_AUTHOR_DATE='???' git commit --amend --no-edit --date='???'
--author='???' --message=$'???'
Unknown command 'GIT_AUTHOR_DATE=???'. Did you mean to run git with a modified
environment? Try 'env GIT_AUTHOR_DATE=??? git…'. See the help section on the set command by typing 'help set'.
fish: GIT_AUTHOR_DATE='???' git commit --amend --no-edit --date='???'
--author='???' --message=$'???'

I took an initial stab at this (60aa142). The problem is that the input to -c needs to be quoted, which in turns means I have to ensure that the string I am passing is escaped properly, so not to accidentally unquote. I wonder if there's a easy solution to this. For now I just did sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' to escape backslashes and double quotes.

@sethfowler I installed fish and with the last two commits it appears to be working. Can you confirm?

I'm gonna close this. You can re-open if it still breaks for you