[Bug report] git cherry-pick silently ignores error whereas git apply fails for hunk apply
- From
Bhavik Bavishi <bhavikdbavishi@gmail.com>
- Date
- Nov 7, 2025, 04:39 UTC
- Message-ID
- <CAEyHQXWd77_jJachC6FYbWMJ+L=KkKoUqiACQ7z8r-ZwYq8JYw@mail.gmail.com>
Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.
What did you do before the bug happened? (Steps to reproduce your issue)
> ran git cherry-pick command, which went fine without any error, but missed to apply change > created patch with 'git fromat-patch' and applied with 'git apply --verbose', which error for the issue
What did you expect to happen? (Expected behavior)
> git cherry-pick should fail, since it failed to apply hunk
What happened instead? (Actual behavior)
> git cherry-pick completed successfully without any error
What's different between what you expected and what actually happened?
> git apply --verbose, failed with error about the issue, whereas git cherry-pick didn't fail for the same
Anything else you want to add:
> same error observed with '2.51.2' version as well > we do primarily use Gerrit UI for cherry-pick, so JGIT has similar behaviour as git cli for cherry-pick.
> can we have verbose mode for git cherry-pick, like git apply --verbose ?
> below is output of git apply (note I've changed words for source code references)
======================================================================= git apply --verbose ../test.patch Checking patch mango/connectors/apple/ops/query_check_hierarchy_op.cc... Checking patch mango/connectors/container/loc_base/util.cc... Checking patch mango/connectors/container/loc_base/util.h... Checking patch mango/main/http_test_ops/new_op.cc... Hunk #1 succeeded at 56 (offset 2 lines). Hunk #2 succeeded at 1074 (offset 21 lines). Checking patch mango/main/main.cc... Hunk #1 succeeded at 9876 (offset -63 lines). Checking patch mango/main/ops/refresh_apple_hierarchy_op.cc... Hunk #4 succeeded at 1713 (offset 18 lines). Checking patch mango/main/validation_util.cc... Hunk #1 succeeded at 42 (offset -1 lines). Hunk #2 succeeded at 106 (offset -2 lines). Hunk #3 succeeded at 11167 (offset -14 lines). Checking patch mango/conn/ops/apple_box_storage_package_op.cc... Checking patch mango/utils/apple_utils.cc... error: while searching for:
//-----------------------------------------------------------------------------
// Returns true if Apple Box Pack usecases + the corresponding updates flag
// is enabled.
bool Converter::IsAppleBoxPackEnabled(
std::shared_ptr<const orange::FeatureEnabler> updates_checks,
std::shared_ptr<const mango::RegisteredParams>
newed_params) {
for (const auto& usecase :
newed_params->apple_params().use_cases()) {
if ((usecase == RegisteredAppleParams_UseCase_kBoxPack) &&
updates_checks->updates_list_map()
.apple_box_storage_protection_enabled()) {
return true;
}
}
return false;
}//-----------------------------------------------------------------------------
}}} // namespace org::mango::apple
error: patch failed: mango/utils/apple_utils.cc:658 error: mango/utils/apple_utils.cc: patch does not apply Checking patch mango/utils/apple_utils.h... =======================================================================
Please review the rest of the bug report below. You can delete any lines you don't wish to share.
[System Info] git version: git version 2.34.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64 compiler info: gnuc: 11.4 libc info: glibc: 2.35 $SHELL (typically, interactive shell): /bin/bash
[Enabled Hooks] commit-msg