rev-parse: rev-parse: add --is-shallow-repository
Running `git fetch --unshallow` on a repo that is not in fact shallow produces a fatal error message. Add a helper to rev-parse that scripters can use to determine whether a repo is shallow or not. Signed-off-by: Øystein Walle <oystwa@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
94c9fd268d
commit
417abfde35
@ -868,6 +868,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
|
||||
: "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"));
|
||||
|
Reference in New Issue
Block a user