Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot detect transcrypt repo #166

Closed
dimitrov-adrian opened this issue May 25, 2023 · 4 comments
Closed

Cannot detect transcrypt repo #166

dimitrov-adrian opened this issue May 25, 2023 · 4 comments

Comments

@dimitrov-adrian
Copy link
Contributor

Get error transcrypt: the current repository is not configured using transcrypt --display command

It seems that it caused when grep is set globally to use colors, then the comparison from get_contexts_from_git_config() the [[ "$name" = "transcrypt.password" ]] do not work since it compare colorized than non-colorized string

dimitrov-adrian added a commit to dimitrov-adrian/transcrypt that referenced this issue May 25, 2023
Disable colors when doing grep
@jmurty
Copy link
Collaborator

jmurty commented May 25, 2023

Hi, I assume this problem is occurring because you are using --color=always in a grep alias or similar?

Another option would be to use the --color=auto instead, which should give you better behaviour: coloured output when you run grep yourself in a terminal, but no color code junk when grep is run within scripts like transcrypt.

@jmurty jmurty mentioned this issue May 25, 2023
@jmurty
Copy link
Collaborator

jmurty commented May 25, 2023

With some trial and error I have reproduced this problem by setting the environment variable GREP_OPTIONS='--color=always' which I'm assuming is what you have?

With that envvar set I see the same error as reported.

Adding this line near the top of the transcrypt file fixes it for me, can you confirm whether it solves the problem for you too?

GREP_OPTIONS=""

If this works I'd be happy to add it to transcrypt as a work-around for problematic global settings, since it is a more broadly compatible approach than the one in PR #167

@dimitrov-adrian
Copy link
Contributor Author

I was trying same approach since GREP_COLORS didn't make any difference for me, but GREP_OPTIONS do the trick.

I was also thinking if doing in bit different way, since grep matching the first part, then if

config_names=$(git config --local --name-only --list | grep transcrypt | cut -d '.' -f2-)
extract_context_name_regex="(${CONTEXT_REGEX}).password"

and the comparison

if [[ "$name" = "password" ]]; then

@jmurty jmurty closed this as completed in a825f9d May 26, 2023
@jmurty
Copy link
Collaborator

jmurty commented May 26, 2023

I have applied a fix for this in commit #a825f9de0b16084b5e279cf9deaba23ade333b85

jmurty added a commit that referenced this issue May 26, 2023
jmurty added a commit that referenced this issue Jul 16, 2023
* main:
  Add instructions for installation on FreeBSD (#168)
  Fix linting failure for fix of #166
  Prevent global options in `GREP_OPTIONS` envvar from breaking transcript. Fixes #166
  Remove no longer supported Ubuntu 18.04 version from test matrix
  Fix mistaken warnings when transcrypt's pre-commit hook is re-installed, e.g. for multiple contexts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants