1. 20 3月, 2012 1 次提交
    • C
      push: Provide situational hints for non-fast-forward errors · f25950f3
      Christopher Tiwald 提交于
      Pushing a non-fast-forward update to a remote repository will result in
      an error, but the hint text doesn't provide the correct resolution in
      every case. Give better resolution advice in three push scenarios:
      
      1) If you push your current branch and it triggers a non-fast-forward
      error, you should merge remote changes with 'git pull' before pushing
      again.
      
      2) If you push to a shared repository others push to, and your local
      tracking branches are not kept up to date, the 'matching refs' default
      will generate non-fast-forward errors on outdated branches. If this is
      your workflow, the 'matching refs' default is not for you. Consider
      setting the 'push.default' configuration variable to 'current' or
      'upstream' to ensure only your current branch is pushed.
      
      3) If you explicitly specify a ref that is not your current branch or
      push matching branches with ':', you will generate a non-fast-forward
      error if any pushed branch tip is out of date. You should checkout the
      offending branch and merge remote changes before pushing again.
      
      Teach transport.c to recognize these scenarios and configure push.c
      to hint for them. If 'git push's default behavior changes or we
      discover more scenarios, extension is easy. Standardize on the
      advice API and add three new advice variables, 'pushNonFFCurrent',
      'pushNonFFDefault', and 'pushNonFFMatching'. Setting any of these
      to 'false' will disable their affiliated advice. Setting
      'pushNonFastForward' to false will disable all three, thus preserving the
      config option for users who already set it, but guaranteeing new
      users won't disable push advice accidentally.
      Based-on-patch-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NChristopher Tiwald <christiwald@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f25950f3
  2. 17 1月, 2012 1 次提交
  3. 05 8月, 2011 1 次提交
  4. 30 1月, 2010 1 次提交
    • J
      Reword "detached HEAD" notification · 13be3e31
      Junio C Hamano 提交于
      The old "advice" message explained how to create a branch after going into
      a detached HEAD state but didn't make it clear why the user may want to do
      so.  Also "moving to ... which isn't a local branch" was unclear if it is
      complaining, if it is describing the new state, or if it is explaining why
      the HEAD is detached (the true reason is the last one).
      
      Give the established phrase 'detached HEAD' first to make it easy for
      users to look up the concept in documentation, and briefly describe what
      can be done in the state (i.e. play around without having to clean up)
      before telling the user how to keep what was done during the temporary
      state.
      
      Allow the long description to be hidden by setting advice.detachedHead
      configuration to false.
      
      We might want to customize the advice depending on how the commit to check
      out was spelled (e.g. instead of "new-branch-name", we way want to say
      "topic" when "git checkout origin/topic" triggered this message) in later
      updates, but this encapsulates that into a separate function and it should
      be a good first step.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      13be3e31
  5. 15 1月, 2010 1 次提交
    • J
      commit: allow suppression of implicit identity advice · b706fcfe
      Jeff King 提交于
      We now nag the user with a giant warning when their identity
      was pulled from the username, hostname, and gecos
      information, in case it is not correct. Most users will
      suppress this by simply setting up their information
      correctly.
      
      However, there may be some users who consciously want to use
      that information, because having the value change from host
      to host contains useful information. These users can now set
      advice.implicitidentity to false to suppress the message.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b706fcfe
  6. 13 1月, 2010 1 次提交
    • M
      Be more user-friendly when refusing to do something because of conflict. · d38a30df
      Matthieu Moy 提交于
      Various commands refuse to run in the presence of conflicts (commit,
      merge, pull, cherry-pick/revert). They all used to provide rough, and
      inconsistant error messages.
      
      A new variable advice.resolveconflict is introduced, and allows more
      verbose messages, pointing the user to the appropriate solution.
      
      For commit, the error message used to look like this:
      
      $ git commit
      foo.txt: needs merge
      foo.txt: unmerged (c34a92682e0394bc0d6f4d4a67a8e2d32395c169)
      foo.txt: unmerged (3afcd75de8de0bb5076942fcb17446be50451030)
      foo.txt: unmerged (c9785d77b76dfe4fb038bf927ee518f6ae45ede4)
      error: Error building trees
      
      The "need merge" line is given by refresh_cache. We add the IN_PORCELAIN
      option to make the output more consistant with the other porcelain
      commands, and catch the error in return, to stop with a clean error
      message. The next lines were displayed by a call to cache_tree_update(),
      which is not reached anymore if we noticed the conflict.
      
      The new output looks like:
      
      U       foo.txt
      fatal: 'commit' is not possible because you have unmerged files.
      Please, fix them up in the work tree, and then use 'git add/rm <file>' as
      appropriate to mark resolution and make a commit, or use 'git commit -a'.
      
      Pull is slightly modified to abort immediately if $GIT_DIR/MERGE_HEAD
      exists instead of waiting for merge to complain.
      
      The behavior of merge and the test-case are slightly modified to reflect
      the usual flow: start with conflicts, fix them, and afterwards get rid of
      MERGE_HEAD, with different error messages at each stage.
      Signed-off-by: NMatthieu Moy <Matthieu.Moy@imag.fr>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d38a30df
  7. 23 11月, 2009 1 次提交
  8. 12 9月, 2009 2 次提交