15
#include "revision.h"
16
#include "list-objects.h"
17
#include "progress.h"
18
+#include "refs.h"
19
20
#ifdef THREADED_DELTA_SEARCH
21
#include "thread-utils.h"
28
[--window=N] [--window-memory=N] [--depth=N] \n\
29
[--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] \n\
30
[--threads=N] [--non-empty] [--revs [--unpacked | --all]*] [--reflog] \n\
30
- [--stdout | base-name] [--keep-unreachable] [<ref-list | <object-list]";
31
+ [--stdout | base-name] [--include-tag] [--keep-unreachable] \n\
32
+ [<ref-list | <object-list]";
33
34
struct object_entry {
35
struct pack_idx_entry idx;
65
static uint32_t nr_objects, nr_alloc, nr_result, nr_written;
66
67
static int non_empty;
66
-static int no_reuse_delta, no_reuse_object, keep_unreachable;
68
+static int no_reuse_delta, no_reuse_object, keep_unreachable, include_tag;
69
static int local;
70
static int incremental;
71
static int allow_ofs_delta;
1632
#define ll_find_deltas(l, s, w, d, p) find_deltas(l, &s, w, d, p)
1633
#endif
1634
1635
+static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, void *cb_data)
1636
+{
1637
+ unsigned char peeled[20];
1638
+
1639
+ if (!prefixcmp(path, "refs/tags/") && /* is a tag? */
1640
+ !peel_ref(path, peeled) && /* peelable? */
1641
+ !is_null_sha1(peeled) && /* annotated tag? */
1642
+ locate_object_entry(peeled)) /* object packed? */
1643
+ add_object_entry(sha1, OBJ_TAG, NULL, 0);
1644
+ return 0;
1645
+}
1646
+
1647
static void prepare_pack(int window, int depth)
1648
{
1649
struct object_entry **delta_list;
2047
keep_unreachable = 1;
2048
continue;
2049
}
2050
+ if (!strcmp("--include-tag", arg)) {
2051
+ include_tag = 1;
2052
+ continue;
2053
+ }
2054
if (!strcmp("--unpacked", arg) ||
2055
!prefixcmp(arg, "--unpacked=") ||
2056
!strcmp("--reflog", arg) ||
2127
rp_av[rp_ac] = NULL;
2128
get_object_list(rp_ac, rp_av);
2129
}
2130
+ if (include_tag && nr_result)
2131
+ for_each_ref(add_ref_tag, NULL);
2132
stop_progress(&progress_state);
2133
2134
if (non_empty && !nr_result)