summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/repack.c6
-rw-r--r--repack.c5
-rw-r--r--repack.h1
3 files changed, 8 insertions, 4 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index b21799c650..d1449cfe13 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -147,8 +147,7 @@ static int write_filtered_pack(const struct write_pack_opts *opts,
FILE *in;
int ret;
const char *caret;
- const char *scratch;
- int local = skip_prefix(opts->destination, opts->packdir, &scratch);
+ bool local = write_pack_opts_is_local(opts);
const char *pack_prefix = write_pack_opts_pack_prefix(opts);
prepare_pack_objects(&cmd, opts->po_args, opts->destination);
@@ -232,8 +231,7 @@ static int write_cruft_pack(const struct write_pack_opts *opts,
struct string_list_item *item;
FILE *in;
int ret;
- const char *scratch;
- int local = skip_prefix(opts->destination, opts->packdir, &scratch);
+ bool local = write_pack_opts_is_local(opts);
const char *pack_prefix = write_pack_opts_pack_prefix(opts);
prepare_pack_objects(&cmd, opts->po_args, opts->destination);
diff --git a/repack.c b/repack.c
index 19fd1d6d5b..d2ee9f2460 100644
--- a/repack.c
+++ b/repack.c
@@ -77,6 +77,11 @@ const char *write_pack_opts_pack_prefix(const struct write_pack_opts *opts)
return pack_prefix;
}
+bool write_pack_opts_is_local(const struct write_pack_opts *opts)
+{
+ return starts_with(opts->destination, opts->packdir);
+}
+
#define DELETE_PACK 1
#define RETAIN_PACK 2
diff --git a/repack.h b/repack.h
index 5852e2407f..26d1954ae2 100644
--- a/repack.h
+++ b/repack.h
@@ -40,6 +40,7 @@ struct write_pack_opts {
};
const char *write_pack_opts_pack_prefix(const struct write_pack_opts *opts);
+bool write_pack_opts_is_local(const struct write_pack_opts *opts);
struct repository;
struct packed_git;