1. 30 4月, 2015 12 次提交
    • J
    • J
      52fecab2
    • J
      merge: narrow scope of merge_names · 018b3fbc
      Junio C Hamano 提交于
      In order to pass the list of parents to fmt_merge_msg(), cmd_merge()
      uses this strbuf to create something that look like FETCH_HEAD that
      describes commits that are being merged.  This is necessary only
      when we are creating the merge commit message ourselves, but was
      done unconditionally.
      
      Move the variable and the logic to populate it to confine them in a
      block that needs them.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      018b3fbc
    • J
      merge: split reduce_parents() out of collect_parents() · 34349dbf
      Junio C Hamano 提交于
      The latter does two separate things:
      
       - Parse the list of commits on the command line, and formulate the
         list of commits to be merged (including the current HEAD);
      
       - Compute the list of parents to be recorded in the resulting merge
         commit.
      
      Split the latter into a separate helper function, so that we can
      later supply the list commits to be merged from a different source
      (namely, FETCH_HEAD).
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      34349dbf
    • J
      merge: clarify collect_parents() logic · 0b10b8a3
      Junio C Hamano 提交于
      Clarify this small function in three ways.
      
       - The function initially collects all commits to be merged into a
         commit_list "remoteheads"; the "remotes" pointer always points at
         the tail of this list (either the remoteheads variable itself, or
         the ->next slot of the element at the end of the list) to help
         elongate the list by repeated calls to commit_list_insert().
         Because the new element appended by commit_list_insert() will
         always have its ->next slot NULLed out, there is no need for us
         to assign NULL to *remotes to terminate the list at the end.
      
       - The variable "head_subsumed" always confused me every time I read
         this code.  What is happening here is that we inspect what the
         caller told us to merge (including the current HEAD) and come up
         with the list of parents to be recorded for the resulting merge
         commit, omitting commits that are ancestor of other commits.
         This filtering may remove the current HEAD from the resulting
         parent list---and we signal that fact with this variable, so that
         we can later record it as the first parent when "--no-ff" is in
         effect.
      
       - The "parents" list is created for this function by reduce_heads()
         and was not deallocated after its use, even though the loop
         control was written in such a way to allow us to do so by taking
         the "next" element in a separate variable so that it can be used
         in the next-step part of the loop control.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0b10b8a3
    • J
      merge: small leakfix and code simplification · 1016658d
      Junio C Hamano 提交于
      When parsing a merged object name like "foo~20" to formulate a merge
      summary "Merge branch foo (early part)", a temporary strbuf is used,
      but we forgot to deallocate it when we failed to find the named
      branch.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1016658d
    • J
      merge: do not check argc to determine number of remote heads · eaa4e59c
      Junio C Hamano 提交于
      To reject merging multiple commits into an unborn branch, we check
      argc, thinking that collect_parents() that reads the remaining
      command line arguments from <argc, argv> will give us the same
      number of commits as its input, i.e. argc.
      
      Because what we really care about is the number of commits, let the
      function run and then make sure it returns only one commit instead.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eaa4e59c
    • J
      merge: clarify "pulling into void" special case · 1faac1ce
      Junio C Hamano 提交于
      Instead of having it as one of the three if/elseif/.. case arms,
      test the condition and handle this special case upfront.  This makes
      it easier to follow the flow of logic.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1faac1ce
    • J
      t5520: test pulling an octopus into an unborn branch · 7ad39a27
      Junio C Hamano 提交于
      The code comment for "git merge" in builtin/merge.c, we say
      
          If the merged head is a valid one there is no reason
          to forbid "git merge" into a branch yet to be born.
          We do the same for "git pull".
      
      and t5520 does have an existing test for that behaviour.  However,
      there was no test to make sure that 'git pull' to pull multiple
      branches into an unborn branch must fail.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7ad39a27
    • J
      t5520: style fixes · 55691133
      Junio C Hamano 提交于
      Fix style funnies in early part of this test script that checks "git
      pull" into an unborn branch.  The primary change is that 'chdir' to
      a newly created empty test repository is now protected by being done
      in a subshell to make it more robust without having to chdir back to
      the original place.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      55691133
    • J
      merge: simplify code flow · 00c7e7e7
      Junio C Hamano 提交于
      One of the first things cmd_merge() does is to see if the "--abort"
      option is given and run "reset --merge" and exit.  When the control
      reaches this point, we know "--abort" was not given.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      00c7e7e7
    • J
      merge: test the top-level merge driver · 9e62316d
      Junio C Hamano 提交于
      We seem to have tests for specific merge strategy backends
      (e.g. recursive), but not much test coverage for the "git merge"
      itself.  As I am planning to update the semantics of merging
      "FETCH_HEAD" in such a way that these two
      
          git pull . topic_a topic_b...
      
      vs.
      
          git fetch . topic_a topic_b...
          git merge FETCH_HEAD
      
      are truly equivalent, let me add a few test cases to cover the
      tricky ones.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9e62316d
  2. 13 1月, 2015 7 次提交
  3. 08 1月, 2015 5 次提交
  4. 30 12月, 2014 1 次提交
    • J
      is_hfs_dotgit: loosen over-eager match of \u{..47} · 6aaf956b
      Jeff King 提交于
      Our is_hfs_dotgit function relies on the hackily-implemented
      next_hfs_char to give us the next character that an HFS+
      filename comparison would look at. It's hacky because it
      doesn't implement the full case-folding table of HFS+; it
      gives us just enough to see if the path matches ".git".
      
      At the end of next_hfs_char, we use tolower() to convert our
      32-bit code point to lowercase. Our tolower() implementation
      only takes an 8-bit char, though; it throws away the upper
      24 bits. This means we can't have any false negatives for
      is_hfs_dotgit. We only care about matching 7-bit ASCII
      characters in ".git", and we will correctly process 'G' or
      'g'.
      
      However, we _can_ have false positives. Because we throw
      away the upper bits, code point \u{0147} (for example) will
      look like 'G' and get downcased to 'g'. It's not known
      whether a sequence of code points whose truncation ends up
      as ".git" is meaningful in any language, but it does not
      hurt to be more accurate here. We can just pass out the full
      32-bit code point, and compare it manually to the upper and
      lowercase characters we care about.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6aaf956b
  5. 23 12月, 2014 13 次提交
  6. 18 12月, 2014 2 次提交
    • J
      Git 2.2.1 · 9b7cbb31
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9b7cbb31
    • J
      Sync with v2.1.4 · 77933f44
      Junio C Hamano 提交于
      * maint-2.1:
        Git 2.1.4
        Git 2.0.5
        Git 1.9.5
        Git 1.8.5.6
        fsck: complain about NTFS ".git" aliases in trees
        read-cache: optionally disallow NTFS .git variants
        path: add is_ntfs_dotgit() helper
        fsck: complain about HFS+ ".git" aliases in trees
        read-cache: optionally disallow HFS+ .git variants
        utf8: add is_hfs_dotgit() helper
        fsck: notice .git case-insensitively
        t1450: refactor ".", "..", and ".git" fsck tests
        verify_dotfile(): reject .git case-insensitively
        read-tree: add tests for confusing paths like ".." and ".git"
        unpack-trees: propagate errors adding entries to the index
      77933f44