File tree 2 files changed +42
-0
lines changed 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,25 @@ GIT_BEGIN_DECL
44
44
*/
45
45
GIT_EXTERN (int ) git_mempack_new (git_odb_backend * * out );
46
46
47
+ /**
48
+ * Write a thin packfile with the objects in the memory store.
49
+ *
50
+ * A thin packfile is a packfile that does not contain its transitive closure of
51
+ * references. This is useful for efficiently distributing additions to a
52
+ * repository over the network, but also finds use in the efficient bulk
53
+ * addition of objects to a repository, locally.
54
+ *
55
+ * This operation performs the (shallow) insert operations int
8000
o the
56
+ * `git_packbuilder`, but does not write the packfile to disk;
57
+ * see `git_packbuilder_write_buf`.
58
+ *
59
+ * It also does not reset the in-memory object database; see `git_mempack_reset`.
60
+ *
61
+ * @param backend The mempack backend
62
+ * @param pb The packbuilder to use to write the packfile
63
+ */
64
+ GIT_EXTERN (int ) git_mempack_write_thin_pack (git_odb_backend * backend , git_packbuilder * pb );
65
+
47
66
/**
48
67
* Dump all the queued in-memory writes to a packfile.
49
68
*
Original file line number Diff line number Diff line change @@ -132,6 +132,29 @@ static int git_mempack__dump(
132
132
return err ;
133
133
}
134
134
135
+ int git_mempack_write_thin_pack (git_odb_backend * backend , git_packbuilder * pb )
8000
div>
136
+ {
137
+ struct memory_packer_db * db = (struct memory_packer_db * )backend ;
138
+ const git_oid * oid ;
139
+ size_t iter = 0 ;
140
+ int err ;
141
+
142
+ while (true) {
143
+ err = git_oidmap_iterate (NULL , db -> objects , & iter , & oid );
144
+
145
+ if (err == GIT_ITEROVER )
146
+ break ;
147
+ else if (err != 0 )
148
+ return err ;
149
+
150
+ err = git_packbuilder_insert (pb , oid , NULL );
151
+ if (err != 0 )
152
+ return err ;
153
+ }
154
+
155
+ return 0 ;
156
+ }
157
+
135
158
int git_mempack_dump (
136
159
git_buf * pack ,
137
160
git_repository * repo ,
You can’t perform that action at this time.
0 commit comments