#i broke dagger develop with my git alias πŸ˜‚

1 messages Β· Page 1 of 1 (latest)

sacred pine
#

I ran into an issue and after commenting out this alias in my git config dagger develop worked.

Error:

βœ” connect 0.3s

βœ” moduleSource(refString: "./dagger", requireKind: LOCAL_SOURCE): ModuleSource! 0.7s
βœ” .localContextDirectoryPath: String! 0.0s

βœ” ModuleSource.sourceRootSubpath: String! 0.0s

βœ” ModuleSource.withEngineVersion(version: "latest"): ModuleSource! 0.0s
βœ” .sdk: SDKConfig 0.0s
βœ” .source: String! 0.0s

βœ” ModuleSource.withSDK(source: "go"): ModuleSource! 0.0s
βœ” .sourceSubpath: String! 0.0s

βœ” ModuleSource.configClients: [ModuleConfigClient!]! 0.0s

✘ ModuleSource.generatedContextDirectory: Directory! 0.1s
! failed to run codegen: failed to generate code: git config error: Failed to parse git config invalid format: line "\";               git commit -a -m \"$resp\";           fi;       else           printf \"βœ… ${green}Creating a new commit with provided message${reset}" doesn't match
! key=value pattern
β”‚ ✘ go SDK: run codegen 0.1s
β”‚ ! git config error: Failed to parse git config invalid format: line "\";               git commit -a -m \"$resp\";           fi;       else           printf \"βœ… ${green}Creating a new commit with provided message${reset}" doesn't match key=value pattern
Error: failed to generate code: input: moduleSource.withEngineVersion.withSDK.generatedContextDirectory failed to run codegen: failed to generate code: git config error: Failed to parse git config invalid format: line "\";               git commit -a -m \"$resp\";           fi;       else           printf \"βœ… ${green}Creating a new commit with provided message${reset}" doesn't match key=value pattern
#

Git alias in question...

[alias]

  save = "!f() { \
      green='\\033[0;32m'; \
      blue='\\033[0;34m'; \
      reset='\\033[0m'; \
      if git diff --quiet && git diff --cached --quiet; then \
          printf \":sleeping: ${blue}Nothing to save or commit${reset}\n\"; \
          return; \
      fi; \
      msg=''; \
      while [ $# -gt 0 ]; do \
          case $1 in \
              -m|--message) msg=\"$2\"; shift 2;; \
              *) shift;; \
          esac; \
      done; \
      if [ -z \"$msg\" ]; then \
          if (git status -sb 2>/dev/null | grep -q ahead || ! git ls-remote --heads origin $(git rev-parse --abbrev-ref HEAD) &>/dev/null) && git branch --contains $(git rev-parse HEAD) --all | grep -q $(git rev-parse --abbrev-ref HEAD); then \
              printf \":arrows_counterclockwise: ${green}Amending last commit${reset}\n\"; \
              git commit -a --amend --no-edit; \
          else \
              git status -sb --untracked-files=no; \
              printf \":writing_hand:  ${blue}Please provide a description of your changes:${reset}\n\"; \
              resp=$(gum input --placeholder=\"chore(wip): branch work in progress\"); \
              printf \":white_check_mark: ${green}Creating a new commit${reset}\n\"; \
              git commit -a -m \"$resp\"; \
          fi; \
      else \
          printf \":white_check_mark: ${green}Creating a new commit with provided message${reset}\n\"; \
          git commit -a -m \"$msg\"; \
      fi; \
  }; f"

#

I'm so good at breaking things 🀣

#

it actually breaks all dagger commands for me like dagger call too πŸ™‚

midnight iris
#

Lol, Dagger helps you by checking your git config is correctly set πŸ˜›

#

Definitely an issue. I'll be creating one in a bit

#

@sacred pine

midnight iris
#

hmm.. I'm trying to see if we should change this behavior though

#

since dagger call tries to read the config to find some config it case it needs to fetch some private modules

#

if the git config format is incorrect, it actually makes sense for the dagger call to fail

#

I think I won't be doing any changes here since it's not clear to me how / what we could improve in this case.

sacred pine
#

To be clear it's not an invalid alias. The alias works just fine. However, it's a pretty complex one so I was assuming this had to do with parsing the escaping/strings?

If you install gum (via brew) and try, you should see it works?

  • it emulates the behavior of the bit git cli, which means save ammends if I haven't pushed it, else creates a new comment when it's already been pushed.

What am I missing πŸ™‚

midnight iris
#

oh! we actually do something.. definitely an issue from our end. Will fix in a bit πŸ™

midnight iris