summaryrefslogtreecommitdiff
path: root/t/helper/test-delta.c
diff options
context:
space:
mode:
authorLibravatar Glen Choo <chooglen@google.com>2021-11-17 16:53:25 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-11-18 22:31:19 -0800
commit4a2dcb1a08008bfc48c32f408e8622bd0c4ca297 (patch)
tree3b9fe61405a94eae100acc8bc3cb79b55dada96a /t/helper/test-delta.c
parentremote: remove the_repository->remote_state from static methods (diff)
downloadtgif-4a2dcb1a08008bfc48c32f408e8622bd0c4ca297.tar.xz
remote: die if branch is not found in repository
In a subsequent commit, we would like external-facing functions to be able to accept "struct repository" and "struct branch" as a pair. This is useful for functions like pushremote_for_branch(), which need to take values from the remote_state and branch, even if branch == NULL. However, a caller may supply an unrelated repository and branch, which is not supported behavior. To prevent misuse, add a die_on_missing_branch() helper function that dies if a given branch is not from a given repository. Speed up the existence check by replacing the branches list with a branches_hash hashmap. Like read_config(), die_on_missing_branch() is only called from non-static functions; static functions are less prone to misuse because they have strong conventions for keeping remote_state and branch in sync. Signed-off-by: Glen Choo <chooglen@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-delta.c')
0 files changed, 0 insertions, 0 deletions