1. 07 5月, 2010 1 次提交
    • J
      test-lib: some shells do not let $? propagate into an eval · b6b0afdc
      Jonathan Nieder 提交于
      In 3bf78867 (test-lib: Let tests specify commands to be run at end of
      test, 2010-05-02), the git test harness learned to run cleanup
      commands unconditionally at the end of a test.  During each test,
      the intended cleanup actions are collected in the test_cleanup variable
      and evaluated.  That variable looks something like this:
      
      	eval_ret=$?; clean_something && (exit "$eval_ret")
      	eval_ret=$?; clean_something_else && (exit "$eval_ret")
      	eval_ret=$?; final_cleanup && (exit "$eval_ret")
      	eval_ret=$?
      
      All cleanup actions are run unconditionally but if one of them fails
      it is properly reported through $eval_ret.
      
      On FreeBSD, unfortunately, $? is set at the beginning of an ‘eval’
      to 0 instead of the exit status of the previous command.  This results
      in tests using test_expect_code appearing to fail and all others
      appearing to pass, unless their cleanup fails.  Avoid the problem by
      setting eval_ret before the ‘eval’ begins.
      
      Thanks to Jeff King for the explanation.
      
      Cc: Jeff King <peff@peff.net>
      Cc: Johannes Sixt <j6t@kdbg.org>
      Acked-by: NJeff King <peff@peff.net>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b6b0afdc
  2. 05 5月, 2010 3 次提交
  3. 20 4月, 2010 1 次提交
  4. 19 4月, 2010 1 次提交
  5. 18 4月, 2010 3 次提交
  6. 12 4月, 2010 1 次提交
  7. 11 4月, 2010 1 次提交
    • J
      Teach diff --submodule and status to handle .git files in submodules · eee49b6c
      Jens Lehmann 提交于
      The simple test for an existing .git directory gives an incorrect result
      if .git is a file that records "gitdir: overthere". So for submodules that
      use a .git file, "git status" and the diff family - when the "--submodule"
      option is given - did assume the submodule was not populated at all when
      a .git file was used, thus generating wrong output or no output at all.
      
      This is fixed by using read_gitfile_gently() to get the correct location
      of the .git directory. While at it, is_submodule_modified() was cleaned up
      to use the "dir" member of "struct child_process" instead of setting the
      GIT_WORK_TREE and GIT_DIR environment variables.
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eee49b6c
  8. 30 3月, 2010 3 次提交
  9. 29 3月, 2010 3 次提交
  10. 25 3月, 2010 5 次提交
  11. 22 3月, 2010 1 次提交
  12. 21 3月, 2010 8 次提交
    • J
      cherry-pick, revert: add a label for ancestor · bf975d37
      Jonathan Nieder 提交于
      When writing conflict hunks in ‘diff3 -m’ format, also add a label to
      the common ancestor.  Especially in a cherry-pick, it is not immediately
      obvious without such a label what the common ancestor represents.
      
      git rerere does not have trouble parsing the new output and its preimage
      ids are unchanged since it includes its own code for recreating conflict
      hunks.  No other code in git parses conflict hunks.
      Requested-by: NStefan Monnier <monnier@iro.umontreal.ca>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bf975d37
    • J
      revert: clarify label on conflict hunks · d6856540
      Jonathan Nieder 提交于
      When reverting a commit, the commit being merged is not the commit
      to revert itself but its parent.  Add “parent of” to the conflict
      hunk label to make this more clear.
      
      The conflict hunk labels are all pieces of a single string written in
      the new get_message() function.  Avoid some complication by using
      mempcpy to advance a pointer as the result is written.
      
      Also free the corresponding temporary buffer (it was leaked before).
      This is not important because it is a small one-time allocation.  It
      would become a memory leak if unnoticed when libifying revert.
      
      This patch uses calls to strlen() instead of integer constants in some
      places.  GCC will compute the length at compile time; I am not sure
      about other compilers, but this is not performance-critical anyway.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d6856540
    • J
      checkout -m --conflict=diff3: add a label for ancestor · c4151629
      Jonathan Nieder 提交于
      git checkout --merge --conflict=diff3 can be used to present conflict
      hunks including text from the common ancestor.  The added information
      is helpful for resolving a merge by hand, and merge tools tend to
      understand it because it is very similar to what ‘diff3 -m’ produces.
      
      Unlike current git, diff3 -m includes a label for the merge base on
      the ||||||| line, and unfortunately, some tools cannot parse the
      conflict hunks without it.  Humans can benefit from a cue when
      learning to interpreting the format, too.  Mark the start of the text
      from the old branch with a label based on the branch’s name.
      
      git rerere does not have trouble parsing this output and its preimage
      ids are unchanged since it includes its own code for recreating
      conflict hunks.  No other code in git tries to parse conflict hunks.
      Requested-by: NStefan Monnier <monnier@iro.umontreal.ca>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c4151629
    • J
      checkout --conflict=diff3: add a label for ancestor · f0531a29
      Jonathan Nieder 提交于
      git checkout --conflict=diff3 can be used to present conflicts hunks
      including text from the common ancestor:
      
      	<<<<<<< ours
      	ourside
      	|||||||
      	original
      	=======
      	theirside
      	>>>>>>> theirs
      
      The added information is helpful for resolving a merge by hand, and
      merge tools can usually understand it without trouble because it looks
      like output from ‘diff3 -m’.
      
      diff3 includes a label for the merge base on the ||||||| line, and it
      seems some tools (for example, Emacs 22’s smerge-mode) cannot parse
      conflict hunks without such a label.  Humans could use help in
      interpreting the output, too.  So change the marker for the start of the
      text from the common ancestor to include the label “base”.
      
      git rerere’s conflict identifiers are not affected: to parse conflict
      hunks, rerere looks for whitespace after the ||||||| marker rather
      than a newline, and to compute preimage ids, rerere has its own code
      for creating conflict hunks.  No other code in git tries to parse
      conflict hunks.
      Requested-by: NStefan Monnier <monnier@iro.umontreal.ca>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f0531a29
    • J
      merge-file --diff3: add a label for ancestor · 4bb09362
      Jonathan Nieder 提交于
      git merge-file --diff3 can be used to present conflicts hunks
      including text from the common ancestor.
      
      The added information is helpful for resolving a merge by hand, and
      merge tools can usually grok it because it looks like output from
      diff3 -m.  However, ‘diff3’ includes a label for the merge base on the
      ||||||| line and some tools cannot parse conflict hunks without such a
      label.  Write the base-name as passed in a -L option (or the name of
      the ancestor file by default) on that line.
      
      git rerere will not have trouble parsing this output, since instead of
      looking for a newline, it looks for whitespace after the |||||||
      marker.  Since rerere includes its own code for recreating conflict
      hunks, conflict identifiers are unaffected.  No other code in git tries
      to parse conflict hunks.
      Requested-by: NStefan Monnier <monnier@iro.umontreal.ca>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4bb09362
    • J
      tests: document cherry-pick behavior in face of conflicts · 6a843348
      Jonathan Nieder 提交于
      We are about to change the format of the conflict hunks that
      cherry-pick and revert write.  Add tests checking the current behavior
      first.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6a843348
    • J
      tests: document format of conflicts from checkout -m · 47349a8c
      Jonathan Nieder 提交于
      We are about to change the format of the conflict hunks that ‘checkout
      --merge’ writes.  Add tests checking the current behavior first.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      47349a8c
    • B
      Use test_expect_success for test setups · 4a45f7dd
      Brian Gernhardt 提交于
      Several tests did not use test_expect_success for their setup
      commands.  Putting these start commands into the testing framework
      means both that errors during setup will be caught quickly and that
      non-error text will be suppressed without -v.
      Signed-off-by: NBrian Gernhardt <brian@gernhardtsoftware.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4a45f7dd
  13. 20 3月, 2010 3 次提交
  14. 17 3月, 2010 5 次提交
  15. 16 3月, 2010 1 次提交
    • J
      refs: ref entry with NULL sha1 is can be a dangling symref · e01de1c9
      Junio C Hamano 提交于
      Brandon Casey noticed that t5505 had accidentally broken its && chain,
      hiding inconsistency between the code that writes the warning to the
      standard output and the test that expects to see the warning on the
      standard error, which was introduced by f8948e2f (remote prune: warn
      dangling symrefs, 2009-02-08).
      
      It turns out that the issue is deeper than that.  After f8948e2f, a symref
      that is dangling is marked with a NULL sha1, and the idea of using NULL
      sha1 to mean a deleted ref was scrapped, but somehow a follow-up eafb4526
      (do_one_ref(): null_sha1 check is not about broken ref, 2009-07-22)
      incorrectly reorganized do_one_ref(), still thinking NULL sha1 is never
      used in the code.
      
      Fix this by:
      
       - adopt Brandon's fix to t5505 test;
      
       - introduce REF_BROKEN flag to mark a ref that fails to resolve (dangling
         symref);
      
       - move the check for broken ref back inside the "if we are skipping
         dangling refs" code block.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e01de1c9