diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2018-06-05 14:40:46 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-06-11 09:41:01 -0700 |
| commit | 3c87aa946a9ffc31cf1355b11e63df7c3315a2f9 (patch) | |
| tree | 30880fd6d627b4e9dc6a7640146e5a9620bf8b01 /builtin/checkout.c | |
| parent | checkout.c: change "unique" member to "num_matches" (diff) | |
| download | git-3c87aa946a9ffc31cf1355b11e63df7c3315a2f9.tar.gz git-3c87aa946a9ffc31cf1355b11e63df7c3315a2f9.zip | |
checkout: pass the "num_matches" up to callers
Pass the previously added "num_matches" struct value up to the callers
of unique_tracking_name(). This will allow callers to optionally print
better error messages in a later change.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
| -rw-r--r-- | builtin/checkout.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 2e1d2376d2..72457fb7d5 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -878,7 +878,8 @@ static int parse_branchname_arg(int argc, const char **argv, int dwim_new_local_branch_ok, struct branch_info *new_branch_info, struct checkout_opts *opts, - struct object_id *rev) + struct object_id *rev, + int *dwim_remotes_matched) { struct tree **source_tree = &opts->source_tree; const char **new_branch = &opts->new_branch; @@ -972,7 +973,8 @@ static int parse_branchname_arg(int argc, const char **argv, recover_with_dwim = 0; if (recover_with_dwim) { - const char *remote = unique_tracking_name(arg, rev); + const char *remote = unique_tracking_name(arg, rev, + dwim_remotes_matched); if (remote) { *new_branch = arg; arg = remote; @@ -1109,6 +1111,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) struct branch_info new_branch_info; char *conflict_style = NULL; int dwim_new_local_branch = 1; + int dwim_remotes_matched = 0; struct option options[] = { OPT__QUIET(&opts.quiet, N_("suppress progress reporting")), OPT_STRING('b', NULL, &opts.new_branch, N_("branch"), @@ -1219,7 +1222,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) opts.track == BRANCH_TRACK_UNSPECIFIED && !opts.new_branch; int n = parse_branchname_arg(argc, argv, dwim_ok, - &new_branch_info, &opts, &rev); + &new_branch_info, &opts, &rev, + &dwim_remotes_matched); argv += n; argc -= n; } |
