|
9802c41c
|
2022-06-21T16:52:34
|
|
got patch: use status G for merged files (and document it)
Suggested by stsp@. This makes possible to tell if 'got patch' used a
merge-base from the repository for the 3-way merge or did a simple
search/replace operation.
While here update the tests to look for the 'G' status and the manpage,
which was also missing the documentation for the 'C' status in got
patch.
ok stsp@
|
|
dbc68eed
|
2022-06-21T16:52:34
|
|
got patch: ignore blobs not found
since diffs are often enclosed in other formats (e.g. emails) we might
parse something and think it's a blob id when it's not. This should
already happens, but apply_patch is looking for the wrong error due to a
leftover from previous attempts. Reported by stsp@
while here tweak the test_patch_merge_unknown_blob to also try with a
dummy commit id, as now got-read-patch requires it in order to consider
a blob id.
ok stsp@
|
|
d8b5af43
|
2022-06-19T11:51:33
|
|
use the commitid in the patch diff3 conflict header
suggested by and ok stsp@
|
|
55e9459f
|
2022-06-19T11:51:32
|
|
got patch: use diff3 to merge the changes
Parse the "blob -" metadata in diffs produced by 'got diff' and use the
original file for patching. Then, use the diff3 with the current
version of the file to merge the differences.
This solves many failures automagically or at least turns them into a
conflict.
ok/improvements stsp@
|
|
05737d49
|
2022-06-19T11:51:32
|
|
patch_file: fill tmp with the patched file even in nop mode
future work with diff3 merge will need the fully patched file even in
the nop mode
ok stsp@
|
|
827bcd6c
|
2022-06-19T11:51:32
|
|
patch_file: move file ownership to parent
ok stsp@
|
|
80f51a9e
|
2022-06-18T16:32:12
|
|
fix unexpected imsg error after incomplete enumeration in got-read-pack
reported by jrick and op@
ok op@
|
|
031611fc
|
2022-06-18T16:17:45
|
|
memset all stack-allocated structs used to send messages; ok stsp@
|
|
1a69d37f
|
2022-06-18T16:17:45
|
|
zero the whole struct got_imsg_object before sending it
otherwise some fields may be unitialized and fail the validation done on
the receiving side.
ok stsp@
|
|
20282b02
|
2022-06-16T14:45:29
|
|
fix build with -DGOT_NO_OBJ_CACHE
ok stsp
|
|
1b1b91ab
|
2022-06-15T21:21:27
|
|
style: remove double semicolon
|
|
5a950d09
|
2022-06-15T14:27:20
|
|
using a local packfd variable in open_worktree() is sufficient
|
|
d188eb19
|
2022-06-15T14:26:34
|
|
remove pointless assignment at the end of got_repo_pack_fds_close()
|
|
bb711527
|
2022-06-15T14:25:37
|
|
don't look for close() errors if opentemp() failed in got_repo_pack_fds_open()
|
|
0ae84acc
|
2022-06-15T13:52:20
|
|
move got_opentempfd out of got_repo_open. ok stsp@
thanks for all the help massaging this diff
|
|
06c44edc
|
2022-06-15T13:10:50
|
|
check for errors from fclose() in patch_file()
|
|
11ce22a1
|
2022-06-15T12:50:10
|
|
plug memory and fd leak in got patch
|
|
afd31498
|
2022-06-14T22:35:34
|
|
fix a harmless off-by-one from previous commit
|
|
a5e587e0
|
2022-06-14T22:32:11
|
|
fix a bug in got_privsep_send_object_idlist() exposed by recent changes
The old code did not work correctly if only a single object Id was to
be sent to got-read-pack. Make got-read-pack error out if the list
of commits for object enumeration is empty to catch this problem if
it occurs again.
Found by the send_basic test, which was failing with GOT_TEST_PACK=1
ok tracey
|
|
db9b9b1c
|
2022-06-14T20:26:15
|
|
let got-read-pack be explicit about whether it could enumerate all objects
This allows the main process to avoid looping over all object IDs again
in case the pack file used for enumeration is complete.
ok op@
|
|
b4b1b9c0
|
2022-06-14T13:16:15
|
|
remove trailing whitespaces
|
|
0fca100c
|
2022-06-14T13:16:15
|
|
compute object size, not pointer size
in this case they're luckily the same; got_imsg_object_idlist and
got_imsg_reused_delta only have one size_t long field.
ok stsp@
|
|
c98b0f0b
|
2022-06-14T13:16:15
|
|
strictier validation for data received from libexec helpers
use correct error code and ok stsp@
|
|
3e6054c4
|
2022-06-14T13:16:14
|
|
drop unused variable
|
|
bf31a716
|
2022-06-14T13:16:14
|
|
use strndup instead of malloc+memcpy
Simplifies the reading of the author/committer string and makes also the
code shorter.
ok stsp@
|
|
71fee5a3
|
2022-06-14T13:16:14
|
|
don't check datalen when calling recv_imsg_error
recv_imsg_error already checks the size of the message, and it does so
more precisely than the removed code.
ok stsp@
|
|
35095610
|
2022-06-14T10:35:07
|
|
got patch: use ints for line offsets instead of longs
ints have the advantage that their size is more likely to be the same
across the various architecture supported by OpenBSD, thus introducing
less possible differences.
INT_MAX is still (at least) a few order of magnitudes higher than the
patches we dealt with (even abnormal ones.)
suggested by stsp@
|
|
5b7126c5
|
2022-06-14T08:31:16
|
|
actually guarding against negative line offsets
previous commit looked at some pretty zeroes returned from calloc
instead of the actual numbers received.
|
|
2399b53d
|
2022-06-14T08:26:27
|
|
style; set datalen only once
|
|
71393b5c
|
2022-06-14T08:10:55
|
|
got patch: guard against invalid (negative) line offsets
under normal circumstances got-read-patch can't send negative line
offsets; that's not an excuse not to guard the main process from those
as well.
This makes sure we bail out early instead of trying to apply the diff.
|
|
0e07a2a1
|
2022-06-13T20:57:43
|
|
free patch on error
|
|
99b94ad7
|
2022-06-13T20:30:09
|
|
got patch: ensure new and old paths are NUL-terminated
|
|
eb7b30a1
|
2022-06-13T17:13:59
|
|
fix error handling in find_pack_for_enumeration(); pointed out by op@
|
|
0ab4c957
|
2022-06-13T17:13:59
|
|
Bring back object enumeration inside got-read-pack as a fast path.
The problem that was found in the earlier version has been fixed.
ok op@
|
|
a558dd1b
|
2022-06-08T10:56:53
|
|
reuse a temporary file across commits during got log -p -S
suggested by + ok op@
|
|
e44d9391
|
2022-06-07T19:20:01
|
|
revert object enumeration in got-read-pack for now; needs more work
This implementation marked commits and trees as enumerated before all trees
which they depend on were enumerated. This behaviour leads to incomplete
pack files when a tree is only partially packed and got-read-pack hits
a missing tree entry as a result. The algorithm must be reworked such
that packed leave nodes are marked enumerated first, then bubble-up.
Found by op@
|
|
9f4f302a
|
2022-06-07T16:04:15
|
|
free id and path in load_packed_tree_ids() on error, else they would leak
pointed out by op@
|
|
f0972833
|
2022-06-07T16:00:56
|
|
fix wrong line wrap; pointed out by op@
|
|
876f8c1a
|
2022-06-07T15:59:48
|
|
imsg_add() already frees wbuf on error; pointed out by op@
|
|
cee6a7ea
|
2022-06-07T15:56:46
|
|
implement object enumeration support in got-read-pack
ok op@
|
|
9fdde394
|
2022-06-04T14:13:46
|
|
got stage: implicitly unstage when staging the reverse of the staged diff
otherwise we end up with a staged empty edit for that file.
ok stsp@
|
|
4264b841
|
2022-06-04T14:02:21
|
|
check the maximum cached delta size against the correct constant
|
|
dac5c75e
|
2022-06-04T13:58:48
|
|
convert delta cache to a hash table
This approach uses more memory but is much faster. To offset the
additional memory usage somewhat the cache now stores very small
deltas only. However, overall memory usage goes up. Hopefully we
will find a way to reduce this later.
ok op@
|
|
6a881297
|
2022-06-02T12:32:00
|
|
properly swap cached struct pack array elements in got_repo_cache_pack()
Avoids clobbering open files for delta base/accumulation, leaking file
descriptors, and triggering errors from close(2) during got_repo_close()
as we try to close the same file descriptor more than once.
|
|
b72706c3
|
2022-06-01T05:08:20
|
|
move creation of tempfiles outside of lib/diff.c
ok tracey
|
|
cfcf1cbc
|
2022-05-31T18:49:16
|
|
reduce GOT_PACK_CACHE_SIZE to 32, otherwise it uses too many open files
found by tracey
|
|
13242195
|
2022-05-31T18:34:45
|
|
ensure that all open basefd/accumfd get closed in got_repo_close()
found by tracey
|
|
57160834
|
2022-05-31T11:00:09
|
|
open temporary files needed for delta application in got_repo_open()
This prepares for callers of got_repo_open() that cannot afford to
open files in /tmp, such as gotwebd. In a follow-up change, we could
ask such callers to pass in the required amount of open temporary files.
One consequence is that got_repo_open() now requires the "cpath" pledge
promise. Add the "cpath" promise to affected callers and remove it once
the repository has been opened.
ok tracey
|
|
f18c433a
|
2022-05-31T08:44:55
|
|
avoid get_delta_chain_max_size() in dump_delta_chain_to_mem()
|
|
6395114c
|
2022-05-31T08:44:55
|
|
avoid get_delta_chain_max_size() in dump_delta_chain_to_file()
|
|
ce2bf7b7
|
2022-05-29T17:51:33
|
|
fix a bug in findwixt() which caused pack files with missing parent commits
The 'nskip' variable is supposed to reflect commits which are waiting on
the queue and have the 'skip' color. Only increment 'nskip' when adding
such commits to the queue.
Problem observed with got send -T and a tag pointing to a deleted branch.
Test to reproduce the bug written by op@.
|
|
d6a28ffe
|
2022-05-20T21:21:42
|
|
use random seeds for murmurhash2
change the three hardcoded seeds to fresh ones generated on demand via
arc4random. Suggested/fixed by and ok stsp@
|
|
17cfdba6
|
2022-05-20T21:19:30
|
|
include header
|
|
411cbec1
|
2022-05-20T09:31:25
|
|
shrink struct got_pack_meta a bit by removing the have_reused_delta flag
This flag can be expressed as m->reused_delta_offset != 0 because all
deltas in valid pack files will be written at a non-zero offset.
We allocate a huge number of these structs during packing, so every
little bit helps.
|
|
adb4bbb2
|
2022-05-20T08:40:46
|
|
reduce the amount of memory used for caching deltas during deltification
With files sorted properly for deltification we produce better deltas
but end up consuming more memory and risk running into OpenBSD ulimits
during packing. To compensate, reduce the threshold for the amount of
delta data we store in memory, spooling more deltas into the cache file.
ok op@
|
|
f8174ca5
|
2022-05-20T08:40:46
|
|
store a path hash instead of a verbatim path in pack meta data
This reduces memory use by gotadmin pack. The goal is to sort files
which share a path next to each other for deltification. A hash of
the path is good enough for this purpose and consumes less memory
than a verbatim copy of the path. Git does something similar.
ok op@
|
|
3e6ceea0
|
2022-05-20T08:40:46
|
|
fix paths stored in pack meta data, improving file deltification
The old code was broken and stored an empty path or filenames, instead
of a repository-relative path. Which means we didn't sort files for
deltification as was intended.
Fixing this provides much better deltas in large pack files written by
gotadmin pack -a. In my test case, pack size changed from 2GB to 1.5GB.
ok op@
|
|
17259bfa
|
2022-05-19T09:26:13
|
|
plug a small memleak on error in got_pack_create()
|
|
e1f5d7cf
|
2022-05-19T07:36:33
|
|
avoid malloc/free for duplicate check in got_pathlists_insert()
ok op@
|
|
c9b75c7b
|
2022-05-19T07:31:57
|
|
revert "Skip poll(2) if an imsgbuf has a non-empty read buffer"
imsg_read() will call recvmsg() on the file descriptor regardless
of the read buffer's state, so we should ensure that data is ready.
The read buffer is used by imsg_get(), not imsg_read().
We already call imsg_get() before imsg_read(), and call the latter
only if imsg_get() returns zero.
|
|
2ab71455
|
2022-05-19T07:18:46
|
|
Skip poll(2) if an imsgbuf has a non-empty read buffer.
|
|
1453347d
|
2022-05-19T07:14:21
|
|
imsg_add() frees its msg argument on error; avoid double-free in error paths
|
|
33fd69c2
|
2022-05-19T06:50:59
|
|
batch up tree entries in imsg instead of sending one imsg per tree entry
This speeds up loading of trees significantly.
ok op@
|
|
9985f404
|
2022-05-19T06:40:09
|
|
parse tree entries into an array instead of a pathlist
Avoids some extra malloc/free in a performance-critical path.
ok op@
|
|
3483a4da
|
2022-05-18T07:45:08
|
|
prevent an out-of-bounds access in got_privsep_recv_tree()
|
|
baef4d75
|
2022-05-18T07:44:49
|
|
plug memory leak in an error path of got_privsep_recv_tree()
|
|
13fcf1bf
|
2022-05-18T07:44:30
|
|
make got_privsep_recv_tree() reject trees with less than zero entries
|
|
7429ae85
|
2022-05-18T07:43:45
|
|
rework logic in got_privsep_recv_tree() to avoid an ugly 'goto'
no functional change
|
|
4bcdc895
|
2022-05-17T17:35:17
|
|
refactor got_patch / got_worktree_patch_complete
let got_patch own fileindex_path and call got_worktree_patch_complete
only if got_wokrtree_patch_prepare hasn't failed.
suggested by stsp@
|
|
f2dd7807
|
2022-05-17T13:28:02
|
|
got patch: avoid open/sync/close the fileindex over and over again
Instead of flushing the fileindex after every patch in the patchfile
just reuse the same fileindex and sync it only at the end of the patch
operation. This speeds up 'got patch' on large repositories by quite a
lot.
|
|
e45f7eba
|
2022-05-14T18:55:37
|
|
got patch: switch from fseek() to fseeko(), use unary minus while here
ok op
|
|
be33dff7
|
2022-05-13T15:28:04
|
|
got patch: fail when reading empty hunks
|
|
e93fb944
|
2022-05-10T11:34:16
|
|
map delta cache file into memory if possible while writing a pack file
with a fix from + ok op@
|
|
dc3fe1bf
|
2022-05-10T11:24:12
|
|
fix load_object_ids() such that packing tags works if zero commits are packed
reported by jrick and op
|
|
fae7e038
|
2022-05-07T11:50:56
|
|
run the search for deltas to reuse in got-read-pack
This significantly speeds up the deltification step of packing by
avoiding imsg traffic. gotadmin no longer requests individual raw
deltas from got-read-pack to check whether it can reuse them.
Instead, got-read-pack obtains a list of objects we want to pack,
and hands back the list of all deltas in its pack file which can be
reused. Messages are now batched such that imsg buffers are filled
as much as possible.
Another advantage is that deltas we are not going to reuse will
no longer be written to the delta cache file, saving disk space.
Before this patch, any raw delta candidate was written to the
delta cache file by got-read-pack, and the decision whether to
reuse the delta happened afterwards in the gotadmin process.
Code for reading individual raw deltas is now unused and could be
removed at some point.
ok op@
|
|
2f8438b0
|
2022-05-04T15:39:15
|
|
avoid 'remove unused' loop by storing excluded objects in a separate set
ok op@
|
|
f5e78e05
|
2022-05-04T15:39:15
|
|
avoid loop over the ID set which removes objects IDs with reused deltas
ok op@
|
|
2d9e6abf
|
2022-05-04T13:43:24
|
|
store deltas in compressed form while packing, both in memory and cache file
This reduces memory and disk space consumption during packing.
with tweaks + memleak on error fix from op@
ok op@
|
|
611e8e31
|
2022-05-01T11:47:21
|
|
avoid subtraction of values larger than int in qsort(3) comparison callbacks
tweak + ok tb@
|
|
bad961bf
|
2022-04-23T10:39:47
|
|
got patch: allow to reverse a patch
add a flag to got_patch to reverse a patch before applying and the -R
flag for `got patch'.
ok stsp@
|
|
b2832778
|
2022-04-23T10:39:47
|
|
got-read-patch: preserve all \ lines
as a cheap optimization got-read-patch was sending only the "\ No
newline at end of file" lines that follows an addition (a "+" line). To
be able to reverse patches in the future got_patch needs to know about
all of these lines instead. No functional changes intended.
ok stsp@
|
|
ed3bff83
|
2022-04-23T07:56:18
|
|
got patch: resolve paths from the current working directory
this allow to apply patches from subdirectories of the work tree root.
Prodded by naddy@, ok stsp@.
|
|
a05fb460
|
2022-04-23T07:54:56
|
|
don't pass relative paths to get_file_status
|
|
41a37a44
|
2022-04-23T07:49:42
|
|
fix wrong path in error message
|
|
d7b5a0e8
|
2022-04-20T14:00:12
|
|
inline struct got_object_id in struct got_object_qid
Saves us from doing a malloc/free call for every item on the list.
ok op@
|
|
cbc287dc
|
2022-04-19T20:08:41
|
|
reimplement object-ID set data structure on top of a hash table
Siphash suggested by jrick as a better alternative to murmurhash
for this use case.
with small fixes from and ok op@
|
|
70f8f24d
|
2022-04-14T15:05:19
|
|
speed up initial stage of packing by adding a "skip" commit color
The skip color marks boundary commits and their ancestors. Boundary commits
are reachable both via references which we want to exclude from the pack,
and via references which we want to include in the pack.
We continue processing commit history up to the point we are left with only
skip commits on the queue. This can speed up findtwixt() significantly and
avoids wrong results produced by the old algorithm which made no distinction
between "drop" and "skip".
This idea was first implemented by Michael Forney for git9:
https://git.9front.org/plan9front/plan9front/2e47badb88312c5c045a8042dc2ef80148e5ab47/commit.html
Michael's log message for git9 is reproduced below:
git/query: refactor graph painting algorithm (findtwixt, lca)
We now keep track of 3 sets during traversal:
- keep: commits we've reached from head commits
- drop: commits we've reached from tail commits
- skip: ancestors of commits in both 'keep' and 'drop'
Commits in 'keep' and/or 'drop' may be added later to the 'skip' set
if we discover later that they are part of a common subgraph of the
head and tail commits.
From these sets we can calculate the commits we are interested in:
lca commits are those in 'keep' and 'drop', but not in 'skip'.
findtwixt commits are those in 'keep', but not in 'drop' or 'skip'.
The "LCA" commit returned is a common ancestor such that there are no
other common ancestors that can reach that commit. Although there can
be multiple commits that meet this criteria, where one is technically
lower on the commit-graph than the other, these cases only happen in
complex merge arrangements and any choice is likely a decent merge
base.
Repainting is now done in paint() directly. When we find a boundary
commit, we switch our paint color to 'skip'. 'skip' painting does
not stop when it hits another color; we continue until we are left
with only 'skip' commits on the queue.
This fixes several mishandled cases in the current algorithm:
1. If we hit the common subgraph from tail commits first (if the tail
commit was newer than the head commit), we ended up traversing the
entire commit graph. This is because we couldn't distinguish
between 'drop' commits that were part of the common subgraph, and
those that were still looking for it.
2. If we traversed through an initial part of the common subgraph from
head commits before reaching it from tail commits, these commits
were returned from findtwixt even though they were also reachable
from tail commits.
3. In the same case as 2, we might end up choosing an incorrect
commit as the LCA, which is an ancestor of the real LCA.
|
|
a7472cb3
|
2022-04-14T15:00:59
|
|
check return value of RB_INSERT; ok + memleak fix by op@
|
|
bb6672b6
|
2022-04-14T11:51:32
|
|
make sure callers of got_object_idset_add() free data.
|
|
7e4f461f
|
2022-04-13T14:01:18
|
|
sort references by date for packing; newer commits should be processed first
|
|
fbafdecf
|
2022-04-10T13:03:29
|
|
revert 03c03172 "drop a commit right away if it matches an excluded commit"
This change resulted in a full history walk even when no objects will
be added to the pack file. Fix this regression by reverting the change.
|
|
14dbbf48
|
2022-04-10T12:15:46
|
|
for clarity, move the coloring loop from findtwixt() into a separate function
|
|
1d765da3
|
2022-04-10T12:13:02
|
|
remove a pointless object-id dup/free dance in findtwixt()
|
|
57bc7b6d
|
2022-04-10T12:10:52
|
|
don't forget to call the cancel callback while coloring commits in findtwixt()
|
|
03c03172
|
2022-04-10T12:08:45
|
|
in findtwixt(), drop a commit right away if it matches an excluded commit
|
|
912a163e
|
2022-04-10T11:35:53
|
|
the obj_types array in pack_create.c is no longer useful, remove it
|
|
29e0594f
|
2022-04-09T17:34:51
|
|
make gotadmin pack -x option work with tag arguments
|
|
9d34261e
|
2022-04-07T20:55:39
|
|
in load_object_ids(), process "their" commits and tags in the same loop
No functional change, the end result is the same.
|
|
392891ce
|
2022-04-07T13:20:47
|
|
pass an already open commit object to the blame callback
ok op@
|
|
a44927cc
|
2022-04-07T12:57:31
|
|
stop relying on commit cache for good performance of got_object_id_by_path()
Instead of internally opening and closing the same commit object over and
over again, require callers to pass an open commit object in. Avoids an
inherent dependency on the commit object cache for reasonable performance.
ok op@
|