1. 09 3月, 2008 2 次提交
  2. 18 2月, 2008 1 次提交
  3. 16 2月, 2008 1 次提交
    • J
      commit: discard index after setting up partial commit · 959ba670
      Jeff King 提交于
      There may still be some entries from the original index that
      should be discarded before we show the status. In
      particular, if a file was added in the index but not
      included in the partial commit, it would still show up in
      the status listing as staged for commit.
      
      Ultimately the correct fix is to keep the two states in
      separate index_state variables. Then we can avoid having
      to reload the cache from the temporary file altogether, and
      just point wt_status_print at the correct index.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      959ba670
  4. 12 2月, 2008 2 次提交
  5. 10 2月, 2008 1 次提交
  6. 06 2月, 2008 4 次提交
    • P
      git-commit: add a prepare-commit-msg hook · 8089c85b
      Paolo Bonzini 提交于
      The prepare-commit-msg hook is run whenever a "fresh" commit message
      is prepared, just before it is shown in the editor (if it is).
      Its purpose is to modify the commit message in-place.
      
      It takes one to three parameters.  The first is the name of the file that
      the commit log message.  The second is the source of the commit message,
      and can be: "message" (if a -m or -F option was given); "template" (if a
      -t option was given or the configuration option commit.template is set);
      "merge" (if the commit is a merge or a .git/MERGE_MSG file exists);
      "squash" (if a .git/SQUASH_MSG file exists); or "commit", followed by
      a commit SHA1 as the third parameter (if a -c, -C or --amend option
      was given).
      
      If its exit status is non-zero, git-commit will abort.  The hook is
      not suppressed by the --no-verify option, so it should not be used
      as a replacement for the pre-commit hook.
      
      The sample prepare-commit-msg comments out the `Conflicts:` part of
      a merge's commit message; other examples are commented out, including
      adding a Signed-off-by line at the bottom of the commit messsage,
      that the user can then edit or discard altogether.
      Signed-off-by: NPaolo Bonzini <bonzini@gnu.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8089c85b
    • P
      git-commit: Refactor creation of log message. · ec84bd00
      Paolo Bonzini 提交于
      This patch moves the code of run_commit, up to writing the trees, editing
      the message and running the commit-msg hook to prepare_log_message.  It also
      renames the latter to prepare_to_commit.
      
      This simplifies a little the code for the next patch.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ec84bd00
    • P
      git-commit: set GIT_EDITOR=: if editor will not be launched · 406400ce
      Paolo Bonzini 提交于
      This is a preparatory patch that provides a simple way for the future
      prepare-commit-msg hook to discover if the editor will be launched.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      406400ce
    • P
      git-commit: support variable number of hook arguments · 3473f303
      Paolo Bonzini 提交于
      This is a preparatory patch to allow using run_hook for the
      prepare-commit-msg hook.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3473f303
  7. 03 2月, 2008 1 次提交
  8. 24 1月, 2008 1 次提交
    • B
      git-commit: exit non-zero if we fail to commit the index · 5a9dd399
      Brandon Casey 提交于
      In certain rare cases, the creation of the commit object
      and update of HEAD can succeed, but then installing the
      updated index will fail. This is most likely caused by a
      full disk or exceeded disk quota. When this happens the
      new index file will be removed, and the repository will
      be left with the original now-out-of-sync index. The
      user can recover with a "git reset HEAD" once the disk
      space issue is resolved.
      
      We should detect this failure and offer the user some
      helpful guidance.
      Signed-off-by: NBrandon Casey <casey@nrlssc.navy.mil>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5a9dd399
  9. 22 1月, 2008 1 次提交
    • L
      Make on-disk index representation separate from in-core one · 7a51ed66
      Linus Torvalds 提交于
      This converts the index explicitly on read and write to its on-disk
      format, allowing the in-core format to contain more flags, and be
      simpler.
      
      In particular, the in-core format is now host-endian (as opposed to the
      on-disk one that is network endian in order to be able to be shared
      across machines) and as a result we can dispense with all the
      htonl/ntohl on accesses to the cache_entry fields.
      
      This will make it easier to make use of various temporary flags that do
      not exist in the on-disk format.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7a51ed66
  10. 17 1月, 2008 2 次提交
  11. 16 1月, 2008 1 次提交
    • K
      git-commit: fix double close(2) that can close a wrong file descriptor · 4439751d
      Kristian Høgsberg 提交于
      The codepath to prepare index files for the temporary and next
      index file was closing file descriptor it obtained from the
      lockfile API by hand, without letting the API know that the fd
      should not be doubly closed.
      
      This is not usually a problem (except it may get EBADFD) but if
      we opened another fd for an entirely unrelated purpose (say, an
      fd used to mmap a packfile) between the time we close the fd to
      the index file and the time we commit or rollback the lockfile
      (causing it to also try closing the recorded fd), the lockfile
      API will close an incorrect file descriptor that is still used
      for an entirely unrelated purpose.
      
      There's four close(fd) calls in prepare_index() and they're all
      incorrect.  The open fd's are cleaned up in rollback_index_files() and
      shouldn't be closed manually.  The patch below gets rid of the extra
      close() calls and should fix the problem.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4439751d
  12. 15 1月, 2008 1 次提交
    • J
      Revert "builtin-commit.c: remove useless check added by faulty cut and paste" · e87e22d0
      Junio C Hamano 提交于
      This reverts commit 16335fdd.
      
      We are calling overlay_tree_on_cache() which does use CE_UPDATE
      flag to mark duplicated entries, which is the same as the
      codepath in git-ls-files with its --with-tree option.
      
      Because the pathname ce->name is given to path_list_insert()
      which does not allow duplicates, there is no breakage either way
      from the correctness point of view in this codepath, unlike the
      one in ls-files.  But avoiding unnecessary processing with a
      single bit check is certainly better.
      e87e22d0
  13. 14 1月, 2008 1 次提交
  14. 13 1月, 2008 1 次提交
  15. 23 12月, 2007 3 次提交
    • A
      Allow selection of different cleanup modes for commit messages · 5f065737
      Alex Riesen 提交于
      Although we traditionally stripped away excess blank lines, trailing
      whitespaces and lines that begin with "#" from the commit log message,
      sometimes the message just has to be the way user wants it.
      
      For instance, a commit message template can contain lines that begin with
      "#", the message must be kept as close to its original source as possible
      if you are converting from a foreign SCM, or maybe the message has a shell
      script including its comments for future reference.
      
      The cleanup modes are default, verbatim, whitespace and strip. The
      default mode depends on if the message is being edited and will either
      strip whitespace and comments (if editor active) or just strip the
      whitespace (for where the message is given explicitely).
      Signed-off-by: NAlex Riesen <raa.lkml@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5f065737
    • J
      builtin-commit: avoid double-negation in the code. · 4803466f
      Junio C Hamano 提交于
      The flag no_edit meant "we have got final message from the user
      and will not editing it any further", but there were quite a few
      places that needed to check !no_edit.  Rename the variable to
      use_editor and reverse the logic everywhere.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4803466f
    • J
      builtin-commit: fix amending of the initial commit · d616a239
      Junio C Hamano 提交于
      When amending initial commit without editor, the command
      incorrectly barfed because the check to see if there is anything
      to commit referenced the non-existent HEAD^1.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d616a239
  16. 20 12月, 2007 1 次提交
    • J
      fix git commit --amend -m "new message" · fbcf1184
      Junio C Hamano 提交于
      The prepare_log_message() function serves two purposes:
      
       - Prepares the commit log message template, to be given to the end
         user;
      
       - Return true if there is something committable;
      
      7168624c (Do not generate full commit
      log message if it is not going to be used) cheated to omit the former
      when we know the log message template is not going to be used.  However,
      its replacement logic to see if there is something committable was
      botched.  When amending, it should compare the index with the parent of
      the HEAD, not the current HEAD.  Otherwise you cannot run --amend to
      fix only the message without changing the tree.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fbcf1184
  17. 17 12月, 2007 2 次提交
  18. 15 12月, 2007 1 次提交
    • J
      commit: allow --amend to reuse message from another commit · 1eb1e9ee
      Junio C Hamano 提交于
      After tentatively applying a patch from a contributor, you can get a
      replacement patch with corrected code and unusable commit log message.
      In such a case, this sequence ought to give you an editor based on the
      message in the earlier commit, to let you describe an incremental
      improvement:
      
          git reset --hard HEAD^ ;# discard the earlier one
          git am <corrected-patch
          git commit --amend -c HEAD@{1}
      
      Unfortunately, --amend insisted reusing the message from the commit
      being amended, ignoring the -c option.  This corrects it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1eb1e9ee
  19. 13 12月, 2007 1 次提交
    • J
      git-commit: squelch needless message during an empty merge · 37d07f8f
      Junio C Hamano 提交于
      When recording a merge that conflicted and ends up in no changes after
      manual resolution, commit callchain looked like this:
      
      	cmd_commit() ->
                  prepare_log_message() ->
                      run_status() ->
      		    wt_status_print()
      
      This invocation of run_status() is asked to find out if there is a
      committable change, but it unconditionally gave instructions such as
      "use git-add" at the same time.  When in merge, we do allow an empty
      change to be recorded, so after showing this message the code still went
      ahead and made a commit.
      
      This introduces "nowarn" parameter to run_status() to avoid these
      useless messages.  If we are not allowed to create an empty commit, we
      already call run_status() again in the original codepath, and the
      message will be shown from that call anyway.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      37d07f8f
  20. 11 12月, 2007 1 次提交
  21. 09 12月, 2007 3 次提交
    • J
      Re-fix "builtin-commit: fix --signoff" · 774751a8
      Junio C Hamano 提交于
      An earlier fix to the said commit was incomplete; it mixed up the
      meaning of the flag parameter passed to the internal fmt_ident()
      function, so this corrects it.
      
      git_author_info() and git_committer_info() can be told to issue a
      warning when no usable user information is found, and optionally can be
      told to error out.  Operations that actually use the information to
      record a new commit or a tag will still error out, but the caller to
      leave reflog record will just silently use bogus user information.
      
      Not warning on misconfigured user information while writing a reflog
      entry is somewhat debatable, but it is probably nicer to the users to
      silently let it pass, because the only information you are losing is who
      checked out the branch.
      
       * git_author_info() and git_committer_info() used to take 1 (positive
         int) to error out with a warning on misconfiguration; this is now
         signalled with a symbolic constant IDENT_ERROR_ON_NO_NAME.
      
       * These functions used to take -1 (negative int) to warn but continue;
         this is now signalled with a symbolic constant IDENT_WARN_ON_NO_NAME.
      
       * fmt_ident() function implements the above error reporting behaviour
         common to git_author_info() and git_committer_info().  A symbolic
         constant IDENT_NO_DATE can be or'ed in to the flag parameter to make
         it return only the "Name <email@address.xz>".
      
       * fmt_name() is a thin wrapper around fmt_ident() that always passes
         IDENT_ERROR_ON_NO_NAME and IDENT_NO_DATE.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      774751a8
    • J
      Fix commit-msg hook to allow editing · 740001a5
      Junio C Hamano 提交于
      The old git-commit.sh script allowed the commit-msg hook to not only
      prevent a commit from proceding, but also to edit the commit message
      on the fly and allow it to proceed. So here we teach builtin-commit
      to do the same.
      
      This is based on Wincent's patch, but redone with a clarified logic.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      740001a5
    • W
      Allow --no-verify to bypass commit-msg hook · 6b95655d
      Wincent Colaiuta 提交于
      At the moment the --no-verify switch to "git commit" instructs it to
      skip over the pre-commit hook. Here we teach "git commit --no-verify"
      to skip over the commit-msg hook as well. This brings the behaviour
      of builtin-commit back in line with git-commit.sh.
      Signed-off-by: NWincent Colaiuta <win@wincent.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6b95655d
  22. 08 12月, 2007 1 次提交
  23. 03 12月, 2007 4 次提交
  24. 02 12月, 2007 1 次提交
  25. 29 11月, 2007 1 次提交
  26. 27 11月, 2007 1 次提交