Repository: vscode
Issue: Git - git.rebaseWhenSync malfunctions since several versions
Labels: bug,git

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: N/A

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
Version: 1.75.0
Commit: 220f9387c973de4cc44c545642ad2c90170bd3ef
Datum: 2022-12-07T02:03:33.946Z
Electron: 21.3.3
Chromium: 106.0.5249.119
Node.js: 16.16.0
V8: 10.6.194.18-electron.0
Betriebssystem: Linux x64 5.15.80-gentoo
Sandkasten: No

Steps to Reproduce:

1. Enable `git.rebaseWhenSync`
2. Push some changes to remote from other workplaces
3. Create a commit locally
4. Attempt syncing

The result is a popup window "Can't push refs to remote. Try running "Pull" first to integrate your changes." with 3 buttons.
Logs show that a rebase already took place:
```sh
2023-01-13 00:23:28.803 [info] > git push origin master:master [716ms]
To ***************************
 ! [rejected]                master -> master (fetch first)
error: failed to push some refs to '******************************'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
2023-01-13 00:23:29.181 [info] > git pull --tags -r origin master [1104ms]
2023-01-13 00:23:29.181 [info] From ********************************
 * branch                    master     -> FETCH_HEAD
   9cec59bee04..250bf529171  master     -> origin/master
Rebasing (1/1)

                                                                                
Successfully rebased and updated refs/heads/master.
2023-01-13 00:23:30.310 [info] > git config --get commit.template [11ms]
2023-01-13 00:23:30.311 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [2ms]
2023-01-13 00:23:30.329 [info] > git status -z -uall [9ms]
2023-01-13 00:23:30.331 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [2ms]
2023-01-13 00:23:30.411 [info] > git ls-files --stage -- /************************************ [8ms]
2023-01-13 00:23:30.419 [info] > git ls-files --stage -- /************************************ [9ms]
2023-01-13 00:23:30.427 [info] > git cat-file -s 8d5c0705ab5ed761832c71b87959c7098644fc3c [9ms]
2023-01-13 00:23:30.429 [info] > git cat-file -s 49c98600d177bad9bfc8bf2571c4187f6ae202ba [3ms]
2023-01-13 00:23:30.448 [info] > git show --textconv :********************************** [11ms]
2023-01-13 00:23:30.452 [info] > git show --textconv :********************************** [5ms]
```

Second sync attempt succeeds without errors.

Previously it succeeded from the first attempt without erring like that.