summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index c18b7ea5d3..84f1863d3a 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1,7 +1,7 @@
+#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
-#include "parse-options.h"
-#include "repository.h"
+#include "hash.h"
#include "apply.h"
static const char * const apply_usage[] = {
@@ -9,7 +9,10 @@ static const char * const apply_usage[] = {
NULL
};
-int cmd_apply(int argc, const char **argv, const char *prefix)
+int cmd_apply(int argc,
+ const char **argv,
+ const char *prefix,
+ struct repository *repo UNUSED)
{
int force_apply = 0;
int options = 0;
@@ -19,6 +22,15 @@ int cmd_apply(int argc, const char **argv, const char *prefix)
if (init_apply_state(&state, the_repository, prefix))
exit(128);
+ /*
+ * We could to redo the "apply.c" machinery to make this
+ * arbitrary fallback unnecessary, but it is dubious that it
+ * is worth the effort.
+ * cf. https://lore.kernel.org/git/xmqqcypfcmn4.fsf@gitster.g/
+ */
+ if (!the_hash_algo)
+ repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
+
argc = apply_parse_options(argc, argv,
&state, &force_apply, &options,
apply_usage);