1. 30 6月, 2018 1 次提交
  2. 22 5月, 2018 1 次提交
    • D
      commit-graph: always load commit-graph information · e2838d85
      Derrick Stolee 提交于
      Most code paths load commits using lookup_commit() and then
      parse_commit(). In some cases, including some branch lookups, the commit
      is parsed using parse_object_buffer() which side-steps parse_commit() in
      favor of parse_commit_buffer().
      
      With generation numbers in the commit-graph, we need to ensure that any
      commit that exists in the commit-graph file has its generation number
      loaded.
      
      Create new load_commit_graph_info() method to fill in the information
      for a commit that exists only in the commit-graph file. Call it from
      parse_commit_buffer() after loading the other commit information from
      the given buffer. Only fill this information when specified by the
      'check_graph' parameter.
      Signed-off-by: NDerrick Stolee <dstolee@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e2838d85
  3. 18 5月, 2018 2 次提交
  4. 16 5月, 2018 2 次提交
  5. 10 5月, 2018 1 次提交
  6. 09 5月, 2018 7 次提交
  7. 26 4月, 2018 1 次提交
  8. 12 4月, 2018 2 次提交
  9. 27 3月, 2018 2 次提交
  10. 24 3月, 2018 2 次提交
  11. 15 3月, 2018 4 次提交
    • B
      Convert lookup_replace_object to struct object_id · b383a13c
      brian m. carlson 提交于
      Convert both the argument and the return value to be pointers to struct
      object_id.  Update the callers and their internals to deal with the new
      type.  Remove several temporaries which are no longer needed.
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b383a13c
    • B
      sha1_file: convert read_sha1_file to struct object_id · b4f5aca4
      brian m. carlson 提交于
      Convert read_sha1_file to take a pointer to struct object_id and rename
      it read_object_file.  Do the same for read_sha1_file_extended.
      
      Convert one use in grep.c to use the new function without any other code
      change, since the pointer being passed is a void pointer that is already
      initialized with a pointer to struct object_id.  Update the declaration
      and definitions of the modified functions, and apply the following
      semantic patch to convert the remaining callers:
      
      @@
      expression E1, E2, E3;
      @@
      - read_sha1_file(E1.hash, E2, E3)
      + read_object_file(&E1, E2, E3)
      
      @@
      expression E1, E2, E3;
      @@
      - read_sha1_file(E1->hash, E2, E3)
      + read_object_file(E1, E2, E3)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - read_sha1_file_extended(E1.hash, E2, E3, E4)
      + read_object_file_extended(&E1, E2, E3, E4)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - read_sha1_file_extended(E1->hash, E2, E3, E4)
      + read_object_file_extended(E1, E2, E3, E4)
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4f5aca4
    • B
      sha1_file: convert sha1_object_info* to object_id · abef9020
      brian m. carlson 提交于
      Convert sha1_object_info and sha1_object_info_extended to take pointers
      to struct object_id and rename them to use "oid" instead of "sha1" in
      their names.  Update the declaration and definition and apply the
      following semantic patch, plus the standard object_id transforms:
      
      @@
      expression E1, E2;
      @@
      - sha1_object_info(E1.hash, E2)
      + oid_object_info(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - sha1_object_info(E1->hash, E2)
      + oid_object_info(E1, E2)
      
      @@
      expression E1, E2, E3;
      @@
      - sha1_object_info_extended(E1.hash, E2, E3)
      + oid_object_info_extended(&E1, E2, E3)
      
      @@
      expression E1, E2, E3;
      @@
      - sha1_object_info_extended(E1->hash, E2, E3)
      + oid_object_info_extended(E1, E2, E3)
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      abef9020
    • B
      sha1_file: convert check_sha1_signature to struct object_id · 17e65451
      brian m. carlson 提交于
      Convert this function to take a pointer to struct object_id and rename
      it check_object_signature.  Introduce temporaries to convert the return
      values of lookup_replace_object and lookup_replace_object_extended into
      struct object_id.
      
      The temporaries are needed because in order to convert
      lookup_replace_object, open_istream needs to be converted, and
      open_istream needs check_sha1_signature to be converted, causing a loop
      of dependencies.  The temporaries will be removed in a future patch.
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      17e65451
  12. 15 2月, 2018 1 次提交
  13. 29 12月, 2017 1 次提交
  14. 09 12月, 2017 1 次提交
    • J
      rev-list: support termination at promisor objects · df11e196
      Jonathan Tan 提交于
      Teach rev-list to support termination of an object traversal at any
      object from a promisor remote (whether one that the local repo also has,
      or one that the local repo knows about because it has another promisor
      object that references it).
      
      This will be used subsequently in gc and in the connectivity check used
      by fetch.
      
      For efficiency, if an object is referenced by a promisor object, and is
      in the local repo only as a non-promisor object, object traversal will
      not stop there. This is to avoid building the list of promisor object
      references.
      
      (In list-objects.c, the case where obj is NULL in process_blob() and
      process_tree() do not need to be changed because those happen only when
      there is a conflict between the expected type and the existing object.
      If the object doesn't exist, an object will be synthesized, which is
      fine.)
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJeff Hostetler <jeffhost@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      df11e196
  15. 24 9月, 2017 1 次提交
    • M
      object_array: add and use `object_array_pop()` · 71992039
      Martin Ågren 提交于
      In a couple of places, we pop objects off an object array `foo` by
      decreasing `foo.nr`. We access `foo.nr` in many places, but most if not
      all other times we do so read-only, e.g., as we iterate over the array.
      But when we change `foo.nr` behind the array's back, it feels a bit
      nasty and looks like it might leak memory.
      
      Leaks happen if the popped element has an allocated `name` or `path`.
      At the moment, that is not the case. Still, 1) the object array might
      gain more fields that want to be freed, 2) a code path where we pop
      might start using names or paths, 3) one of these code paths might be
      copied to somewhere where we do, and 4) using a dedicated function for
      popping is conceptually cleaner.
      
      Introduce and use `object_array_pop()` instead. Release memory in the
      new function. Document that popping an object leaves the associated
      elements in limbo.
      
      The converted places were identified by grepping for "\.nr\>" and
      looking for "--".
      
      Make the new function return NULL on an empty array. This is consistent
      with `pop_commit()` and allows the following:
      
      	while ((o = object_array_pop(&foo)) != NULL) {
      		// do something
      	}
      
      But as noted above, we don't need to go out of our way to avoid reading
      `foo.nr`. This is probably more readable:
      
      	while (foo.nr) {
      		... o = object_array_pop(&foo);
      		// do something
      	}
      
      The name of `object_array_pop()` does not quite align with
      `add_object_array()`. That is unfortunate. On the other hand, it matches
      `object_array_clear()`. Arguably it's `add_...` that is the odd one out,
      since it reads like it's used to "add" an "object array". For that
      reason, side with `object_array_clear()`.
      Signed-off-by: NMartin Ågren <martin.agren@gmail.com>
      Reviewed-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      71992039
  16. 21 7月, 2017 1 次提交
  17. 17 6月, 2017 1 次提交
  18. 08 5月, 2017 6 次提交
    • B
      object: convert parse_object* to take struct object_id · c251c83d
      brian m. carlson 提交于
      Make parse_object, parse_object_or_die, and parse_object_buffer take a
      pointer to struct object_id.  Remove the temporary variables inserted
      earlier, since they are no longer necessary.  Transform all of the
      callers using the following semantic patch:
      
      @@
      expression E1;
      @@
      - parse_object(E1.hash)
      + parse_object(&E1)
      
      @@
      expression E1;
      @@
      - parse_object(E1->hash)
      + parse_object(E1)
      
      @@
      expression E1, E2;
      @@
      - parse_object_or_die(E1.hash, E2)
      + parse_object_or_die(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - parse_object_or_die(E1->hash, E2)
      + parse_object_or_die(E1, E2)
      
      @@
      expression E1, E2, E3, E4, E5;
      @@
      - parse_object_buffer(E1.hash, E2, E3, E4, E5)
      + parse_object_buffer(&E1, E2, E3, E4, E5)
      
      @@
      expression E1, E2, E3, E4, E5;
      @@
      - parse_object_buffer(E1->hash, E2, E3, E4, E5)
      + parse_object_buffer(E1, E2, E3, E4, E5)
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c251c83d
    • B
      Convert lookup_tag to struct object_id · d3101b53
      brian m. carlson 提交于
      Convert lookup_tag to take a pointer to struct object_id.
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d3101b53
    • B
      Convert lookup_tree to struct object_id · 740ee055
      brian m. carlson 提交于
      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: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      740ee055
    • B
      Convert lookup_blob to struct object_id · 3aca1fc6
      brian m. carlson 提交于
      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: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3aca1fc6
    • B
      Convert remaining callers of lookup_blob to object_id · 3e930981
      brian m. carlson 提交于
      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: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3e930981
    • B
      Convert lookup_commit* to struct object_id · bc83266a
      brian m. carlson 提交于
      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: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bc83266a
  19. 31 1月, 2017 1 次提交
    • R
      use SWAP macro · 35d803bc
      René Scharfe 提交于
      Apply the semantic patch swap.cocci to convert hand-rolled swaps to use
      the macro SWAP.  The resulting code is shorter and easier to read, the
      object code is effectively unchanged.
      
      The patch for object.c had to be hand-edited in order to preserve the
      comment before the change; Coccinelle tried to eat it for some reason.
      Signed-off-by: NRene Scharfe <l.s.r@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      35d803bc
  20. 20 11月, 2015 2 次提交