diff options
| author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2022-11-10 16:43:40 +0000 |
|---|---|---|
| committer | Taylor Blau <me@ttaylorr.com> | 2022-11-10 23:36:24 -0500 |
| commit | 82766b29611aea7c3fb42a99debfba1436852d38 (patch) | |
| tree | 288e0457bb82c5a6909dae93abcca6da0db58ec6 /notes-utils.c | |
| parent | The eleventh batch (diff) | |
| download | git-82766b29611aea7c3fb42a99debfba1436852d38.tar.gz git-82766b29611aea7c3fb42a99debfba1436852d38.zip | |
sequencer: unify label lookup
The arguments to the `reset` and `merge` commands may be a label created
with a `label` command or an arbitrary commit name. The `merge` command
uses the lookup_label() function to lookup its arguments but `reset` has
a slightly different version of that function in do_reset(). Reduce this
code duplication by calling lookup_label() from do_reset() as well.
This change improves the behavior of `reset` when the argument is a
tree. Previously `reset` would accept a tree only for the rebase to
fail with
update_ref failed for ref 'HEAD': cannot update ref 'HEAD': trying to write non-commit object da5497437fd67ca928333aab79c4b4b55036ea66 to branch 'HEAD'
Using lookup_label() means do_reset() will now error out straight away
if its argument is not a commit.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'notes-utils.c')
0 files changed, 0 insertions, 0 deletions
