lib


Log

Author Commit Date CI Message
Stefan Sperling 611e8e31 2022-05-01T11:47:21 avoid subtraction of values larger than int in qsort(3) comparison callbacks tweak + ok tb@
Omar Polo 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@
Omar Polo 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@
Omar Polo 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@.
Omar Polo a05fb460 2022-04-23T07:54:56 don't pass relative paths to get_file_status
Omar Polo 41a37a44 2022-04-23T07:49:42 fix wrong path in error message
Stefan Sperling 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@
Stefan Sperling 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@
Stefan Sperling 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.
Stefan Sperling a7472cb3 2022-04-14T15:00:59 check return value of RB_INSERT; ok + memleak fix by op@
Theo Buehler bb6672b6 2022-04-14T11:51:32 make sure callers of got_object_idset_add() free data.
Stefan Sperling 7e4f461f 2022-04-13T14:01:18 sort references by date for packing; newer commits should be processed first
Stefan Sperling 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.
Stefan Sperling 14dbbf48 2022-04-10T12:15:46 for clarity, move the coloring loop from findtwixt() into a separate function
Stefan Sperling 1d765da3 2022-04-10T12:13:02 remove a pointless object-id dup/free dance in findtwixt()
Stefan Sperling 57bc7b6d 2022-04-10T12:10:52 don't forget to call the cancel callback while coloring commits in findtwixt()
Stefan Sperling 03c03172 2022-04-10T12:08:45 in findtwixt(), drop a commit right away if it matches an excluded commit
Stefan Sperling 912a163e 2022-04-10T11:35:53 the obj_types array in pack_create.c is no longer useful, remove it
Stefan Sperling 29e0594f 2022-04-09T17:34:51 make gotadmin pack -x option work with tag arguments
Stefan Sperling 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.
Stefan Sperling 392891ce 2022-04-07T13:20:47 pass an already open commit object to the blame callback ok op@
Stefan Sperling 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@
Stefan Sperling c655fd93 2022-04-07T12:04:42 rename variables in got_path_strip() for clarity; ok op@
Omar Polo 9d6cabd5 2022-04-07T09:28:59 got patch: allow to strip path components Move some bits from the libexec helper to the main process so we know if the patch was generated by git or not and finally document the automatic stripping of a/ and b/ prefixes added by git-diff(1). ok stsp@
Omar Polo fbbb53b9 2022-03-25T23:08:27 remove trailing whitespaces
Stefan Sperling bc5e881a 2022-03-23T20:55:26 plug a memory leak in got_fetch_pack(); patch by Mikhail
Omar Polo b3c57ab2 2022-03-22T11:20:46 got patch: handle "\ No newline at end of file"
Omar Polo 4027dbc2 2022-03-22T11:20:46 reuse apply_hunk in patch_file when creating a file
Stefan Sperling 6863cbf9 2022-03-21T19:59:03 fix pack progress object counter for loose objects Move pack progres object accounting to a single place. This makes it easier to account for the case were only loose objects are packed. A wrong amount of objects was reported before when packing loose ones.
Stefan Sperling c4e796b2 2022-03-21T16:08:41 in pack progress output, remove excluded objects from 'found' objects counter
Stefan Sperling cdeb891a 2022-03-21T15:52:15 fix a bug where 'gotadmin pack' packed too many objects unless -a was used
Stefan Sperling 0ae61b79 2022-03-21T10:17:40 fix potential NULL deref in error path of got_object_idset_remove()
Christian Weisgerber f134ecfd 2022-03-19T21:25:59 const-ify string table
Omar Polo 78f5ac24 2022-03-19T15:06:37 move got_patch file status checking in worktree.c check_file_status used got_worktree_status to check if the file was in an allowed state, but it's wrong since the callback is not invoked on unchanged files. While here also fix a relate bug: unlink(newpath) is in the wrong spot and ends up removing files even when it shouldn't, so move it early in the got_worktree_schedule_* error handling. Finally, update the appropriate test case. It was passing before because got_worktree_schedule_add returned GOT_ERR_FILE_STATUS, not because check_file_status failed. ok stsp@
Christian Weisgerber bfc73a47 2022-03-19T14:53:07 explicitly include <unistd.h> for close(2)
Christian Weisgerber 70cc9832 2022-03-19T14:19:19 move got_errors[] table into a single compilation unit (error.c) ok stsp
Christian Weisgerber d58ddaf3 2022-03-17T20:02:40 const-ify tables ok thomas_adam millert
Omar Polo 46ebad13 2022-03-17T16:38:43 style
Omar Polo 60aa1fa0 2022-03-17T16:38:43 augment patch progress callback with hunks info; recover from errors Augment got_patch_progress_cb by providing the hunks that were applied with offset (or that failed) and the recoverable error encountered during the operation (bad status, missing file, ...) got_patch now proceeds when a file fails to be patched and exits with GOT_ERR_PATCH_FAILED if no other errors are encountered. While here, also add a test for the 'hunk applied with offset' case and shrink test_patch_dont_apply and illegal_status by taking advantage that 'got patch' doesn't stop at the first error. (And add some other cases to illegal_status too.) discussed with and ok stsp@
Omar Polo 95d68340 2022-03-16T18:23:03 got patch: create missing directories when adding files ok stsp@
Omar Polo 2be5e1a2 2022-03-16T18:23:03 got patch: keep permissions after patching a file ok stsp@
Omar Polo b22138f5 2022-03-16T15:41:10 introduce got_patch_progress_cb This introduce a proper got_patch specific progress callback that is invoked after processing a patch. It also drops the hackish printf in the modified case and takes `nop' out of the struct got_patch. ok stsp
Stefan Sperling b8af7c06 2022-03-15T10:45:02 print additional progress information while packing ok op@
Omar Polo c560c1f5 2022-03-14T13:50:31 don't `goto done' if calloc fails otherwise we call got_repo_close with repo being NULL and segfault there. ok stsp
Stefan Sperling 9b576444 2022-03-14T13:22:20 cache a list of known pack index files when the repository is opened Avoids overhead due to readdir calls while searching a pack index. ok op@
Omar Polo 899fcfdf 2022-03-13T20:31:44 add a dry-run/nop mode for got patch with lots of help from stsp for the manpage bits!
Omar Polo 5b67f96e 2022-03-13T15:36:59 got patch: require exact match when removing files
Omar Polo dbda770b 2022-03-13T15:36:56 check file status before applying the patch Don't allow `got patch' to delete files that are not known, or add files that are already known and to edit files that are known, not obstructed and without conflicts.
Stefan Sperling a84c0d30 2022-03-12T21:30:23 fix 'got status' with an obstructed file given as argument; found by Omar
Omar Polo 6e96b326 2022-03-12T16:02:51 refactor apply_patch to support renaming files add two helper functions (schedule_add, schedule_del) and move the guts of apply_patch into a new function `patch_file'. This simplifies apply_patch and makes easier to figure out what happens. Then, drop GOT_ERR_PATCH_PATHS_DIFFER since we allow the to rename files.
Omar Polo b95c53df 2022-03-12T16:01:09 apply_patch: move sanity check early in recv_patch
Omar Polo 33df9995 2022-03-11T17:25:33 save `pos' in locate_hunk instead of calling ftello again ok thomas, stsp
Stefan Sperling 0e6ab4b2 2022-03-10T09:23:19 make got_repo_match_object_id_prefix() reject overlong input strings suggested by + ok naddy
Stefan Sperling 0ed2285b 2022-03-09T08:55:42 handle reference arguments which look like short object IDs Match command line arguments against references before matching object IDs. This makes it possible to use reference names that happen to match a short object ID. For example, a branch called "11ac" could not be diffed in OpenBSD src.git which happens to contain commit IDs that begin with hex digits 0x11ac. A bogus error would be reported in this situation: $ got diff master 11ac got: ambiguous object ID ok naddy
Omar Polo d955343d 2022-03-08T16:01:03 pass the callback data instead of hardcoding NULL, ok stsp
Stefan Sperling 36751b1b 2022-03-08T15:11:37 remove needless header inclusion; lib/pack.c does not need got_opentemp.h
Omar Polo 6f5cb1bd 2022-03-08T12:22:36 fix path to the temp file used to accumulate the patch edits ok stsp
Omar Polo e9ce266e 2022-03-07T22:26:08 add `got patch' command for applying unified diffs
Christian Weisgerber 805253d5 2022-03-07T20:19:35 fix level of indirection ok stsp
Stefan Sperling 3a12860c 2022-03-07T19:25:46 make the URI parser tolerate trailing slashes at the end of the input URI ok naddy
Christian Weisgerber e3f86256 2022-02-18T20:23:32 explicitly include <endian.h> for be32toh()
Omar Polo 8934ea8b 2022-02-14T13:14:36 factorize imsg_clear calls after imsg_flush failures imsg_clear frees and closes resources allocated as part of enqueueing imsgs so it's a no-op after reads. discussed with and ok stsp@
Omar Polo 688fe08b 2022-02-14T13:14:36 fix fd leak in got_fetch_pack, ok stsp@
Stefan Sperling 28526235 2022-02-13T00:12:04 fix pack.sh test failure from reuse-deltas patch by tweaking progress output
Stefan Sperling 67fd6849 2022-02-13T00:10:25 reuse existing deltas when creating pack files tested by thomas, naddy, and myself
Christian Weisgerber f6027426 2022-02-12T21:48:46 consistently match size of hash variables to that returned by murmurhash ok millert stsp
Stefan Sperling 2b474c25 2022-02-11T22:45:00 use murmurhash instead of sha1 for deltification blocks; suggested by ori
Stefan Sperling 1ac8bad9 2022-02-11T22:44:35 reduce minimum deltification chunk size to 32; suggested by ori
Stefan Sperling 916237f3 2022-02-11T22:42:50 fix 'got diff' on files which match an ignore pattern; found by Omar Polo
Stefan Sperling d75b4088 2022-02-08T10:52:17 set zlib output buffer length properly after resizing the output buffer ok millert naddy
Stefan Sperling a9bd296d 2022-02-08T10:48:04 fix infinite loop in got-index-pack for pack files >= 4GB in size Because of a missing range check our zlib wrapper would end up calling zlib over and over with zero bytes of input. Problem reported by semarie and naddy. Fixed with help from millert@. ok millert naddy
Stefan Sperling 9b4603c0 2022-01-31T16:27:14 improve 'got add' error message if file does not exist; reported by Timo Myyrä ok tracey
Stefan Sperling c7b17232 2022-01-28T18:07:47 fix loose object file header parser for zero-length headers ok millert tracey
Stefan Sperling a47330a2 2022-01-27T22:32:09 fix 'got status' reporting all directories on NFS mounts as unversioned Problem found and fix tested by Ted Bullock. ok millert, naddy
Stefan Sperling 8264d9ee 2022-01-27T12:05:24 fix wrong imsg name in errors raised by got_privsep_send_tree_req()
Stefan Sperling 9296b03b 2022-01-26T10:33:52 remove unnecessary local variable from got_privsep_get_imsg_obj()
Stefan Sperling d1b988e3 2022-01-26T10:33:52 add missing initialization of delta list in got_privsep_get_imsg_obj()
Stefan Sperling 0ee7a4dc 2022-01-26T10:33:21 fix double-free and double-close issues in error paths of got_packidx_open()
Stefan Sperling 692bdcc4 2022-01-25T22:48:26 make 'got rm' report an "unexpected status" error for unversioned files ok millert@
Stefan Sperling 4e12cd97 2022-01-25T22:48:26 make 'got rm' behave like rm(1) for paths found missing on disk ok millert@
Stefan Sperling 969ea98d 2022-01-24T08:04:11 remove non-reachable 'return NULL' statement from report_single_file_status()
Stefan Sperling 72840534 2022-01-19T12:04:58 compress delta data from delta_cache directly into pack file
Stefan Sperling 30ee8dc8 2022-01-18T20:51:19 add missing error check in got_inflate_to_mem_mmap()
Stefan Sperling 3bfc2334 2022-01-11T15:37:06 fix file corruption regression in 'got checkout' caused by commit db696021 got-read-pack must rewind its files temporary files before reusing them. Problem reported by naddy ok tracey naddy
Stefan Sperling 3976db15 2022-01-10T14:46:30 add missing checks for reads beyond the mapped memory area of a pack file
Stefan Sperling 402a5ec1 2022-01-10T13:13:16 set a cap on the amount of memory we use to store encoded deltas
Stefan Sperling 5060d5a1 2022-01-10T11:09:25 encode short deltas in memory instead of writing them to a temporary file
Stefan Sperling 64a8571e 2022-01-07T23:32:27 map raw object files into memory while packing if possible
Stefan Sperling 59b21794 2022-01-07T14:33:52 only open raw objects if necessary while writing out pack file data significantly speeds up the "writing pack: " step of gotadmin pack
Stefan Sperling 0f71f619 2022-01-06T22:30:35 fix wrong path in a comment
Stefan Sperling 2471f5c4 2022-01-06T19:20:52 sync files from diff.git b72f51ffc39028023059fc994542565691b669fa This fixes a scrolling problem in tog's diff view for diffs which contain lines of the form "Binary files %s and %s differ".
Stefan Sperling dbe266a4 2022-01-05T20:24:13 print status output even if 'gotadmin cleanup' finds no objects to remove
Stefan Sperling 9cd5f067 2022-01-05T20:14:59 fix amount of purged objects shown in gotadmin cleanup's final progress report
Stefan Sperling 211cfef0 2022-01-05T19:57:10 use time-based rate-limiting for gotadmin progress output Suggested by naddy some time ago. ok tracey
Stefan Sperling db696021 2022-01-04T16:11:52 avoid the creation of new temporary files whenever a packed object is read This speeds up the creation of pack files by about 30%.
Stefan Sperling 404bde06 2022-01-03T21:51:02 fix bogus "object not found" errors when object ID begins with 00 ok thomas_adam
Stefan Sperling c0df5966 2021-12-31T09:33:01 wrap overlong lines
Stefan Sperling e7ae0baf 2021-12-31T09:11:22 add O_CLOEXEC (close-on-exec) to openat(2) calls suggested by millert ok thomas_adam
Stefan Sperling 8bd0cdad 2021-12-31T09:11:21 add O_CLOEXEC (close-on-exec) flag to open(2) calls suggested by millert ok thomas_adam
Stefan Sperling 00fe21f2 2021-12-31T09:11:21 add "e" (close-on-exec) flag to fopen(3) calls suggested by millert ok thomas_adam