|
1 | 1 | #include "builtin.h" |
2 | 2 | #include "config.h" |
| 3 | +#include "checkout.h" |
3 | 4 | #include "lockfile.h" |
4 | 5 | #include "parse-options.h" |
5 | 6 | #include "refs.h" |
@@ -872,46 +873,6 @@ static int git_checkout_config(const char *var, const char *value, void *cb) |
872 | 873 | return git_xmerge_config(var, value, NULL); |
873 | 874 | } |
874 | 875 |
|
875 | | -struct tracking_name_data { |
876 | | - /* const */ char *src_ref; |
877 | | - char *dst_ref; |
878 | | - struct object_id *dst_oid; |
879 | | - int unique; |
880 | | -}; |
881 | | - |
882 | | -static int check_tracking_name(struct remote *remote, void *cb_data) |
883 | | -{ |
884 | | - struct tracking_name_data *cb = cb_data; |
885 | | - struct refspec query; |
886 | | - memset(&query, 0, sizeof(struct refspec)); |
887 | | - query.src = cb->src_ref; |
888 | | - if (remote_find_tracking(remote, &query) || |
889 | | - get_oid(query.dst, cb->dst_oid)) { |
890 | | - free(query.dst); |
891 | | - return 0; |
892 | | - } |
893 | | - if (cb->dst_ref) { |
894 | | - free(query.dst); |
895 | | - cb->unique = 0; |
896 | | - return 0; |
897 | | - } |
898 | | - cb->dst_ref = query.dst; |
899 | | - return 0; |
900 | | -} |
901 | | - |
902 | | -static const char *unique_tracking_name(const char *name, struct object_id *oid) |
903 | | -{ |
904 | | - struct tracking_name_data cb_data = { NULL, NULL, NULL, 1 }; |
905 | | - cb_data.src_ref = xstrfmt("refs/heads/%s", name); |
906 | | - cb_data.dst_oid = oid; |
907 | | - for_each_remote(check_tracking_name, &cb_data); |
908 | | - free(cb_data.src_ref); |
909 | | - if (cb_data.unique) |
910 | | - return cb_data.dst_ref; |
911 | | - free(cb_data.dst_ref); |
912 | | - return NULL; |
913 | | -} |
914 | | - |
915 | 876 | static int parse_branchname_arg(int argc, const char **argv, |
916 | 877 | int dwim_new_local_branch_ok, |
917 | 878 | struct branch_info *new, |
|
0 commit comments