From: Junio C Hamano Date: Mon, 25 Sep 2017 06:24:10 +0000 (+0900) Subject: Merge branch 'ow/rev-parse-is-shallow-repo' X-Git-Tag: v2.15.0-rc0~53 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3430fff768b526a8e5877cfe56760d4865350b5e?ds=inline;hp=-c Merge branch 'ow/rev-parse-is-shallow-repo' "git rev-parse" learned "--is-shallow-repository", that is to be used in a way similar to existing "--is-bare-repository" and friends. * ow/rev-parse-is-shallow-repo: rev-parse: rev-parse: add --is-shallow-repository --- 3430fff768b526a8e5877cfe56760d4865350b5e diff --combined builtin/rev-parse.c index 9f24004c0a,44e9a48e02..b9c13d3d9d --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@@ -274,7 -274,7 +274,7 @@@ static int try_difference(const char *a return 0; } - if (!get_sha1_committish(this, oid.hash) && !get_sha1_committish(next, end.hash)) { + if (!get_oid_committish(this, &oid) && !get_oid_committish(next, &end)) { show_rev(NORMAL, &end, next); show_rev(symmetric ? NORMAL : REVERSED, &oid, this); if (symmetric) { @@@ -328,7 -328,7 +328,7 @@@ static int try_parent_shorthands(const return 0; *dotdot = 0; - if (get_sha1_committish(arg, oid.hash)) { + if (get_oid_committish(arg, &oid)) { *dotdot = '^'; return 0; } @@@ -702,7 -702,7 +702,7 @@@ int cmd_rev_parse(int argc, const char } if (!strcmp(arg, "--quiet") || !strcmp(arg, "-q")) { quiet = 1; - flags |= GET_SHA1_QUIETLY; + flags |= GET_OID_QUIETLY; continue; } if (opt_with_value(arg, "--short", &arg)) { @@@ -757,8 -757,8 +757,8 @@@ continue; } if (!strcmp(arg, "--bisect")) { - for_each_ref_in("refs/bisect/bad", show_reference, NULL); - for_each_ref_in("refs/bisect/good", anti_reference, NULL); + for_each_fullref_in("refs/bisect/bad", show_reference, NULL, 0); + for_each_fullref_in("refs/bisect/good", anti_reference, NULL, 0); continue; } if (opt_with_value(arg, "--branches", &arg)) { @@@ -868,6 -868,11 +868,11 @@@ : "false"); continue; } + if (!strcmp(arg, "--is-shallow-repository")) { + printf("%s\n", is_repository_shallow() ? "true" + : "false"); + continue; + } if (!strcmp(arg, "--shared-index-path")) { if (read_cache() < 0) die(_("Could not read the index")); @@@ -911,7 -916,7 +916,7 @@@ name++; type = REVERSED; } - if (!get_sha1_with_context(name, flags, oid.hash, &unused)) { + if (!get_oid_with_context(name, flags, &oid, &unused)) { if (verify) revs_count++; else