diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-12-24 00:59:46 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-12-24 00:59:46 +0300 |
commit | 04cd9996383791cde0e866eb96e516f7646227c3 (patch) | |
tree | cae258ce91a240e1ffae64d736386d7c9060ed01 /builtin | |
parent | d0762243631a782cafeb1ec8d7af60c95e229721 (diff) | |
parent | 5c29f19cdada762e75939a946df21b44d48d6fff (diff) |
Merge branch 'dl/checkout-p-merge-base'
Fix to a regression introduced during this cycle.
* dl/checkout-p-merge-base:
checkout -p: handle tree arguments correctly again
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/checkout.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 9b82119129..c9ba23c279 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -480,9 +480,11 @@ static int checkout_paths(const struct checkout_opts *opts, * with the hex of the commit (whether it's in `...` form or * not) for the run_add_interactive() machinery to work * properly. However, there is special logic for the HEAD case - * so we mustn't replace that. + * so we mustn't replace that. Also, when we were given a + * tree-object, new_branch_info->commit would be NULL, but we + * do not have to do any replacement, either. */ - if (rev && strcmp(rev, "HEAD")) + if (rev && new_branch_info->commit && strcmp(rev, "HEAD")) rev = oid_to_hex_r(rev_oid, &new_branch_info->commit->object.oid); if (opts->checkout_index && opts->checkout_worktree) |