| 703 | } |
| 704 | |
| 705 | int cmd_rev_parse(int argc, |
| 706 | const char **argv, |
| 707 | const char *prefix, |
| 708 | struct repository *repo UNUSED) |
| 709 | { |
| 710 | int i, as_is = 0, verify = 0, quiet = 0, revs_count = 0, type = 0; |
| 711 | const struct git_hash_algo *output_algo = NULL; |
| 712 | const struct git_hash_algo *compat = NULL; |
| 713 | int did_repo_setup = 0; |
| 714 | int has_dashdash = 0; |
| 715 | int output_prefix = 0; |
| 716 | struct object_id oid; |
| 717 | unsigned int flags = 0; |
| 718 | const char *name = NULL; |
| 719 | struct strbuf buf = STRBUF_INIT; |
| 720 | int seen_end_of_options = 0; |
| 721 | enum format_type format = FORMAT_DEFAULT; |
| 722 | |
| 723 | show_usage_if_asked(argc, argv, builtin_rev_parse_usage); |
| 724 | |
| 725 | if (argc > 1 && !strcmp("--parseopt", argv[1])) |
| 726 | return cmd_parseopt(argc - 1, argv + 1, prefix); |
| 727 | |
| 728 | if (argc > 1 && !strcmp("--sq-quote", argv[1])) |
| 729 | return cmd_sq_quote(argc - 2, argv + 2); |
| 730 | |
| 731 | if (argc > 1 && !strcmp("-h", argv[1])) |
| 732 | usage(builtin_rev_parse_usage); |
| 733 | |
| 734 | for (i = 1; i < argc; i++) { |
| 735 | if (!strcmp(argv[i], "--")) { |
| 736 | has_dashdash = 1; |
| 737 | break; |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | /* No options; just report on whether we're in a git repo or not. */ |
| 742 | if (argc == 1) { |
| 743 | setup_git_directory(the_repository); |
| 744 | repo_config(the_repository, git_default_config, NULL); |
| 745 | return 0; |
| 746 | } |
| 747 | |
| 748 | for (i = 1; i < argc; i++) { |
| 749 | const char *arg = argv[i]; |
| 750 | |
| 751 | if (as_is) { |
| 752 | if (show_file(arg, output_prefix) && as_is < 2) |
| 753 | verify_filename(the_repository, prefix, arg, 0); |
| 754 | continue; |
| 755 | } |
| 756 | |
| 757 | if (!seen_end_of_options) { |
| 758 | if (!strcmp(arg, "--local-env-vars")) { |
| 759 | int i; |
| 760 | for (i = 0; local_repo_env[i]; i++) |
| 761 | printf("%s\n", local_repo_env[i]); |
| 762 | continue; |
nothing calls this directly
no test coverage detected