lib/reference.c


Log

Author Commit Date CI Message
Stefan Sperling 42864987 2021-11-20T11:14:44 fall back to comparison by name when refs have the same timestamp This fixes an issue where some references were missing from lists of references sorted by timestamp.
Stefan Sperling 2d497592 2021-11-20T10:40:33 implement got_reflist_sort() which sorts a ref list in-place
Stefan Sperling 0309152a 2021-11-20T10:39:04 fix uninitialized error from got_ref_cmp_by_commit_timestamp_descending()
Stefan Sperling 7f66531d 2021-11-16T14:33:26 allow sorting references by timestamp in tog
Stefan Sperling 2c9e323b 2021-10-10T19:26:26 speed up 'got histedit -l' and 'got rebase -l' Cache commit timestamps in struct got_reference in case we are sorting references by commit timestamp. This avoids opening and closing commits every time we compare two references with each other. ok thomas.adam
Christian Weisgerber 9dd14b99 2021-09-28T19:21:34 got_sha1_digest_to_str() writes to char * ok stsp
Christian Weisgerber abc59930 2021-09-05T19:41:03 indentation fixes
Stefan Sperling 63e5aa5c 2021-08-23T10:51:48 Expose got_ref_name_is_valid() for general purpose use. This will be needed for a future 'got send' command.
Stefan Sperling cce2f485 2021-08-22T12:56:14 expose got_ref_resolve_symbolic() at the public library API This will be needed by a future 'got send' command.
Stefan Sperling 72acb3d8 2021-08-06T12:43:33 remove unused 'repo' argument from got_reflist_insert()
Stefan Sperling 3f338f0a 2021-07-27T13:08:51 track the last modification time of references
Stefan Sperling 5345b4c7 2021-07-06T07:39:36 allow lockfiles to be used in cases where we have a dir_fd and a relative path
Stefan Sperling 779e1159 2021-06-18T14:14:49 expose the reflist_insert() helper function as got_reflist_insert() This will be needed by 'gotadmin pack'.
Stefan Sperling 57c18198 2021-05-24T18:25:19 validate reference names in open_ref() This catches invalid reference names passed to 'got ref -l' and will also be needed to validate reference names passed to a future 'gotadmin pack' command. ok naddy@
Stefan Sperling af8a5c4a 2021-05-21T20:16:17 plug a memory leak in got_ref_list_free() Code which inserts a reference into a reflist passes ownership of this reference to the list. However, got_ref_list_free() never closed such references, which resulted in a memory leak. ok tracey
Stefan Sperling e600f124 2021-03-21T19:09:35 ensure that old commits remain referenced after rebase and histedit Create automatic "backup" references which ensure that objects from the pre-rebase or pre-histedit state remain in the repository. A new -l option for 'got rebase' and 'got histedit' lists old commits. This makes it easier to recover from botched rebase or histedit operations. Removal of such objects currently requires got ref -d and git-gc. This will be made more convenient in the future. testing and ok jrick
Stefan Sperling 56b63ca4 2021-01-22T11:04:47 make fclose(3) failure checks consistent; check 'fclose() == EOF' everywhere ok millert, naddy
Christian Weisgerber 7a90b680 2021-01-02T20:57:19 oops, initialize linesize before calling getline(3); from millert
Christian Weisgerber 9bdd68dd 2021-01-02T20:46:01 replace fparseln(3) with getline(3), for better portability ok stsp
Stefan Sperling f0ff8d4c 2020-12-26T23:14:26 fix tag object leak introduced in previous commit
Stefan Sperling 24202e46 2020-12-26T23:08:51 add tagged object IDs to reference list object ID map Fixes display of "/tags/..." commit ID decorators in tog which was broken in previous commits.
Stefan Sperling a53af95f 2020-12-26T23:04:46 fix error return from got_reflist_object_id_map_create()
Stefan Sperling f193b038 2020-12-26T22:39:55 rename got_reflist_object_map_free to got_reflist_object_id_map_free
Stefan Sperling d9dff0e5 2020-12-26T21:32:01 switch reflist to TAILQ; insert elements more efficiently for sorted input ok naddy
Stefan Sperling 7b5b670e 2020-12-25T21:38:17 implement an object ID map for reference lists ok naddy
Stefan Sperling 4c4ce67b 2020-12-25T21:38:17 fix assignment to wrong pointer in got_ref_dup() ok naddy
Stefan Sperling 16aeacf7 2020-11-26T12:54:19 use size_t for loop indices to avoid signedness warnings; from emaste@freebsd
Christian Weisgerber 3818e3c4 2020-11-01T16:28:46 convert all remaining instances of chmod(2) to fchmod(2) ok stsp
Stefan Sperling a1c4175c 2020-09-22T00:42:02 there is no need to grab locks when opening refs in got_ref_delete()
Stefan Sperling 48cae60d 2020-09-22T00:03:02 make dangling symbolic references show up in 'got ref -l' Storing a resolved ID for each reference list item was a bad idea. This ID cannot be resolved if a symbolic references points to a reference which does not exist. Such symrefs were skipped by got ref -l as a result. Just let users of reference lists resolve the IDs as needed.
Stefan Sperling 2a104ff6 2020-09-21T23:37:54 make 'got ref -d' delete both loose and packed representations of the reference
Christian Weisgerber 81a12da5 2020-09-09T19:35:32 do not rely on <zlib.h> to pull in <unistd.h> ok stsp
Stefan Sperling 20ccae39 2020-07-21T14:19:32 cope with directory entries returned from readdir(3) with type DT_UNKNOWN Such directory entries need special handling to make our directory traversal code work on filesystems that do not support the d_type optimization. I found this problem because references stored in the refs/ directory were not shown by 'got log' and 'tog log' when a repository is mounted over NFS. helpful feedback + ok millert@
Stefan Sperling d7b899ab 2020-03-25T15:55:22 fix got_ref_change_symref(); it changed the ref's name instead of its target
Stefan Sperling 75236079 2020-03-25T14:30:15 handle refs/remotes/origin/HEAD properly; reported by Matthias aka _xhr_
Stefan Sperling b2070a3f 2020-03-22T14:21:07 allow for limiting output of 'got ref -l' to a single ref or a namespace
Stefan Sperling e8a967e0 2020-03-21T22:44:07 make replacing symrefs actually work in 'got fetch'
Stefan Sperling 9f142382 2020-03-21T22:06:00 properly lock references when 'got fetch' needs to update them
Stefan Sperling f68a7890 2020-03-19T09:07:46 make got_ref_list() work on a fresh repository created with got_repo_init()
Stefan Sperling 7fa81f88 2020-02-21T01:06:03 allow 'got ref' to manipulate refs which do not have a slash in their name
Stefan Sperling d1f16636 2020-01-15T22:05:49 move got_repo_cmp_tags() to got_ref_cmp_tags()
Stefan Sperling 56e0773d 2019-11-28T02:32:58 convert tree entries from SIMPLEQ to an array
Stefan Sperling c30018ad 2019-10-21T09:04:57 ignore empty files in refs directory; convert parse_ref_file() to getline(3)
Stefan Sperling 24b5452a 2019-10-09T06:50:28 show bad reference names in error messages to make such errors more clear
Hiltjo Posthuma cdb8f1fa 2019-08-28T18:50:20 fix possible NULL deref in alloc_symref()
Stefan Sperling 6aeab596 2019-08-28T14:51:42 fix deletion of branches stored in packed-refs broken since 29606af7a3a58767bf817a38035490899609d13e
Stefan Sperling b8bad2ba 2019-08-23T20:01:06 make 'got tag -l' list tags by time stamp in descending order
Stefan Sperling 29606af7 2019-08-23T18:42:27 allow got_ref_list() to restrict returned refs to a particular namespace
Stefan Sperling 29e86f7a 2019-08-13T00:32:42 introuce a hard limit on recursion through symbolic references
Stefan Sperling d572f586 2019-08-02T15:42:42 eliminate strlen() calls during fileindex rb tree searches
Stefan Sperling 6e472252 2019-07-22T10:35:46 remove pointless call to got_path_normalize()
Stefan Sperling aaf88317 2019-07-10T18:08:23 introduce got_ref_alloc_symref() and got_ref_get_symref_target()
Stefan Sperling 0f148cb7 2019-05-13T17:28:57 revert c191ed664f6c437ebc3e0c859c53e48b445401f1 'got ref' should only work with naked ref names; implicitly putting things into 'refs/heads' is a job for something like a 'got branch' command.
Stefan Sperling 6e472abb 2019-05-13T17:27:39 fix a segfault in got_ref_open()
Stefan Sperling aedda007 2019-05-13T17:09:11 make open_ref() tolerate missing reference dirs and files
Stefan Sperling c191ed66 2019-05-13T17:08:16 allow single-component reference names with got_ref_alloc()
Stefan Sperling 638f9024 2019-05-13T12:40:57 rename got_error_prefix_errno() to got_error_from_errno()
Stefan Sperling f5c58ad1 2019-05-12T18:05:59 fix leftover lockfiles from parse_ref_file()
Stefan Sperling a875589a 2019-05-12T17:55:03 fix locking of packed ref file in got_ref_open()
Stefan Sperling 0885ce8f 2019-05-12T17:48:22 handle well-known refs more obviously in got_ref_open()
Stefan Sperling 5b575c25 2019-05-12T17:45:10 don't hide errors in got_ref_open()
Stefan Sperling 2f17228e 2019-05-11T21:18:39 lock branch reference file during 'got commit' to prevent a race
joshua stein 656b1f76 2019-05-11T14:26:12 while (1) -> for (;;)
joshua stein 230a42bd 2019-05-11T13:04:38 got_error_from_errno -> got_error_prefix_errno also add got_error_prefix_errno2 and got_error_prefix_errno3 which should hopefully all be merged into a single function with variadic args (but can't alloc mem)
Stefan Sperling 324d37e7 2019-05-11T09:14:30 make got path APIs available to library consumers
Stefan Sperling b249b824 2019-05-09T13:47:59 add APIs to change references
Stefan Sperling 57b6f99a 2019-04-13T16:06:37 handle non-existent reference in got_ref_resolve() error path
Stefan Sperling 598a8b91 2019-03-15T13:38:49 implement support for packed refs in 'got ref -d'
Stefan Sperling 6249107b 2019-03-15T13:35:47 fix uninitialized variable in insert_ref()
Stefan Sperling 80d5fc1f 2019-03-15T13:24:51 use sizeof instead of SHA1_DIGEST_LENGTH in memcpy
Stefan Sperling 6fdbf7b0 2019-03-15T13:14:08 better malloc size idiom in insert_ref()
Stefan Sperling c0a1c016 2019-03-15T13:11:20 move assignment closer to check in parse_ref_file()
Stefan Sperling 505287be 2019-03-15T13:06:47 properly handle duplicates when calling insert_ref()
Stefan Sperling 27a1ed03 2019-03-15T12:59:35 don't leak 'new' in insert_ref()
Stefan Sperling 0bb4abae 2019-03-15T12:50:27 better fparseln error handling and memory leak fix in got_ref_list()
Stefan Sperling 7ab0422a 2019-03-15T12:49:08 better foarseln() error handling in open_packed_ref()
Stefan Sperling c980e470 2019-03-15T12:47:15 plug memleak in alloc_ref()
Stefan Sperling c53671d0 2019-03-15T12:45:56 plug memleak in got_ref_resolve()
Stefan Sperling f9267c9a 2019-03-15T11:09:41 set an is_packed flag on refs parsed from packed-refs file
Stefan Sperling e09d28b1 2019-03-15T11:09:02 plug two memory leaks when refs get closed
Stefan Sperling d1667f0d 2019-03-11T20:22:28 introduce got_path_dirname()
Stefan Sperling 5e1c9f23 2019-03-11T20:13:26 fix dirname() usage errors around got_path_mkdir()
Stefan Sperling 49c7094f 2019-03-11T20:02:10 fix broken error checking in got_ref_write()
Stefan Sperling 0cd1c46a 2019-03-11T18:07:33 create references to base commits of got worktrees
Stefan Sperling e2e879a0 2019-03-11T16:58:21 introduce got_ref_list_free() and use it in got and tog
Stefan Sperling 2d2e1378 2019-03-11T16:34:33 add got_ref_delete(); only loose refs supported for now
Stefan Sperling 8fa2f096 2019-03-11T16:28:11 fix off-by-one in fwrite() check in got_ref_write()
Stefan Sperling 0fd469ce 2019-03-11T16:27:15 make got_ref_write() work for refs which do not exist yet
Stefan Sperling 58908ed0 2019-03-11T16:25:39 fix path construction with empty subdir in open_ref()
Stefan Sperling 9e672c74 2019-03-11T14:56:04 implement got_ref_write()
Stefan Sperling f77a24b0 2019-03-11T14:20:46 validate ref names
Stefan Sperling 5892cdd6 2019-03-10T16:17:12 introduce got_ref_alloc()
Stefan Sperling fb43ecf1 2019-02-11T11:59:09 check for errors from fclose()
Stefan Sperling e135804e 2019-02-10T19:15:13 make got_ref_open() search on-disk refs before packed-refs
Stefan Sperling 7a3c76f5 2019-02-05T14:41:20 fix insert_ref() to provide ordering similar to path lists
Stefan Sperling 3ca16530 2019-02-04T18:48:07 append to tail of reflist, not to the head of the list
Stefan Sperling e397b6db 2019-02-04T10:48:23 make got_ref_list() return a sorted list
Stefan Sperling 29b5c214 2019-02-04T10:37:07 on-disk refs must take precedence over packed-refs
Stefan Sperling 1e37702e 2019-02-04T10:24:14 internally represent a non-existent ref as NULL rather than as error
Stefan Sperling a04f49d2 2019-02-04T09:54:40 include non-packed refs in results from got_ref_list()