]> git.ipfire.org Git - thirdparty/git.git/commit - sequencer.c
rebase-merges: move labels' whitespace mangling into `label_oid()`
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 17 Nov 2019 23:16:09 +0000 (23:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Nov 2019 03:49:16 +0000 (12:49 +0900)
commit867bc1d236b8955414b3dbacf28c7f0c2e337cf4
tree07113c5d1f2f2cd7f4d0c9e1aa2d1a38ac34bea6
parentd9f6f3b6195a0ca35642561e530798ad1469bd41
rebase-merges: move labels' whitespace mangling into `label_oid()`

One of the trickier aspects of the design of `git rebase
--rebase-merges` is the way labels are generated for the initial todo
list: those labels are supposed to be intuitive and first and foremost
unique.

To that end, `label_oid()` appends a unique suffix when necessary.

Those labels not only need to be unique, but they also need to be valid
refs. To make sure of that, `make_script_with_merges()` replaces
whitespace by dashes.

That would appear to be the wrong layer for that sanitizing step,
though: all callers of `label_oid()` should get that same benefit.

Even if it does not make a difference currently (the only called of
`label_oid()` that passes a label that might need to be sanitized _is_
`make_script_with_merges()`), let's move the responsibility for
sanitizing labels into the `label_oid()` function.

This commit is best viewed with `-w` because it unfortunately needs to
change the indentation of a large block of code in `label_oid()`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c