aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* refs: convert struct ref_update to use struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert struct ref_array_item to use struct object_id by changing the definition and applying the following semantic patch, plus the standard object_id transforms: @@ struct ref_update E1; @@ - E1.new_sha1 + E1.new_oid.hash @@ struct ref_update *E1; @@ - E1->new_sha1 + E1->new_oid.hash @@ struct ref_update E1; @@ - E1.old_sha1 + E1.old_oid.hash @@ struct ref_update *E1; @@ - E1->old_sha1 + E1->old_oid.hash This transformation allows us to convert write_ref_to_lockfile, which is required to convert parse_object. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* ref-filter: convert some static functions to struct object_idbrian m. carlson2017-05-08
| | | | | | | | Among the converted functions is a caller of parse_object_buffer, which we will convert later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert struct ref_array_item to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | | | | | | | | | | Convert struct ref_array_item to use struct object_id by changing the definition and applying the following semantic patch, plus the standard object_id transforms: @@ struct ref_array_item E1; @@ - E1.objectname + E1.objectname.hash @@ struct ref_array_item *E1; @@ - E1->objectname + E1->objectname.hash This transformation allows us to convert get_obj, which is needed to convert parse_object_buffer. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert the verify_pack callback to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | | | | | | Make the verify_pack_callback take a pointer to struct object_id. Change the pack checksum to use GIT_MAX_RAWSZ, even though it is not strictly an object ID. Doing so ensures resilience against future hash size changes, and allows us to remove hard-coded assumptions about how big the buffer needs to be. Also, use a union to convert the pointer from nth_packed_object_sha1 to to a pointer to struct object_id. This behavior is compatible with GCC and clang and explicitly sanctioned by C11. The alternatives are to just perform a cast, which would run afoul of strict aliasing rules, but should just work, and changing the pointer into an instance of struct object_id and copying the value. The latter operation could seriously bloat memory usage on fsck, which already uses a lot of memory on some repositories. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert lookup_tag to struct object_idbrian m. carlson2017-05-08
| | | | | | | Convert lookup_tag to take a pointer to struct object_id. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* log-tree: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | Convert the remaining functions to take pointers to struct object_id instead of pointers to unsigned char, and update the internals of these functions as well. Among these functions is a caller of lookup_tag, which we will convert shortly. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert lookup_tree to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | Convert the lookup_tree function to take a pointer to struct object_id. The commit was created with manual changes to tree.c, tree.h, and object.c, plus the following semantic patch: @@ @@ - lookup_tree(EMPTY_TREE_SHA1_BIN) + lookup_tree(&empty_tree_oid) @@ expression E1; @@ - lookup_tree(E1.hash) + lookup_tree(&E1) @@ expression E1; @@ - lookup_tree(E1->hash) + lookup_tree(E1) Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/reflog: convert tree_is_complete to take struct object_idbrian m. carlson2017-05-08
| | | | | Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* tree: convert read_tree_1 to use struct object_id internallybrian m. carlson2017-05-08
| | | | | Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert lookup_blob to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | | | | | | | | Convert lookup_blob to take a pointer to struct object_id. The commit was created with manual changes to blob.c and blob.h, plus the following semantic patch: @@ expression E1; @@ - lookup_blob(E1.hash) + lookup_blob(&E1) @@ expression E1; @@ - lookup_blob(E1->hash) + lookup_blob(E1) Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert remaining callers of lookup_blob to object_idbrian m. carlson2017-05-08
| | | | | | | | | | All but a few callers of lookup_blob have been converted to struct object_id. Introduce a temporary, which will be removed later, into parse_object to ease the transition, and convert the remaining callers so that we can update lookup_blob to take struct object_id *. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/unpack-objects: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | Convert struct delta_info and struct object_info, as well as the various functions, to use struct object_id. Convert several hard-coded 20 values to GIT_SHA1_RAWSZ. Among the functions converted is a caller of lookup_blob, which we will convert shortly. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* pack: convert struct pack_idx_entry to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | | | | | | | Convert struct pack_idx_entry to use struct object_id by changing the definition and applying the following semantic patch, plus the standard object_id transforms: @@ struct pack_idx_entry E1; @@ - E1.sha1 + E1.oid.hash @@ struct pack_idx_entry *E1; @@ - E1->sha1 + E1->oid.hash Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert lookup_commit* to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert lookup_commit, lookup_commit_or_die, lookup_commit_reference, and lookup_commit_reference_gently to take struct object_id arguments. Introduce a temporary in parse_object buffer in order to convert this function. This is required since in order to convert parse_object and parse_object_buffer, lookup_commit_reference_gently and lookup_commit_or_die would need to be converted. Not introducing a temporary would therefore require that lookup_commit_or_die take a struct object_id *, but lookup_commit would take unsigned char *, leaving a confusing and hard-to-use interface. parse_object_buffer will lose this temporary in a later patch. This commit was created with manual changes to commit.c, commit.h, and object.c, plus the following semantic patch: @@ expression E1, E2; @@ - lookup_commit_reference_gently(E1.hash, E2) + lookup_commit_reference_gently(&E1, E2) @@ expression E1, E2; @@ - lookup_commit_reference_gently(E1->hash, E2) + lookup_commit_reference_gently(E1, E2) @@ expression E1; @@ - lookup_commit_reference(E1.hash) + lookup_commit_reference(&E1) @@ expression E1; @@ - lookup_commit_reference(E1->hash) + lookup_commit_reference(E1) @@ expression E1; @@ - lookup_commit(E1.hash) + lookup_commit(&E1) @@ expression E1; @@ - lookup_commit(E1->hash) + lookup_commit(E1) @@ expression E1, E2; @@ - lookup_commit_or_die(E1.hash, E2) + lookup_commit_or_die(&E1, E2) @@ expression E1, E2; @@ - lookup_commit_or_die(E1->hash, E2) + lookup_commit_or_die(E1, E2) Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert remaining callers of lookup_commit_reference* to object_idbrian m. carlson2017-05-08
| | | | | | | | | There are a small number of remaining callers of lookup_commit_reference and lookup_commit_reference_gently that still need to be converted to struct object_id. Convert these. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/tag: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | Parts of this module call lookup_commit_reference, which we want to convert. The module is small and mostly self-contained, so convert the rest of it while we're at it. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* sequencer: convert some functions to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | Convert update_squash_messages and is_index_unchanged to struct object_id. These are callers of lookup_commit and lookup_commit_reference, which we want to convert. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* shallow: convert shallow registration functions to object_idbrian m. carlson2017-05-08
| | | | | | | | | | | Convert register_shallow and unregister_shallow to take struct object_id. register_shallow is a caller of lookup_commit, which we will convert later. It doesn't make sense for the registration and unregistration functions to have incompatible interfaces, so convert them both. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* revision: convert prepare_show_merge to struct object_idbrian m. carlson2017-05-08
| | | | | | | | This is a caller of lookup_commit_or_die, which we will convert later on. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* notes-utils: convert internals to struct object_idbrian m. carlson2017-05-08
| | | | | | | | Convert the internals of create_notes_comit and commit_notes to use struct object_id. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* http-push: convert some static functions to struct object_idbrian m. carlson2017-05-08
| | | | | | | | Among the functions converted is a caller of lookup_commit_or_die, which we will convert later on. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* tag: convert parse_tag_buffer to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | Specify some constants in terms of GIT_SHA1_HEXSZ, and convert a get_sha1_hex into parse_oid_hex to avoid needing to specify additional constants. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/verify-commit: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | | This is a prerequisite to convert to lookup_commit, which we will convert later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* reflog_expire: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | Adjust the callback functions to take struct object_id * instead of unsigned char *, and modify related static functions accordingly. Introduce a temporary object_id instance into files_reflog_expire and copy the SHA-1 value passed in. This is necessary because the sha1 parameter can come indirectly from get_sha1. Without the temporary, it would require much more refactoring to be able to convert this function. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* parse-options-cb: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | This is a caller of lookup_commit_reference, which we will soon convert. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* notes-cache: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | Convert as many instances of unsigned char [20] as possible. Update the callers of notes_cache_get and notes_cache_put to use the new interface. Among the functions updated are callers of lookup_commit_reference_gently, which we will soon convert. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule: convert merge_submodule to use struct object_idbrian m. carlson2017-05-08
| | | | | | | | This is a caller of lookup_commit_reference, which we will convert later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* fast-import: convert to struct object_idbrian m. carlson2017-05-08
| | | | | | | | | | | | | | | Convert the remaining parts of fast-import.c to use struct object_id. Convert several instances of get_sha1_hex to parse_oid_hex to avoid needing to specify constants. Convert other hardcoded values to named constants. Finally, use the is_empty_tree_oid function instead of a direct comparison against a fixed string. Note that the odd computation with GIT_MAX_HEXSZ is due to the insertion of a slash between every two hex digits in the path, plus one for the terminating NUL. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* fast-import: convert internal structs to struct object_idbrian m. carlson2017-05-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert struct tree_entry_ms, struct branch, struct tag, and struct hash_list to use struct object_id by changing the definition and applying the following semantic patch, plus the standard object_id transforms: @@ struct tree_entry_ms E1; @@ - E1.sha1 + E1.oid.hash @@ struct tree_entry_ms *E1; @@ - E1->sha1 + E1->oid.hash @@ struct branch E1; @@ - E1.sha1 + E1.oid.hash @@ struct branch *E1; @@ - E1->sha1 + E1->oid.hash @@ struct tag E1; @@ - E1.sha1 + E1.oid.hash @@ struct tag *E1; @@ - E1->sha1 + E1->oid.hash @@ struct hash_list E1; @@ - E1.sha1 + E1.oid.hash @@ struct hash_list *E1; @@ - E1->sha1 + E1->oid.hash Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/rev-parse: convert to struct object_idbrian m. carlson2017-05-02
| | | | | | | | | Some of the functions converted are callers of lookup_commit_reference. However, the changes involved in converting the entire thing are not too large, so we might as well convert it all. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/blame: convert static function to struct object_idbrian m. carlson2017-05-02
| | | | | | | | This function is a caller of lookup_commit_reference_gently, which we will convert later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* branch: convert to struct object_idbrian m. carlson2017-05-02
| | | | | | | This change is required to convert lookup_commit_reference later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* bundle: convert to struct object_idbrian m. carlson2017-05-02
| | | | | | | | | | Convert the bundle code, plus the sole external user of struct ref_list_entry, to use struct object_id. Include cache.h from within bundle.h to provide the definition. Convert some of the hash parsing code to use parse_oid_hex to avoid needing to hard-code constant values. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/prune: convert to struct object_idbrian m. carlson2017-05-02
| | | | | | | | Convert the sole instance of unsigned char [20] to struct object_id. cmd_prune is a caller of parse_object, which we will convert later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin/name-rev: convert to struct object_idbrian m. carlson2017-05-02
| | | | | | | | | | | | | | | Convert all the uses of unsigned char [20] to struct object_id. Also, convert some hard-coded integers into constants. name_rev_line accepts a wide variety of free-form input and only interprets 40-character hex values, passing through everything else. Consequently, it is not a good candidate for parse_oid_hex, which is much stricter. This change is a prerequisite for converting parse_object. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Convert struct cache_tree to use struct object_idbrian m. carlson2017-05-02
| | | | | | | | | | | | | | | | | | | | | | | | | Convert the sha1 member of struct cache_tree to struct object_id by changing the definition and applying the following semantic patch, plus the standard object_id transforms: @@ struct cache_tree E1; @@ - E1.sha1 + E1.oid.hash @@ struct cache_tree *E1; @@ - E1->sha1 + E1->oid.hash Fix up one reference to active_cache_tree which was not automatically caught by Coccinelle. These changes are prerequisites for converting parse_object. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Clean up outstanding object_id transforms.brian m. carlson2017-05-02
| | | | | | | | | The semantic patch for standard object_id transforms found two outstanding places where we could make a transformation automatically. Apply these changes. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* fetch-pack: convert to struct object_idbrian m. carlson2017-05-02
| | | | | | | | | Convert all uses of unsigned char [20] to struct object_id. Switch one use of get_sha1_hex to parse_oid_hex to avoid the need for a constant. This change is necessary in order to convert parse_object. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merging a handful of topics before -rc2Junio C Hamano2017-04-30
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'sh/rebase-i-reread-todo-after-exec'Junio C Hamano2017-05-01
|\ | | | | | | | | | | | | | | "git rebase -i" failed to re-read the todo list file when the command specified with the `exec` instruction updated it. * sh/rebase-i-reread-todo-after-exec: rebase -i: reread the todo list if `exec` touched it
| * rebase -i: reread the todo list if `exec` touched itStephen Hicks2017-04-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the scripted version of the interactive rebase, there was no internal representation of the todo list; it was re-read before every command. That allowed the hack that an `exec` command could append (or even completely rewrite) the todo list. This hack was broken by the partial conversion of the interactive rebase to C, and this patch reinstates it. We also add a small test to verify that this fix does not regress in the future. Signed-off-by: Stephen Hicks <sdh@google.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ls/travis-stricter-linux32-builds'Junio C Hamano2017-05-01
|\ \ | | | | | | | | | | | | | | | | | | 32-bit Linux build on Travis CI uses stricter compilation options. * ls/travis-stricter-linux32-builds: travis-ci: set DEVELOPER knob for Linux32 build
| * | travis-ci: set DEVELOPER knob for Linux32 buildLars Schneider2017-04-27
| |/ | | | | | | | | | | | | | | | | The Linux32 build was not build with our strict compiler settings (e.g. warnings as errors). Fix this by passing the DEVELOPER environment variable to the docker container. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ls/travis-win-fix-status'Junio C Hamano2017-05-01
|\ \ | | | | | | | | | | | | | | | | | | | | | Relaying status from Windows build by Travis CI was done with an unsafe invocation of printf. * ls/travis-win-fix-status: travis-ci: printf $STATUS as string
| * | travis-ci: printf $STATUS as stringLars Schneider2017-04-26
| |/ | | | | | | | | | | | | | | | | | | If the $STATUS variable contains a "%" character then printf will interpret that as invalid format string. Fix this by formatting $STATUS as string. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jk/submodule-init-segv-fix'Junio C Hamano2017-05-01
|\ \ | | | | | | | | | | | | | | | | | | Fix a segv in 'submodule init' when url is not given for a submodule. * jk/submodule-init-segv-fix: submodule_init: die cleanly on submodules without url defined
| * | submodule_init: die cleanly on submodules without url definedJeff King2017-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we init a submodule, we try to die when it has no URL defined: url = xstrdup(sub->url); if (!url) die(...); But that's clearly nonsense. xstrdup() will never return NULL, and if sub->url is NULL, we'll segfault. These two bits of code need to be flipped, so we check sub->url before looking at it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jk/prio-queue-avoid-swap-with-self'Junio C Hamano2017-05-01
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Code clean-up. * jk/prio-queue-avoid-swap-with-self: prio_queue_reverse: don't swap elements with themselves
| * | | prio_queue_reverse: don't swap elements with themselvesJeff King2017-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our array-reverse algorithm does the usual "walk from both ends, swapping elements". We can quit when the two indices are equal, since: 1. Swapping an element with itself is a noop. 2. If i and j are equal, then in the next iteration i is guaranteed to be bigge than j, and we will exit the loop. So exiting the loop on equality is slightly more efficient. And more importantly, the new SWAP() macro does not expect to handle noop swaps; it will call memcpy() with the same src and dst pointers in this case. It's unclear whether that causes a problem on any platforms by violating the "overlapping memory" constraint of memcpy, but it does cause valgrind to complain. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'ab/align-perf-descriptions'Junio C Hamano2017-05-01
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Output from perf tests have been updated to align their titles. * ab/align-perf-descriptions: t/perf: correctly align non-ASCII descriptions in output