1. 21 3月, 2012 1 次提交
    • J
      merge: backport GIT_MERGE_AUTOEDIT support · d387868a
      Junio C Hamano 提交于
      Even though 1.7.9.x series does not open the editor by default
      when merging in general, it does do so in one occassion: when
      merging an annotated tag. And worse yet, there is no good way
      for older scripts to decline this.
      
      Backport the support for GIT_MERGE_AUTOEDIT environment variable
      from 1.7.10 track to help those stuck on 1.7.9.x maintenance
      track.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d387868a
  2. 10 2月, 2012 1 次提交
  3. 06 2月, 2012 1 次提交
    • J
      merge: do not create a signed tag merge under --ff-only option · b5c9f1c1
      Junio C Hamano 提交于
      Starting at release v1.7.9, if you ask to merge a signed tag, "git merge"
      always creates a merge commit, even when the tag points at a commit that
      happens to be a descendant of your current commit.
      
      Unfortunately, this interacts rather badly for people who use --ff-only to
      make sure that their branch is free of local developments. It used to be
      possible to say:
      
      	$ git checkout -b frotz v1.7.9~30
              $ git merge --ff-only v1.7.9
      
      and expect that the resulting tip of frotz branch matches v1.7.9^0 (aka
      the commit tagged as v1.7.9), but this fails with the updated Git with:
      
      	fatal: Not possible to fast-forward, aborting.
      
      because a merge that merges v1.7.9 tag to v1.7.9~30 cannot be created by
      fast forwarding.
      
      We could teach users that now they have to do
      
      	$ git merge --ff-only v1.7.9^0
      
      but it is far more pleasant for users if we DWIMmed this ourselves.
      
      When an integrator pulls in a topic from a lieutenant via a signed tag,
      even when the work done by the lieutenant happens to fast-forward, the
      integrator wants to have a merge record, so the integrator will not be
      asking for --ff-only when running "git pull" in such a case. Therefore,
      this change should not regress the support for the use case v1.7.9 wanted
      to add.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b5c9f1c1
  4. 01 2月, 2012 1 次提交
    • T
      merge: add instructions to the commit message when editing · f26af3fc
      Thomas Rast 提交于
      Before f8246281 (merge: use editor by default in interactive sessions,
      2012-01-10), git-merge only started an editor if the user explicitly
      asked for it with --edit.  Thus it seemed unlikely that the user would
      need extra guidance.
      
      After f8246281 the _normal_ thing is to start an editor.  Give at least
      an indication of why we are doing it.
      
      The sentence about justification is one of the few things about
      standard git that are not agnostic to the workflow that the user
      chose.  However, f8246281 was proposed by Linus specifically to
      discourage users from merging unrelated upstream progress into topic
      branches.  So we may as well take another step in the same direction.
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f26af3fc
  5. 16 12月, 2011 2 次提交
  6. 14 12月, 2011 1 次提交
  7. 06 12月, 2011 1 次提交
    • N
      Copy resolve_ref() return value for longer use · d5a35c11
      Nguyễn Thái Ngọc Duy 提交于
      resolve_ref() may return a pointer to a static buffer. Callers that
      use this value longer than a couple of statements should copy the
      value to avoid some hidden resolve_ref() call that may change the
      static buffer's value.
      
      The bug found by Tony Wang <wwwjfy@gmail.com> in builtin/merge.c
      demonstrates this. The first call is in cmd_merge()
      
      branch = resolve_ref("HEAD", head_sha1, 0, &flag);
      
      Then deep in lookup_commit_or_die() a few lines after, resolve_ref()
      may be called again and destroy "branch".
      
      lookup_commit_or_die
       lookup_commit_reference
        lookup_commit_reference_gently
         parse_object
          lookup_replace_object
           do_lookup_replace_object
            prepare_replace_object
             for_each_replace_ref
              do_for_each_ref
               get_loose_refs
                get_ref_dir
                 get_ref_dir
                  resolve_ref
      
      All call sites are checked and made sure that xstrdup() is called if
      the value should be saved.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d5a35c11
  8. 29 11月, 2011 2 次提交
  9. 22 11月, 2011 1 次提交
    • V
      Show error for 'git merge' with unset merge.defaultToUpstream · 5480207c
      Vincent van Ravesteijn 提交于
      'git merge' can be called without any arguments if merge.defaultToUpstream
      is set. However, when merge.defaultToUpstream is not set, the user will be
      presented the usage information as if he entered a command with a wrong
      syntaxis. Ironically, the usage information confirms that no arguments are
      mandatory.
      
      This adds a proper error message telling the user why the command failed. As
      a side-effect this can help the user in discovering the possibility to merge
      with the upstream branch by setting merge.defaultToUpstream.
      Signed-off-by: NVincent van Ravesteijn <vfr@lyx.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5480207c
  10. 18 11月, 2011 1 次提交
    • J
      do not let git_path clobber errno when reporting errors · 418c9b17
      Jonathan Nieder 提交于
      Because git_path() calls vsnprintf(), code like
      
      	fd = open(git_path("SQUASH_MSG"), O_WRONLY | O_CREAT, 0666);
      	die_errno(_("Could not write to '%s'"), git_path("SQUASH_MSG"));
      
      can end up printing an error indicator from vsnprintf() instead of
      open() by mistake.  Store the path we are trying to write to in a
      temporary variable and pass _that_ to die_errno(), so the messages
      written by git cherry-pick/revert and git merge can avoid this source
      of confusion.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      418c9b17
  11. 14 11月, 2011 1 次提交
  12. 13 11月, 2011 1 次提交
    • J
      commit: teach --gpg-sign option · ba3c69a9
      Junio C Hamano 提交于
      This uses the gpg-interface.[ch] to allow signing the commit, i.e.
      
          $ git commit --gpg-sign -m foo
          You need a passphrase to unlock the secret key for
          user: "Junio C Hamano <gitster@pobox.com>"
          4096-bit RSA key, ID 96AFE6CB, created 2011-10-03 (main key ID 713660A7)
      
          [master 8457d13] foo
           1 files changed, 1 insertions(+), 0 deletions(-)
      
      The lines of GPG detached signature are placed in a new multi-line header
      field, instead of tucking the signature block at the end of the commit log
      message text (similar to how signed tag is done), for multiple reasons:
      
       - The signature won't clutter output from "git log" and friends if it is
         in the extra header. If we place it at the end of the log message, we
         would need to teach "git log" and friends to strip the signature block
         with an option.
      
       - Teaching new versions of "git log" and "gitk" to optionally verify and
         show signatures is cleaner if we structurally know where the signature
         block is (instead of scanning in the commit log message).
      
       - The signature needs to be stripped upon various commit rewriting
         operations, e.g. rebase, filter-branch, etc. They all already ignore
         unknown headers, but if we place signature in the log message, all of
         these tools (and third-party tools) also need to learn how a signature
         block would look like.
      
       - When we added the optional encoding header, all the tools (both in tree
         and third-party) that acts on the raw commit object should have been
         fixed to ignore headers they do not understand, so it is not like that
         new header would be more likely to break than extra text in the commit.
      
      A commit made with the above sample sequence would look like this:
      
          $ git cat-file commit HEAD
          tree 3cd71d90e3db4136e5260ab54599791c4f883b9d
          parent b87755351a47b09cb27d6913e6e0e17e6254a4d4
          author Junio C Hamano <gitster@pobox.com> 1317862251 -0700
          committer Junio C Hamano <gitster@pobox.com> 1317862251 -0700
          gpgsig -----BEGIN PGP SIGNATURE-----
           Version: GnuPG v1.4.10 (GNU/Linux)
      
           iQIcBAABAgAGBQJOjPtrAAoJELC16IaWr+bL4TMP/RSe2Y/jYnCkds9unO5JEnfG
           ...
           =dt98
           -----END PGP SIGNATURE-----
      
          foo
      
      but "git log" (unless you ask for it with --pretty=raw) output is not
      cluttered with the signature information.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ba3c69a9
  13. 10 11月, 2011 1 次提交
  14. 09 11月, 2011 2 次提交
    • J
      merge: record tag objects without peeling in MERGE_HEAD · 274a5c06
      Junio C Hamano 提交于
      Otherwise, "git commit" wouldn't have a way to tell that we were in the
      middle of merging an annotated or signed tag, not a plain commit, after
      "git merge" stops to ask the user to resolve conflicts.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      274a5c06
    • J
      merge: make usage of commit->util more extensible · ae8e4c9c
      Junio C Hamano 提交于
      The merge-recursive code uses the commit->util field directly to annotate
      the commit objects given from the command line, i.e. the remote heads to
      be merged, with a single string to be used to describe it in its trace
      messages and conflict markers.
      
      Correct this short-signtedness by redefining the field to be a pointer to
      a structure "struct merge_remote_desc" that later enhancements can add
      more information. Store the original objects we were told to merge in a
      field "obj" in this struct, so that we can recover the tag we were told to
      merge.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ae8e4c9c
  15. 08 11月, 2011 2 次提交
  16. 13 10月, 2011 1 次提交
    • J
      Teach merge the '[-e|--edit]' option · 66f4b98a
      Jay Soffian 提交于
      Implemented internally instead of as "git merge --no-commit && git commit"
      so that "merge --edit" is otherwise consistent (hooks, etc) with "merge".
      
      Note: the edit message does not include the status information that one
      gets with "commit --status" and it is cleaned up after editing like one
      gets with "commit --cleanup=default". A later patch could add the status
      information if desired.
      
      Note: previously we were not calling stripspace() after running the
      prepare-commit-msg hook. Now we are, stripping comments and
      leading/trailing whitespace lines if --edit is given, otherwise only
      stripping leading/trailing whitespace lines if not given --edit.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      66f4b98a
  17. 08 10月, 2011 1 次提交
    • J
      fmt-merge-msg: use branch.$name.description · 898eacd8
      Junio C Hamano 提交于
      This teaches "merge --log" and fmt-merge-msg to use branch description
      information when merging a local topic branch into the mainline. The
      description goes between the branch name label and the list of commit
      titles.
      
      The refactoring to share the common configuration parsing between
      merge and fmt-merge-msg needs to be made into a separate patch.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      898eacd8
  18. 19 9月, 2011 3 次提交
  19. 16 9月, 2011 1 次提交
    • J
      Allow git merge ":/<pattern>" · 6099835c
      Junio C Hamano 提交于
      It probably is not such a good idea to use ":/<pattern>" to specify which
      commit to merge, as ":/<pattern>" can often hit unexpected commits, but
      somebody tried it and got a nonsense error message:
      
      	fatal: ':/Foo bar' does not point to a commit
      
      So here is a for-the-sake-of-consistency update that is fairly useless
      that allows users to carefully try not shooting in the foot.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6099835c
  20. 27 8月, 2011 1 次提交
  21. 20 8月, 2011 1 次提交
    • J
      want_color: automatically fallback to color.ui · c9bfb953
      Jeff King 提交于
      All of the "do we want color" flags default to -1 to
      indicate that we don't have any color configured. This value
      is handled in one of two ways:
      
        1. In porcelain, we check early on whether the value is
           still -1 after reading the config, and set it to the
           value of color.ui (which defaults to 0).
      
        2. In plumbing, it stays untouched as -1, and want_color
           defaults it to off.
      
      This works fine, but means that every porcelain has to check
      and reassign its color flag. Now that want_color gives us a
      place to put this check in a single spot, we can do that,
      simplifying the calling code.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c9bfb953
  22. 19 8月, 2011 1 次提交
    • J
      diff: refactor COLOR_DIFF from a flag into an int · f1c96261
      Jeff King 提交于
      This lets us store more than just a bit flag for whether we
      want color; we can also store whether we want automatic
      colors. This can be useful for making the automatic-color
      decision closer to the point of use.
      
      This mostly just involves replacing DIFF_OPT_* calls with
      manipulations of the flag. The biggest exception is that
      calls to DIFF_OPT_TST must check for "o->use_color > 0",
      which lets an "unknown" value (i.e., the default) stay at
      "no color". In the previous code, a value of "-1" was not
      propagated at all.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f1c96261
  23. 27 5月, 2011 1 次提交
    • J
      clean up calling conventions for pretty.c functions · 6bf13944
      Jeff King 提交于
      We have a pretty_print_context representing the parameters
      for a pretty-print session, but we did not use it uniformly.
      As a result, functions kept growing more and more arguments.
      
      Let's clean this up in a few ways:
      
        1. All pretty-print pp_* functions now take a context.
           This lets us reduce the number of arguments to these
           functions, since we were just passing around the
           context values separately.
      
        2. The context argument now has a cmit_fmt field, which
           was passed around separately. That's one less argument
           per function.
      
        3. The context argument always comes first, which makes
           calling a little more uniform.
      
      This drops lines from some callers, and adds lines in a few
      places (because we need an extra line to set the context's
      fmt field). Overall, we don't save many lines, but the lines
      that are there are a lot simpler and more readable.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6bf13944
  24. 26 5月, 2011 1 次提交
  25. 17 5月, 2011 1 次提交
  26. 07 5月, 2011 1 次提交
  27. 12 4月, 2011 3 次提交
  28. 08 4月, 2011 1 次提交
    • J
      merge: allow "-" as a short-hand for "previous branch" · 4e8115ff
      Junio C Hamano 提交于
      Just like "git checkout -" is a short-hand for "git checkout @{-1}" to
      conveniently switch back to the previous branch, "git merge -" is a
      short-hand for "git merge @{-1}" to conveniently merge the previous branch.
      
      It will allow me to say:
      
          $ git checkout -b au/topic
          $ git am -s ./+au-topic.mbox
          $ git checkout pu
          $ git merge -
      
      which is an extremely typical and repetitive operation during my git day.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4e8115ff
  29. 26 3月, 2011 1 次提交
    • J
      merge: merge unborn index before setting ref · 97b1b4f3
      Jeff King 提交于
      When we merge into an unborn branch, there are basically two
      steps:
      
        1. Write the sha1 of the new commit into the ref pointed
           to by HEAD.
      
        2. Update the index with the new content, and check it out
           to the working tree.
      
      We currently do them in this order. However, (2) is the step
      that is much more likely to fail, since it can be blocked by
      things like untracked working tree files. When it does, the
      merge fails and we are left with an empty index but an
      updated HEAD.
      
      This patch switches the order, so that a failure in updating
      the index leaves us unchanged. Of course, a failure in
      updating the ref now leaves us with an updated index and
      mis-matched HEAD. That is arguably not much better, but it
      is probably less likely to actually happen.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      97b1b4f3
  30. 24 3月, 2011 2 次提交
  31. 10 3月, 2011 1 次提交