This project is mirrored from https://git.kernel.org/pub/scm/git/git.git. Updated .
  1. 27 Jun, 2019 2 commits
  2. 08 Apr, 2019 1 commit
  3. 24 Jan, 2019 1 commit
  4. 15 Jan, 2019 3 commits
  5. 29 Aug, 2018 1 commit
    • Jeff King's avatar
      convert "oidcmp() != 0" to "!oideq()" · 9001dc2a
      Jeff King authored
      This is the flip side of the previous two patches: checking
      for a non-zero oidcmp() can be more strictly expressed as
      inequality. Like those patches, we write "!= 0" in the
      coccinelle transformation, which covers by isomorphism the
      more common:
      
        if (oidcmp(E1, E2))
      
      As with the previous two patches, this patch can be achieved
      almost entirely by running "make coccicheck"; the only
      differences are manual line-wrap fixes to match the original
      code.
      
      There is one thing to note for anybody replicating this,
      though: coccinelle 1.0.4 seems to miss the case in
      builtin/tag.c, even though it's basically the same as all
      the others. Running with 1.0.7 does catch this, so
      presumably it's just a coccinelle bug that was fixed in the
      interim.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      9001dc2a
  6. 02 Aug, 2018 1 commit
    • Jeff King's avatar
      score_trees(): fix iteration over trees with missing entries · 2ec41507
      Jeff King authored
      In score_trees(), we walk over two sorted trees to find
      which entries are missing or have different content between
      the two.  So if we have two trees with these entries:
      
        one   two
        ---   ---
        a     a
        b     c
        c     d
      
      we'd expect the loop to:
      
        - compare "a" to "a"
      
        - compare "b" to "c"; because these are sorted lists, we
          know that the second tree does not have "b"
      
        - compare "c" to "c"
      
        - compare "d" to end-of-list; we know that the first tree
          does not have "d"
      
      And prior to d8febde3 (match-trees: simplify score_trees()
      using tree_entry(), 2013-03-24) that worked. But after that
      commit, we mistakenly increment the tree pointers for every
      loop iteration, even when we've processed the entry for only
      one side. As a result, we end up doing this:
      
        - compare "a" to "a"
      
        - compare "b" to "c"; we know that we do not have "b", but
          we still increment both tree pointers; at this point
          we're out of sync and all further comparisons are wrong
      
        - compare "c" to "d" and mistakenly claim that the second
          tree does not have "c"
      
        - exit the loop, mistakenly not realizing that the first
          tree does not have "d"
      
      So contrary to the claim in d8febde3, we really do need to
      manually use update_tree_entry(), because advancing the tree
      pointer depends on the entry comparison.
      
      That means we must stop using tree_entry() to access each
      entry, since it auto-advances the pointer. Instead:
      
        - we'll use tree_desc.size directly to know if there's
          anything left to look at (which is what tree_entry() was
          doing under the hood)
      
        - rather than do an extra struct assignment to "e1" and
          "e2", we can just access the "entry" field of tree_desc
          directly
      
      That makes us a little more intimate with the tree_desc
      code, but that's not uncommon for its callers.
      
      The included test shows off the bug by adding a new entry
      "bar.t", which sorts early in the tree and de-syncs the
      comparison for "foo.t", which comes after.
      Reported-by: George Shammas's avatarGeorge Shammas <georgyo@gmail.com>
      Helped-by: default avatarRené Scharfe <l.s.r@web.de>
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      2ec41507
  7. 16 May, 2018 1 commit
    • Stefan Beller's avatar
      object-store: move object access functions to object-store.h · cbd53a21
      Stefan Beller authored
      This should make these functions easier to find and cache.h less
      overwhelming to read.
      
      In particular, this moves:
      - read_object_file
      - oid_object_info
      - write_object_file
      
      As a result, most of the codebase needs to #include object-store.h.
      In this patch the #include is only added to files that would fail to
      compile otherwise.  It would be better to #include wherever
      identifiers from the header are used.  That can happen later
      when we have better tooling for it.
      Signed-off-by: Stefan Beller's avatarStefan Beller <sbeller@google.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      cbd53a21
  8. 14 Mar, 2018 2 commits
    • brian m. carlson's avatar
      sha1_file: convert read_sha1_file to struct object_id · b4f5aca4
      brian m. carlson authored
      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: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      b4f5aca4
    • brian m. carlson's avatar
      tree-walk: convert tree entry functions to object_id · 916bc35b
      brian m. carlson authored
      Convert get_tree_entry and find_tree_entry to take pointers to struct
      object_id.
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      916bc35b
  9. 30 Jan, 2018 2 commits
  10. 25 Apr, 2016 3 commits
  11. 19 Apr, 2016 1 commit
  12. 19 Jun, 2014 1 commit
  13. 10 Mar, 2014 1 commit
  14. 13 Jun, 2013 1 commit
  15. 25 Mar, 2013 1 commit
    • René Scharfe's avatar
      match-trees: simplify score_trees() using tree_entry() · d8febde3
      René Scharfe authored
      Convert the loop in score_trees() to tree_entry().  The code becomes
      shorter and simpler because the calls to update_tree_entry() are not
      needed any more.
      
      Another benefit is that we need less variables to track the current
      tree entries; as a side-effect of that the compiler has an easier
      job figuring out the control flow and thus can avoid false warnings
      about uninitialized variables.
      
      Using struct name_entry also allows the use of tree_entry_len() for
      finding the path length instead of strlen(), which may be slightly
      more efficient.
      
      Also unify the handling of missing entries in one of the two trees
      (i.e. added or removed files): Just set cmp appropriately first, no
      matter if we ran off the end of a tree or if we actually have two
      entries to compare, and check its value a bit later without
      duplicating the handler code.
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      d8febde3
  16. 18 Jan, 2010 1 commit
    • Junio C Hamano's avatar
      Make "subtree" part more orthogonal to the rest of merge-recursive. · 85e51b78
      Junio C Hamano authored
      This makes "subtree" more orthogonal to the rest of recursive merge, so
      that you can use subtree and ours/theirs features at the same time.  For
      example, you can now say:
      
      	git merge -s subtree -Xtheirs other
      
      to merge with "other" branch while shifting it up or down to match the
      shape of the tree of the current branch, and resolving conflicts favoring
      the changes "other" branch made over changes made in the current branch.
      
      It also allows the prefix used to shift the trees to be specified using
      the "-Xsubtree=$prefix" option.  Giving an empty prefix tells the command
      to figure out how much to shift trees automatically as we have always
      done.  "merge -s subtree" is the same as "merge -s recursive -Xsubtree="
      (or "merge -s recursive -Xsubtree").
      
      Based on an old patch done back in the days when git-merge was a script;
      Avery ported the script part to builtin-merge.c.  Bugs in shift_tree()
      is mine.
      Signed-off-by: default avatarAvery Pennarun <apenwarr@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      85e51b78
  17. 21 Oct, 2007 1 commit
  18. 07 Jun, 2007 1 commit
    • Junio C Hamano's avatar
      War on whitespace · a6080a0a
      Junio C Hamano authored
      This uses "git-apply --whitespace=strip" to fix whitespace errors that have
      crept in to our source files over time.  There are a few files that need
      to have trailing whitespaces (most notably, test vectors).  The results
      still passes the test, and build result in Documentation/ area is unchanged.
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      a6080a0a
  19. 07 Apr, 2007 1 commit
    • Junio C Hamano's avatar
      A new merge stragety 'subtree'. · 68faf689
      Junio C Hamano authored
      This merge strategy largely piggy-backs on git-merge-recursive.
      When merging trees A and B, if B corresponds to a subtree of A,
      B is first adjusted to match the tree structure of A, instead of
      reading the trees at the same level.  This adjustment is also
      done to the common ancestor tree.
      
      If you are pulling updates from git-gui repository into git.git
      repository, the root level of the former corresponds to git-gui/
      subdirectory of the latter.  The tree object of git-gui's toplevel
      is wrapped in a fake tree object, whose sole entry has name 'git-gui'
      and records object name of the true tree, before being used by
      the 3-way merge code.
      
      If you are merging the other way, only the git-gui/ subtree of
      git.git is extracted and merged into git-gui's toplevel.
      
      The detection of corresponding subtree is done by comparing the
      pathnames and types in the toplevel of the tree.
      
      Heuristics galore!  That's the git way ;-).
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      68faf689