# Planting new `update-ref refs/heads/new-branch` lines in git-rebase-todo adds semi to end of branch names

1 messages from 2022-11-11 to 2022-11-11. Participants: Devin Rhode.
Thread: https://gitlist.dev/t/58788

## Devin Rhode, 2022-11-11 16:09

Subject: Planting new `update-ref refs/heads/new-branch` lines in git-rebase-todo adds semi to end of branch names
Message-ID: <CAG8sxgmHg0CmD9T01NYUmOC7k7fPSwHjwD7rKXOgyBnVQw6v7Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAG8sxgmHg0CmD9T01NYUmOC7k7fPSwHjwD7rKXOgyBnVQw6v7Q%40mail.gmail.com

```
What did you do before the bug happened? (Steps to reproduce your issue)

1. Run `git rebase -i next` with `--update-refs` or the git config
setting `rebase.updateRefs = true`
2. Given `git-rebase-todo`:
ˋˋˋ
pick fjr23j3 foo bar
pick j3j413 bar bar
ˋˋˋ

3. Add a new update-ref line like so.
ˋˋˋ
pick fjr23j3 foo bar
update-ref refs/heads/devin/foo/bar/bar/bar/branch-new-name;

pick j3j413 bar bar
ˋˋˋ
`devin/foo/bar/bar/bar/branch-new-name` branch name does not already exist.
The intention here is to create a new branch name at this point in the
history (to create a stacked PR).

3. Complete rebase, see this output:
ˋˋˋ
Successfully rebased and updated
refs/heads/devin/foo-821-analytics-for-checkout.
Updated the following refs with --update-refs:
        refs/heads/devin/edit-step-1-copy  // <-- no semi
        refs/heads/devin/edit-step-2-copy  // <-- no semi
        refs/heads/devin/refactor-foolytics;    // <-- Trailing semi
        refs/heads/devin/foo-821-analytics-for-checkout;  // <-- Trailing semi
ˋˋˋ
4.
$ git branch
  devin/edit-step-1-copy
  devin/edit-step-2-copy
  devin/refactor-foolytics;
  devin/rename-logAnalyticsEvents;
  devin/foo-731-add-segment-tracking-to-tutorialfoocom
  devin/foo-736-lock-checkout-behind-a-query-param
  devin/foo-779-add-segment-events-for-all-clicksuser
  devin/foo-779-add-segment-events-for-all-clicksuser;
  devin/foo-808-button-to-re-try-failed-checkout
  devin/foo-808-button-to-re-try-failed-checkout;
* devin/foo-821-analytics-for-checkout
  devin/foo-821-analytics-for-checkout;
+ devin/foo-828-add-sentry-to-tutorialfoocom
  devin/sort-tailwind-classes
  fix/crashing-on-falsy-amazonProductID
  main
  refactor-foolytics

5. After rebasing, paste a series of git push commands into vscode's
integrated terminal:
ˋˋˋ
git push origin --force-with-lease
devin/edit-step-1-copy:refs/heads/devin/edit-step-1-copy;
git push origin --force-with-lease
devin/edit-step-2-copy:refs/heads/devin/edit-step-2-copy;
ˋˋˋ
I wasn't paying perfect attention to the semicolon at the end of these
git push lines.
Some may have included a semi, some not.

I think at some point, I converted a series of `git push` commands
BACK into `update-ref` commands, because I did a weird rebase thing
and the `update-ref` lines didn't appear on the next rebase.

This is probably an error on my part, but `update-ref` lines added to
`git-rebase-todo` should fail if they end with a semicolon, and the
user should be forced to remove them.

[System Info]
git version:
git version 2.38.1
cpu: arm64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Darwin 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:46
PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T8101 arm64
compiler info: clang: 14.0.0 (clang-1400.0.29.102)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh

[Environment]
Using arm-native macOS terminal
zsh --version:
zsh 5.8.1 (x86_64-apple-darwin21.0)

[Enabled Hooks]
(none)

```
