jupyterlab / jupyterlab-git

A Git extension for JupyterLab
BSD 3-Clause "New" or "Revised" License
1.44k stars 312 forks source link

Failed to commit, Fail to set your identity. Unhandled error #498

Closed MindTooth closed 4 years ago

MindTooth commented 4 years ago

Description

When trying to create a commit, I get the error "Fail to set your identity. Unhandled error". I run Jupyter inside an venv environment. But I get this message.

The repo is from a private GitLab instance and I use a signing key when creating commits. user.name and user.email is valid.

I see that this has been reported before.

Reproduce

  1. Make changes to a file
  2. Go to Git sidebar
  3. Stage commit
  4. Add message
  5. Press checkmark
  6. Get error

Expected behavior

I expect that the commit happens.

Context

macOS Catalina Python 3 via Homebrew PATH: /Users/mindtooth/.venvs/jupyter/bin /Users/mindtooth/.bin /Users/mindtooth/.poetry/bin /Users/mindtooth/.local/bin /Users/mindtooth/.cargo/bin /Users/mindtooth/.go/bin /usr/local/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Users/mindtooth/.bin /Users/mindtooth/.poetry/bin /Users/mindtooth/.local/bin /Users/mindtooth/.cargo/bin /Users/mindtooth/.go/bin /Applications/kitty.app/Contents/MacOS

(Sorry for the dupe, I need to fix that.)

python3 -m vevn ~/.venv/jupyter
source ~/.venv/jupyter/bin/activate.fish
pip install -U pip
pip install -U jupyterlab jupyter-git
jupyter lab build
Command Line Output
[E 16:09:32.909 LabApp] Uncaught exception POST /git/config?1576076972892 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/git/config?1576076972892', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/Users/mindtooth/.venvs/jupyter/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/Users/mindtooth/.venvs/jupyter/lib/python3.7/site-packages/jupyterlab_git/handlers.py", line 465, in post
        response = self.git.config(top_repo_path, **options)
      File "/Users/mindtooth/.venvs/jupyter/lib/python3.7/site-packages/jupyterlab_git/git.py", line 106, in config
        k, v = l.split("=", maxsplit=1)
    ValueError: not enough values to unpack (expected 2, got 1)
[W 16:09:32.911 LabApp] Unhandled error
[E 16:09:32.912 LabApp] {
      "Host": "localhost:8888",
      "Pragma": "no-cache",
      "Accept": "*/*",
      "Authorization": "token 21abb39c16c9c820270b6d2e80c941a1e66f69a03460755d",
      "X-Xsrftoken": "2|7d980221|af408f600d598968cd637e03cf758a1c|1576074473",
      "Accept-Language": "en-us",
      "Cache-Control": "no-cache",
      "Accept-Encoding": "gzip, deflate",
      "Content-Type": "application/json",
      "Origin": "http://localhost:8888",
      "Content-Length": "42",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15",
      "Referer": "http://localhost:8888/lab",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8888=\"2|1:0|10:1576076969|23:username-localhost-8888|44:NjFjYTM1MmJiYTdlNGNiOWJmZDNjMWQ0ZGI1Y2Q2Zjc=|cde37e66b544feec934a3026e05139a9391062b45a1e0a266aabf3ddd38114c7\"; _xsrf=2|7d980221|af408f600d598968cd637e03cf758a1c|1576074473; ys-torrentGrid=o%3Acolumns%3Da%253Ao%25253Aid%25253Ds%2525253Aqueue%25255Ewidth%25253Dn%2525253A30%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Ds%2525253Aname%25255Ewidth%25253Dn%2525253A1000%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A2%25255Ewidth%25253Dn%2525253A75%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A3%25255Ewidth%25253Dn%2525253A150%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A4%25255Ewidth%25253Dn%2525253A80%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A5%25255Ewidth%25253Dn%2525253A80%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A6%25255Ewidth%25253Dn%2525253A60%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A7%25255Ewidth%25253Dn%2525253A60%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A8%25255Ewidth%25253Dn%2525253A60%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A9%25255Ewidth%25253Dn%2525253A60%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A10%25255Ewidth%25253Dn%2525253A60%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A11%25255Ewidth%25253Dn%2525253A80%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A12%25255Ewidth%25253Dn%2525253A120%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A13%25255Ewidth%25253Dn%2525253A120%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A14%25255Ewidth%25253Dn%2525253A75%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A15%25255Ewidth%25253Dn%2525253A75%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A16%25255Ewidth%25253Dn%2525253A75%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A17%25255Ewidth%25253Dn%2525253A75%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A18%25255Ewidth%25253Dn%2525253A75%25255Ehidden%25253Db%2525253A1%25255Esortable%25253Db%2525253A1%5Esort%3Do%253Afield%253Ds%25253Aname%255Edirection%253Ds%25253AASC; pmaUser-1=%7B%22iv%22%3A%22PwvJ0lIOsxJi0vz%2Bjwudkw%3D%3D%22%2C%22mac%22%3A%22a11876495a00a0a7702de4dceecb3e30a90adbf2%22%2C%22payload%22%3A%22wwgWOHACF1u84Xup95J%2B9Q%3D%3D%22%7D; pma_lang=en; Phpstorm-328b4b15=5becabe6-c723-412b-9f6a-1a0d9c63134f"
    }
[E 16:09:32.915 LabApp] 500 POST /git/config?1576076972892 (::1) 15.77ms referer=http://localhost:8888/lab
Browser Output
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (config, line 0)

[Error] Error: Fail to set your identity. Unhandled error
(anonymous function) — FileList.js:365
asyncFunctionResume
[native code]
promiseReactionJob

    (anonymous function) (vendors~main.92fde62ee8cd67447330.js:1:2743593)
    asyncFunctionResume
    (anonymous function)
    promiseReactionJob
telamonian commented 4 years ago

Your actual error is buried in your command line output:

  File "/Users/mindtooth/.venvs/jupyter/lib/python3.7/site-packages/jupyterlab_git/git.py", line 106, in config
    k, v = l.split("=", maxsplit=1)
ValueError: not enough values to unpack (expected 2, got 1)

Can you please run git config --list in your repo and post the results here (you should censor your name and email fields)? Basically, our current backend expects there to be exactly one = symbol on each line of that command's output, and for some reason in your case there's not

MindTooth commented 4 years ago

Ahh. Then I guess my GitAlias is creating this issue. I see that it creates some multi-lines. If I remove it, it works. 🤔

credential.helper=osxkeychain
color.ui=auto
commit.gpgsign=true
core.autocrlf=input
core.excludesfile=~/.config/git/gitignore_global
core.whitespace=cr-at-eol
credential.helper=osxkeychain
diff.wserrorhighlight=all
fetch.prune=true
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
github.user=MindTooth
help.autocorrect=5
include.path=gitalias.txt
alias.a=add
alias.b=branch
alias.c=commit
alias.d=diff
alias.f=fetch
alias.g=grep
alias.l=log
alias.m=merge
alias.o=checkout
alias.p=pull
alias.r=remote
alias.s=status
alias.w=whatchanged
alias.aa=add --all
alias.ap=add --patch
alias.au=add --update
alias.be=branch --edit-description
alias.bm=branch --merged
alias.bnm=branch --no-merged
alias.ca=commit --amend
alias.cam=commit --amend --message
alias.cane=commit --amend --no-edit
alias.ci=commit --interactive
alias.cm=commit --message
alias.co=checkout
alias.cp=cherry-pick
alias.cpa=cherry-pick --abort
alias.cpc=cherry-pick --continue
alias.cp-nx=cherry-pick --no-commit -x
alias.dc=diff --cached
alias.ds=diff --staged
alias.dw=diff --word-diff
alias.dd=diff --check --dirstat --find-copies --find-renames --histogram --color
alias.cleanest=clean -ffdx
alias.g=grep
alias.gl=grep --line-number
alias.gg=grep --break --heading --line-number --color
alias.lg=log --graph
alias.lo=log --oneline
alias.lp=log --patch
alias.lfp=log --first-parent
alias.lt=log --topo-order
alias.ll=log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset'
alias.lll=log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --abbrev=40 --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset'
alias.ls=ls-files
alias.ls-ignored=ls-files --others --i --exclude-standard
alias.me=merge --no-commit --no-ff
alias.pf=pull --ff-only
alias.pr=pull --rebase
alias.pp=pull --rebase=preserve
alias.rb=rebase
alias.rba=rebase --abort
alias.rbc=rebase --continue
alias.rbs=rebase --skip
alias.rbi=rebase --interactive @{upstream}
alias.fixup=!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET && GIT_EDITOR=true git rebase --interactive --autosquash $TARGET~; }; f
alias.rl=reflog
alias.rr=remote
alias.rrs=remote show
alias.rru=remote update
alias.rrp=remote prune
alias.incoming=!git remote update --prune
alias.outgoing=log @{upstream}..
alias.push-to-all-remotes=!git remote | xargs -I% -n1 git push %
alias.rv=revert
alias.rvnc=revert --no-commit
alias.sb=show-branch
alias.sm=submodule
alias.smi=submodule init
alias.sma=submodule add
alias.sms=submodule sync
alias.smu=submodule update
alias.smui=submodule update --init
alias.smuir=submodule update --init --recursive
alias.ss=status --short
alias.ssb=status --short --branch
alias.aliases=!git config --get-regexp '^alias\.' | cut -c 7- | sed 's/ / = /'
alias.add-alias=!f() { [ $# = 3 ] && git config $1 alias."$2" "$3" && return 0 || echo "Usage: git add-(local|global)-alias <new alias> <original command>" >&2 && return 1; }; f
alias.add-global-alias=!git add-alias --global
alias.add-local-alias=!git add-alias --local
alias.rename-alias=!f() { [ $# = 3 ] && [ $2 != $3 ] && [ ! -z "$(git config $1 --get alias.$2)" ] && [ -z "$(git config $1 --get alias.$3)" ] && git config $1 alias.$3 "$(git config $1 --get alias.$2)" && git config $1 --unset alias.$2 && return 0 || echo "Usage: git rename-(local|global)-alias <alias existing name> <new alias name>
The alias you are going to rename must exist and new name must not exist." >&2 && return 1; };f
alias.rename-global-alias=!git rename-alias --global
alias.rename-local-alias=!git rename-alias --local
alias.lasttag=describe --tags --abbrev=0
alias.lasttagged=!git describe --tags `git rev-list --tags --max-count=1`
alias.head=log -n1
alias.heads=!git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'
alias.lost=!git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub("SHA1: ", ""); print}'
alias.diff-all=!for name in $(git diff --name-only $1); do git difftool $1 $name & done
alias.diff-changes=diff --name-status -r
alias.diff-stat=diff --stat --ignore-space-change -r
alias.diff-staged=diff --cached
alias.diff-deep=diff --check --dirstat --find-copies --find-renames --histogram --color
alias.grep-all=!f() { git rev-list --all | xargs git grep "$@"; }; f
alias.grep-group=grep --break --heading --line-number --color
alias.grep-ack=-c color.grep.linenumber="bold yellow"     -c color.grep.filename="bold green"     -c color.grep.match="reverse yellow"     grep --break --heading --line-number
alias.init-empty=!f() { git init && git commit --allow-empty --allow-empty-message --message ''; }; f
alias.merge-span=!f() { echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f2); }; f
alias.merge-span-log=!git log `git merge-span .. $1`
alias.merge-span-diff=!git diff `git merge-span ... $1`
alias.merge-span-difftool=!git difftool `git merge-span ... $1`
alias.rebase-branch=!git rebase --interactive `git merge-base master HEAD`
alias.refs-by-date=for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short)'
alias.orphans=fsck --full
alias.rev-list-all-objects-sort-by-size=!git rev-list --all --objects  | awk '{print $1}'| git cat-file --batch-check | fgrep blob | sort -k3nr
alias.log-changes=log --oneline --reverse
alias.log-fresh=log ORIG_HEAD.. --stat --no-merges
alias.log-like=log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset'
alias.log-like-long=log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset'
alias.log-local=log --date=local
alias.log-my=!git log --author $(git config user.email)
alias.log-graph=log --graph --all --oneline --decorate
alias.log-first-date=!git log --date-order --format=%cI | tail -1
alias.log-latest-date=log -1 --date-order --format=%cI
alias.log-hour=log --since 1 hour ago
alias.log-day=log --since 1 day ago
alias.log-week=log --since 1 week ago
alias.log-month=log --since 1 month ago
alias.log-year=log --since 1 year ago
alias.log-my-hour=log --author $(git config user.email) --since 1 hour ago
alias.log-my-day=log --author $(git config user.email) --since 1 day ago
alias.log-my-week=log --author $(git config user.email) --since 1 week ago
alias.log-my-month=log --author $(git config user.email) --since 1 month ago
alias.log-my-year=log --author $(git config user.email) --since 1 year ago
alias.log-of-format-and-count=!f() { format="$1"; shift; git log $@ --format=oneline --format=$format | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) "%"}}' | sort; }; f
alias.log-of-count-and-format=!f() { format="$1"; shift; git log $@ --format=oneline --format=$format | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) "%", i}}' | sort -nr; }; f
alias.log-of-format-and-count-with-date=!f() { format="$1"; shift; date_format="$1"; shift; git log $@ --format=oneline --format="$format" --date=format:"$date_format" | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) "%"}}' | sort -r; }; f
alias.log-of-count-and-format-with-date=!f() { format="$1"; shift; date_format="$1"; shift; git log $@ --format=oneline --format="$format" --date=format:"$date_format" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) "%", i}}' | sort -nr; }; f
alias.log-of-email-and-count=!f() { git log-of-format-and-count "%aE" $@; }; f
alias.log-of-count-and-email=!f() { git log-of-count-and-format "%aE" $@; }; f
alias.log-of-hour-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%Y-%m-%dT%H" $@ ; }; f
alias.log-of-count-and-hour=!f() { git log-of-count-and-format-with-date "%ad" "%Y-%m-%dT%H" $@ ; }; f
alias.log-of-day-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%Y-%m-%d" $@ ; }; f
alias.log-of-count-and-day=!f() { git log-of-count-and-format-with-date "%ad" "%Y-%m-%d" $@ ; }; f
alias.log-of-week-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%Y#%V" $@; }; f
alias.log-of-count-and-week=!f() { git log-of-count-and-format-with-date "%ad" "%Y#%V" $@; }; f
alias.log-of-month-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%Y-%m" $@ ; }; f
alias.log-of-count-and-month=!f() { git log-of-count-and-format-with-date "%ad" "%Y-%m" $@ ; }; f
alias.log-of-year-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%Y" $@ ; }; f
alias.log-of-count-and-year=!f() { git log-of-count-and-format-with-date "%ad" "%Y" $@ ; }; f
alias.log-of-hour-of-day-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%H" $@; }; f
alias.log-of-count-and-hour-of-day=!f() { git log-of-count-and-format-with-date "%ad" "%H" $@; }; f
alias.log-of-day-of-week-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%u" $@; }; f
alias.log-of-count-and-day-of-week=!f() { git log-of-count-and-format-with-date "%ad" "%u" $@; }; f
alias.log-of-week-of-year-and-count=!f() { git log-of-format-and-count-with-date "%ad" "%V" $@; }; f
alias.log-of-count-and-week-of-year=!f() { git log-of-count-and-format-with-date "%ad" "%V" $@; }; f
alias.log-refs=log --all --graph --decorate --oneline --simplify-by-decoration --no-merges
alias.log-timeline=log --format='%h %an %ar - %s'
alias.log-local=log --oneline origin..HEAD
alias.log-fetched=log --oneline HEAD..origin/master
alias.chart=!f() {     git log --format=oneline --format="%aE %at" --since="48 days ago" $@ |     awk '     function time_to_slot(t) { return strftime("%Y-%m-%d", t, true) }     function count_to_char(i) { return (i > 0) ? ((i < 10) ? i : "X") : "." }     BEGIN {       time_min = systime(); time_max = 0;       SECONDS_PER_DAY=86400;     }     {       item = $1;       time = 0 + $2;       if (time > time_max){ time_max = time } else if (time < time_min){ time_min = time };       slot = time_to_slot(time);       items[item]++;       slots[slot]++;       views[item, slot]++;     }     END{       printf("Chart time range %s to %s.\n", time_to_slot(time_min), time_to_slot(time_max));       time_max_add = time_max += SECONDS_PER_DAY;       for(item in items){         row = "";         for(time = time_min; time < time_max_add; time += SECONDS_PER_DAY) {           slot = time_to_slot(time);           count = views[item, slot];           row = row count_to_char(count);         }         print row, item;       }     }';   }; f
alias.churn=!f() { git log --all --find-copies --find-renames --name-only --format='format:' "$@" | awk 'NF{a[$0]++}END{for(i in a){print a[i], i}}' | sort -rn;};f
alias.summary=!f() {     printf "Summary of this branch...
";     printf "%s
" $(git rev-parse --abbrev-ref HEAD);     printf "%s first commit timestamp
" $(git log --date-order --format=%cI | tail -1);     printf "%s latest commit timestamp
" $(git log -1 --date-order --format=%cI);     printf "%d commit count
" $(git rev-list --count HEAD);     printf "%d date count
" $(git log --format=oneline --format="%ad" --date=format:"%Y-%m-%d" | awk '{a[$0]=1}END{for(i in a){n++;} print n}');     printf "%d tag count
" $(git tag | wc -l);     printf "%d author count
" $(git log --format=oneline --format="%aE" | awk '{a[$0]=1}END{for(i in a){n++;} print n}');     printf "%d committer count
" $(git log --format=oneline --format="%cE" | awk '{a[$0]=1}END{for(i in a){n++;} print n}');     printf "%d local branch count
" $(git branch | grep -v " -> " | wc -l);     printf "%d remote branch count
" $(git branch -r | grep -v " -> " | wc -l);     printf "
Summary of this directory...
";     printf "%s
" $(pwd);     printf "%d file count via git ls-files
" $(git ls-files | wc -l);     printf "%d file count via find command
" $(find . | wc -l);     printf "%d disk usage
" $(du -s | awk '{print $1}');     printf "
Most-active authors, with commit count and %%...
"; git log-of-count-and-email | head -7;     printf "
Most-active dates, with commit count and %%...
"; git log-of-count-and-day | head -7;     printf "
Most-active files, with churn count
"; git churn | head -7;   }; f
alias.whois=!sh -c 'git log --regexp-ignore-case -1 --pretty="format:%an <%ae>
" --author="$1"' -
alias.whatis=show --no-patch --pretty='tformat:%h (%s, %ad)' --date=short
alias.who=shortlog --summary --
alias.whorank=shortlog --summary --numbered --no-merges
alias.issues=!sh -c "git log $1 --oneline | grep -o \"ISSUE-[0-9]\+\" | sort -u"
alias.commit-parents=!f(){ git cat-file -p "${*:-HEAD}" | sed -n '/0/,/^ *$/{/^parent /p}'; };f
alias.commit-is-merge=!f(){ [ -n "$(git commit-parents "$*" | sed '0,/^parent /d')" ];};f
alias.commit-message-key-lines=!f(){ echo "Commit: $1"; git log "$1" --format=fuller | grep "^[[:blank:]]*[[:alnum:]][-[:alnum:]]*:" | sed "s/^[[:blank:]]*//; s/:[[:blank:]]*/: /"; }; f
alias.cloner=clone --recursive
alias.save=stash push
alias.pop=stash pop
alias.snapshot=!git stash push snapshot: $(date) && git stash apply stash@{0}
alias.panic=!tar cvf ../panic.tar *
alias.archive=!f() { top=$(rev-parse --show-toplevel); cd $top; tar cvf $top.tar $top ; }; f
alias.get=!git fetch --prune && git pull --rebase=preserve && git submodule update --init --recursive
alias.put=!git commit --all && git push
alias.mastery=!git checkout master && git fetch origin --prune && git reset --hard origin/master
alias.ignore=!git status | grep -P "^\t" | grep -vF .gitignore | sed "s/^\t//" >> .gitignore
alias.push1=!git push origin $(git branch-name)
alias.pull1=!git pull origin $(git branch-name)
alias.track=!f(){ branch=$(git rev-parse --abbrev-ref HEAD); cmd="git branch $branch -u ${1:-origin}/${2:-$branch}"; echo $cmd; $cmd; }; f
alias.untrack=!f(){ branch=$(git rev-parse --abbrev-ref HEAD); cmd="git branch --unset-upstream ${1:-$branch}"; echo $cmd; $cmd; }; f
alias.track-all-remote-branches=!f() { git branch -r | grep -v ' -> ' | sed 's/^ \+origin\///' ; }; f
alias.reset-commit=reset --soft HEAD~1
alias.reset-commit-hard=reset --hard HEAD~1
alias.reset-commit-clean=!git reset --hard HEAD~1 && git clean -fd
alias.reset-to-pristine=!git reset --hard && git clean -ffdx
alias.reset-to-upstream=!git reset --hard $(git upstream-name)
alias.undo-commit=reset --soft HEAD~1
alias.undo-commit-hard=reset --hard HEAD~1
alias.undo-commit-clean=!git reset --hard HEAD~1 && git clean -fd
alias.undo-to-pristine=!git reset --hard && git clean -ffdx
alias.undo-to-upstream=!git reset --hard $(git upstream-name)
alias.uncommit=reset --soft HEAD~1
alias.unadd=reset HEAD
alias.unstage=reset HEAD
alias.discard=checkout --
alias.cleanout=!git clean -df && git checkout -- .
alias.expunge=!f() { git filter-branch --force --index-filter "git rm --cached --ignore-unmatch $1" --prune-empty --tag-name-filter cat -- --all }; f
alias.edit-cached=!f() { git ls-files --cached          | sort -u ; }; `git var GIT_EDITOR` `f`
alias.edit-deleted=!f() { git ls-files --deleted         | sort -u ; }; `git var GIT_EDITOR` `f`
alias.edit-others=!f() { git ls-files --others          | sort -u ; }; `git var GIT_EDITOR` `f`
alias.edit-ignored=!f() { git ls-files --ignored         | sort -u ; }; `git var GIT_EDITOR` `f`
alias.edit-killed=!f() { git ls-files --killed          | sort -u ; }; `git var GIT_EDITOR` `f`
alias.edit-modified=!f() { git ls-files --modified        | sort -u ; }; `git var GIT_EDITOR` `f`
alias.edit-stage=!f() { git ls-files --stage | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`
alias.edit-unmerged=!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`
alias.add-unmerged=!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`
alias.ours=!f() { git checkout --ours   $@ && git add $@; }; f
alias.theirs=!f() { git checkout --theirs $@ && git add $@; }; f
alias.wip=!git add --all; git ls-files --deleted -z | xargs -0 git rm; git commit --message=wip
alias.unwip=!git log -n 1 | grep -q -c wip && git reset HEAD~1
alias.assume=update-index --assume-unchanged
alias.unassume=update-index --no-assume-unchanged
alias.assume-all=!git st -s | awk {'print $2'} | xargs git assume
alias.unassume-all=!git assumed | xargs git update-index --no-assume-unchanged
alias.assumed=!git ls-files -v | grep ^h | cut -c 3-
alias.master-cleanse=!git master-cleanse-local
alias.master-cleanse-local=!git checkout master && git branch --merged | xargs git branch --delete
alias.master-cleanse-remote=!git branch --remotes --merged origin/master | sed 's# *origin/##' | grep -v '^master$' xargs -I% git push origin :% 2>&1 | grep --colour=never 'deleted'
alias.publish=!git push --set-upstream origin $(git branch-name)
alias.unpublish=!git push origin :$(git branch-name)
alias.reincarnate=!f() { [[ -n $@ ]] && git checkout "$@" && git unpublish && git checkout master && git branch -D "$@" && git checkout -b "$@" && git publish; }; f
alias.branches=branch -a
alias.tags=tag -n1 --list
alias.stashes=stash list
alias.top-name=rev-parse --show-toplevel
alias.branch-name=rev-parse --abbrev-ref HEAD
alias.upstream-name=!git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)
alias.exec=! exec
alias.pruner=!git prune --expire=now; git reflog expire --expire-unreachable=now --rewrite --all
alias.repacker=repack -a -d -f --depth=300 --window=300 --window-memory=1g
alias.optimize=!git pruner
alias.searchcommits=!f() { query="$1"; shift; git log -S"$query" "$@"; }; f "$@"
alias.debug=!GIT_PAGER= gdb --args git
alias.intercommit=!sh -c 'git show $1 > .git/commit1 && git show $2 > .git/commit2 && interdiff .git/commit[12] | less -FRS' -
alias.prune-all=!git remote | xargs -n 1 git remote prune
alias.cherry-pick-merge=!sh -c 'git cherry-pick --no-commit --mainline 1 $0 &&     git log -1 --pretty=%P $0 | cut -b 42- > .git/MERGE_HEAD &&     git commit --verbose'
alias.remote-ref=!sh -c '     local_ref=$(git symbolic-ref HEAD);     local_name=${local_ref##refs/heads/};     remote=$(git config branch."#local_name".remote || echo origin);     remote_ref=$(git config branch."$local_name".merge);     remote_name=${remote_ref##refs/heads/};     echo remotes/$remote/$remote_name'
alias.rebase-recent=!git rebase --interactive $(git remote-ref)
alias.graphviz=!f() { echo 'digraph git {' ; git log --pretty='format:  %h -> { %p }' "$@" | sed 's/[0-9a-f][0-9a-f]*/"&"/g' ; echo '}'; }; f
alias.serve=-c daemon.receivepack=true daemon --base-path=. --export-all --reuseaddr --verbose
alias.topic-base-branch-name=!f(){     printf "master
";   };f
alias.topic-start=!f(){     topic_branch="$1";     git topic-create "$topic_branch";     git topic-push;   };f
alias.topic-stop=!f(){     git topic-push;     git topic-delete;   };f
alias.topic-create=!f(){     topic_branch="$1";     base_branch=$(git topic-base-branch-name);     git checkout "$base_branch"; git pull;     git checkout -b "$topic_branch" "$base_branch";   };f
alias.topic-delete=!f(){     topic_branch=$(git branch-name);     base_branch=$(git topic-base-branch-name);     if [ "$topic_branch" = "$base_branch" ]; then       printf "You are trying to delete your git topic branch,
";       printf "but you are on the base branch: $topic_base_branch.
";       printf "Please checkout the topic branch that you want,
";       printf "then retry the git topic delete command.
";     else       git checkout "$base_branch";       git branch --delete "$topic_branch";       git push origin ":$topic_branch";     fi;   };f
alias.topic-pull=!f(){     git pull;   };f
alias.topic-push=!f(){     topic_branch=$(git branch-name);     git push --set-upstream origin "$topic_branch";   };f
alias.topic-rebase-base=!f(){     topic_branch=$(git branch-name);     base_branch=$(git topic-base-branch-name);     git checkout "$base_branch"; git pull;     git checkout "$topic_branch"; git rebase "$base_branch";   };f
alias.topic-merge-base=!f(){     topic_branch=$(git branch-name);     base_branch=$(git topic-base-branch-name);     git checkout "$base_branch"; git pull;     git checkout "$topic_branch"; git merge "$base_branch";   };f
alias.topic-sync=!f(){     git topic-pull;     git topic-push;   };f
alias.topic-move=!f(){     new_branch="$1";     old_branch=$(git branch-name);     git branch --move "$old_branch" "$new_branch";     git push origin ":$old_branch" "$new_branch";   };f
alias.cvs-i=cvsimport -k -a
alias.cvs-e=cvsexportcommit -u -p
alias.gitk-conflict=!gitk --left-right HEAD...MERGE_HEAD
alias.gitk-history-all=!gitk --all $( git fsck | awk '/dangling commit/ {print $3}' )
alias.rails-get=!git pull --rebase; git submodule update --init --recursive; bundle check || bundle install; bundle exec rake db:migrate; bundle exec rake db:test:prepare
alias.svn-b=svn branch
alias.svn-m=merge --squash
alias.svn-c=svn dcommit
alias.svn-cp=!GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick --edit
alias.ull=pull
alias.ush=push
protocol.version=2
pull.rebase=true
push.default=nothing
rebase.autosquash=true
rerere.autoupdate=true
rerere.enabled=true
user.name=
user.email=
user.signingkey=
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=git@###URL###
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.upstream.url=git@###URL###
remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
telamonian commented 4 years ago

Yep, it's definitely stuff like:

alias.topic-base-branch-name=!f(){ printf "master "; };f

that's causing the error you're getting. Really, it's a weakness in how we parse the output of git config --list. One alternative would be to use git config --get <key> to fetch only the specific config values that we actually use.

@fcollonval Are you more familiar with how the information returned by our Git.config function actually gets used? Could we limit it to just fetching a few specific values?

MindTooth commented 4 years ago

I see. Thanks for taking a look. 👍

With regards for using the getter directly, would that not improve performance?

telamonian commented 4 years ago

With regards for using the getter directly, would that not improve performance?

Surprisingly, probably not. Up to this point, the most important thing for optimizing backend performance has been minimizing the total number of subprocess calls. In other words, even if:

subprocess.Popen(["git", "config", "--list"])

returns 1000 lines, it's still probably faster to parse that large output than it is to run:

subprocess.Popen(["git", "config", "--get", "<some-key>"])

a dozen separate times for a dozen keys. Though, unless we need to do this for 100+ keys, the performance difference isn't likely to be large. Thus, we should probably prioritize robustness, and try to figure out how to support the edge case that you've brought up here, @MindTooth