1. 18 1月, 2008 1 次提交
    • S
      Fix random fast-import errors when compiled with NO_MMAP · c9ced051
      Shawn O. Pearce 提交于
      fast-import was relying on the fact that on most systems mmap() and
      write() are synchronized by the filesystem's buffer cache.  We were
      relying on the ability to mmap() 20 bytes beyond the current end
      of the file, then later fill in those bytes with a future write()
      call, then read them through the previously obtained mmap() address.
      
      This isn't always true with some implementations of NFS, but it is
      especially not true with our NO_MMAP=YesPlease build time option used
      on some platforms.  If fast-import was built with NO_MMAP=YesPlease
      we used the malloc()+pread() emulation and the subsequent write()
      call does not update the trailing 20 bytes of a previously obtained
      "mmap()" (aka malloc'd) address.
      
      Under NO_MMAP that behavior causes unpack_entry() in sha1_file.c to
      be unable to read an object header (or data) that has been unlucky
      enough to be written to the packfile at a location such that it
      is in the trailing 20 bytes of a window previously opened on that
      same packfile.
      
      This bug has gone unnoticed for a very long time as it is highly data
      dependent.  Not only does the object have to be placed at the right
      position, but it also needs to be positioned behind some other object
      that has been accessed due to a branch cache invalidation.  In other
      words the stars had to align just right, and if you did run into
      this bug you probably should also have purchased a lottery ticket.
      
      Fortunately the workaround is a lot easier than the bug explanation.
      
      Before we allow unpack_entry() to read data from a pack window
      that has also (possibly) been modified through write() we force
      all existing windows on that packfile to be closed.  By closing
      the windows we ensure that any new access via the emulated mmap()
      will reread the packfile, updating to the current file content.
      
      This comes at a slight performance degredation as we cannot reuse
      previously cached windows when we update the packfile.  But it
      is a fairly minor difference as the window closes happen at only
      two points:
      
       - When the packfile is finalized and its .idx is generated:
      
         At this stage we are getting ready to update the refs and any
         data access into the packfile is going to be random, and is
         going after only the branch tips (to ensure they are valid).
         Our existing windows (if any) are not likely to be positioned
         at useful locations to access those final tip commits so we
         probably were closing them before anyway.
      
       - When the branch cache missed and we need to reload:
      
         At this point fast-import is getting change commands for the next
         commit and it needs to go re-read a tree object it previously
         had written out to the packfile.  What windows we had (if any)
         are not likely to cover the tree in question so we probably were
         closing them before anyway.
      
      We do try to avoid unnecessarily closing windows in the second case
      by checking to see if the packfile size has increased since the
      last time we called unpack_entry() on that packfile.  If the size
      has not changed then we have not written additional data, and any
      existing window is still vaild.  This nicely handles the cases where
      fast-import is going through a branch cache reload and needs to read
      many trees at once.  During such an event we are not likely to be
      updating the packfile so we do not cycle the windows between reads.
      
      With this change in place t9301-fast-export.sh (which was broken
      by c3b0dec5) finally works again.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c9ced051
  2. 17 1月, 2008 1 次提交
    • B
      close_lock_file(): new function in the lockfile API · d6cf61bf
      Brandon Casey 提交于
      The lockfile API is a handy way to obtain a file that is cleaned
      up if you die().  But sometimes you would need this sequence to
      work:
      
       1. hold_lock_file_for_update() to get a file descriptor for
          writing;
      
       2. write the contents out, without being able to decide if the
          results should be committed or rolled back;
      
       3. do something else that makes the decision --- and this
          "something else" needs the lockfile not to have an open file
          descriptor for writing (e.g. Windows do not want a open file
          to be renamed);
      
       4. call commit_lock_file() or rollback_lock_file() as
          appropriately.
      
      This adds close_lock_file() you can call between step 2 and 3 in
      the above sequence.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d6cf61bf
  3. 14 12月, 2007 1 次提交
    • W
      Unify whitespace checking · c1795bb0
      Wincent Colaiuta 提交于
      This commit unifies three separate places where whitespace checking was
      performed:
      
       - the whitespace checking previously done in builtin-apply.c is
      extracted into a function in ws.c
      
       - the equivalent logic in "git diff" is removed
      
       - the emit_line_with_ws() function is also removed because that also
      rechecks the whitespace, and its functionality is rolled into ws.c
      
      The new function is called check_and_emit_line() and it does two things:
      checks a line for whitespace errors and optionally emits it. The checking
      is based on lines of content rather than patch lines (in other words, the
      caller must strip the leading "+" or "-"); this was suggested by Junio on
      the mailing list to allow for a future extension to "git show" to display
      whitespace errors in blobs.
      
      At the same time we teach it to report all classes of whitespace errors
      found for a given line rather than reporting only the first found error.
      Signed-off-by: NWincent Colaiuta <win@wincent.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c1795bb0
  4. 11 12月, 2007 1 次提交
    • J
      Support GIT_PAGER_IN_USE environment variable · 6e9af863
      Jeff King 提交于
      When deciding whether or not to turn on automatic color
      support, git_config_colorbool checks whether stdout is a
      tty. However, because we run a pager, if stdout is not a
      tty, we must check whether it is because we started the
      pager. This used to be done by checking the pager_in_use
      variable.
      
      This variable was set only when the git program being run
      started the pager; there was no way for an external program
      running git indicate that it had already started a pager.
      This patch allows a program to set GIT_PAGER_IN_USE to a
      true value to indicate that even though stdout is not a tty,
      it is because a pager is being used.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6e9af863
  5. 09 12月, 2007 1 次提交
    • 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
  6. 06 12月, 2007 1 次提交
    • J
      Use gitattributes to define per-path whitespace rule · cf1b7869
      Junio C Hamano 提交于
      The `core.whitespace` configuration variable allows you to define what
      `diff` and `apply` should consider whitespace errors for all paths in
      the project (See gitlink:git-config[1]).  This attribute gives you finer
      control per path.
      
      For example, if you have these in the .gitattributes:
      
          frotz   whitespace
          nitfol  -whitespace
          xyzzy   whitespace=-trailing
      
      all types of whitespace problems known to git are noticed in path 'frotz'
      (i.e. diff shows them in diff.whitespace color, and apply warns about
      them), no whitespace problem is noticed in path 'nitfol', and the
      default types of whitespace problems except "trailing whitespace" are
      noticed for path 'xyzzy'.  A project with mixed Python and C might want
      to have:
      
          *.c    whitespace
          *.py   whitespace=-indent-with-non-tab
      
      in its toplevel .gitattributes file.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cf1b7869
  7. 04 12月, 2007 1 次提交
  8. 03 12月, 2007 1 次提交
  9. 02 12月, 2007 1 次提交
    • J
      rename: Break filepairs with different types. · b45563a2
      Junio C Hamano 提交于
      When we consider if a path has been totally rewritten, we did not
      touch changes from symlinks to files or vice versa.  But a change
      that modifies even the type of a blob surely should count as a
      complete rewrite.
      
      While we are at it, modernise diffcore-break to be aware of gitlinks (we
      do not want to touch them).
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b45563a2
  10. 23 11月, 2007 2 次提交
    • J
      Fix add_files_to_cache() to take pathspec, not user specified list of files · b6ec1d61
      Junio C Hamano 提交于
      This separates the logic to limit the extent of change to the
      index by where you are (controlled by "prefix") and what you
      specify from the command line (controlled by "pathspec").
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b6ec1d61
    • J
      Export three helper functions from ls-files · ee425e46
      Junio C Hamano 提交于
      This exports three helper functions from ls-files.
      
       * pathspec_match() checks if a given path matches a set of pathspecs
         and optionally records which pathspec was used.  This function used
         to be called "match()" but renamed to be a bit less vague.
      
       * report_path_error() takes a set of pathspecs and the record
         pathspec_match() above leaves, and gives error message.  This
         was split out of the main function of ls-files.
      
       * overlay_tree_on_cache() takes a tree-ish (typically "HEAD")
         and overlays it on the current in-core index.  By iterating
         over the resulting index, the caller can find out the paths
         in either the index or the HEAD.  This function used to be
         called "overlay_tree()" but renamed to be a bit more
         descriptive.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ee425e46
  11. 19 11月, 2007 2 次提交
    • S
      refactor fetch's ref matching to use refname_match() · 605b4978
      Steffen Prohaska 提交于
      The old rules used by fetch were coded as a series of ifs.  The old
      rules are:
      1) match full refname if it starts with "refs/" or matches "HEAD"
      2) verify that full refname starts with "refs/"
      3) match abbreviated name in "refs/" if it starts with "heads/",
          "tags/", or "remotes/".
      4) match abbreviated name in "refs/heads/"
      
      This is replaced by the new rules
      a) match full refname
      b) match abbreviated name prefixed with "refs/"
      c) match abbreviated name prefixed with "refs/heads/"
      
      The details of the new rules are different from the old rules.  We no
      longer verify that the full refname starts with "refs/".  The new rule
      (a) matches any full string.  The old rules (1) and (2) were stricter.
      Now, the caller is responsible for using sensible full refnames.  This
      should be the case for the current code.  The new rule (b) is less
      strict than old rule (3).  The new rule accepts abbreviated names that
      start with a non-standard prefix below "refs/".
      
      Despite this modifications the new rules should handle all cases as
      expected.  Two tests are added to verify that fetch does not resolve
      short tags or HEAD in remotes.
      
      We may even think about loosening the rules a bit more and unify them
      with the rev-parse rules.  This would be done by replacing
      ref_ref_fetch_rules with ref_ref_parse_rules.  Note, the two new test
      would break.
      Signed-off-by: NSteffen Prohaska <prohaska@zib.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      605b4978
    • S
      add refname_match() · 79803322
      Steffen Prohaska 提交于
      We use at least two rulesets for matching abbreviated refnames with
      full refnames (starting with 'refs/').  git-rev-parse and git-fetch
      use slightly different rules.
      
      This commit introduces a new function refname_match
      (const char *abbrev_name, const char *full_name, const char **rules).
      
      abbrev_name is expanded using the rules and matched against full_name.
      If a match is found the function returns true.  rules is a NULL-terminate
      list of format patterns with "%.*s", for example:
      
          const char *ref_rev_parse_rules[] = {
                     "%.*s",
                     "refs/%.*s",
                     "refs/tags/%.*s",
                     "refs/heads/%.*s",
                     "refs/remotes/%.*s",
                     "refs/remotes/%.*s/HEAD",
                     NULL
          };
      
      Asterisks are included in the format strings because this is the form
      required in sha1_name.c.  Sharing the list with the functions there is
      a good idea to avoid duplicating the rules.  Hopefully this
      facilitates unified matching rules in the future.
      
      This commit makes the rules used by rev-parse for resolving refs to
      sha1s available for string comparison.  Before this change, the rules
      were buried in get_sha1*() and dwim_ref().
      
      A follow-up commit will refactor the rules used by fetch.
      
      refname_match() will be used for matching refspecs in git-send-pack.
      
      Thanks to Daniel Barkalow <barkalow@iabervon.org> for pointing
      out that ref_matches_abbrev in remote.c solves a similar problem
      and care should be taken to avoid confusion.
      Signed-off-by: NSteffen Prohaska <prohaska@zib.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      79803322
  12. 18 11月, 2007 5 次提交
    • J
      send-pack: tighten remote error reporting · 2a0fe89a
      Jeff King 提交于
      Previously, we set all ref pushes to 'OK', and then marked
      them as errors if the remote reported so. This has the
      problem that if the remote dies or fails to report a ref, we
      just assume it was OK.
      
      Instead, we use a new non-OK state to indicate that we are
      expecting status (if the remote doesn't support the
      report-status feature, we fall back on the old behavior).
      Thus we can flag refs for which we expected a status, but
      got none (conversely, we now also print a warning for refs
      for which we get a status, but weren't expecting one).
      
      This also allows us to simplify the receive_status exit
      code, since each ref is individually marked with failure
      until we get a success response. We can just print the usual
      status table, so the user still gets a sense of what we were
      trying to do when the failure happened.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2a0fe89a
    • J
      make "find_ref_by_name" a public function · cda69f48
      Jeff King 提交于
      This was a static in remote.c, but is generally useful.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cda69f48
    • S
      Fix warning about bitfield in struct ref · 9f8a15c7
      Shawn O. Pearce 提交于
      cache.h:503: warning: type of bit-field 'force' is a GCC extension
      cache.h:504: warning: type of bit-field 'merge' is a GCC extension
      cache.h:505: warning: type of bit-field 'nonfastforward' is a GCC extension
      cache.h:506: warning: type of bit-field 'deletion' is a GCC extension
      
      So we change it to an 'unsigned int' which is not a GCC extension.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9f8a15c7
    • J
      send-pack: assign remote errors to each ref · ca74c458
      Jeff King 提交于
      This lets us show remote errors (e.g., a denied hook) along
      with the usual push output.
      
      There is a slightly clever optimization in receive_status
      that bears explanation. We need to correlate the returned
      status and our ref objects, which naively could be an O(m*n)
      operation. However, since the current implementation of
      receive-pack returns the errors to us in the same order that
      we sent them, we optimistically look for the next ref to be
      looked up to come after the last one we have found. So it
      should be an O(m+n) merge if the receive-pack behavior
      holds, but we fall back to a correct but slower behavior if
      it should change.
      Signed-off-by: NJeff King <peff@peff.net>
      Acked-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ca74c458
    • J
      send-pack: track errors for each ref · 8736a848
      Jeff King 提交于
      Instead of keeping the 'ret' variable, we instead have a
      status flag for each ref that tracks what happened to it.
      We then print the ref status after all of the refs have
      been examined.
      
      This paves the way for three improvements:
        - updating tracking refs only for non-error refs
        - incorporating remote rejection into the printed status
        - printing errors in a different order than we processed
          (e.g., consolidating non-ff errors near the end with
          a special message)
      Signed-off-by: NJeff King <peff@peff.net>
      Acked-by: NAlex Riesen <raa.lkml@gmail.com>
      Acked-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8736a848
  13. 17 11月, 2007 1 次提交
    • J
      core.excludesfile clean-up · dcf0c16e
      Junio C Hamano 提交于
      There are inconsistencies in the way commands currently handle
      the core.excludesfile configuration variable.  The problem is
      the variable is too new to be noticed by anything other than
      git-add and git-status.
      
       * git-ls-files does not notice any of the "ignore" files by
         default, as it predates the standardized set of ignore files.
         The calling scripts established the convention to use
         .git/info/exclude, .gitignore, and later core.excludesfile.
      
       * git-add and git-status know about it because they call
         add_excludes_from_file() directly with their own notion of
         which standard set of ignore files to use.  This is just a
         stupid duplication of code that need to be updated every time
         the definition of the standard set of ignore files is
         changed.
      
       * git-read-tree takes --exclude-per-directory=<gitignore>,
         not because the flexibility was needed.  Again, this was
         because the option predates the standardization of the ignore
         files.
      
       * git-merge-recursive uses hardcoded per-directory .gitignore
         and nothing else.  git-clean (scripted version) does not
         honor core.* because its call to underlying ls-files does not
         know about it.  git-clean in C (parked in 'pu') doesn't either.
      
      We probably could change git-ls-files to use the standard set
      when no excludes are specified on the command line and ignore
      processing was asked, or something like that, but that will be a
      change in semantics and might break people's scripts in a subtle
      way.  I am somewhat reluctant to make such a change.
      
      On the other hand, I think it makes perfect sense to fix
      git-read-tree, git-merge-recursive and git-clean to follow the
      same rule as other commands.  I do not think of a valid use case
      to give an exclude-per-directory that is nonstandard to
      read-tree command, outside a "negative" test in the t1004 test
      script.
      
      This patch is the first step to untangle this mess.
      
      The next step would be to teach read-tree, merge-recursive and
      clean (in C) to use setup_standard_excludes().
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dcf0c16e
  14. 15 11月, 2007 3 次提交
    • J
      Introduce git_etc_gitconfig() that encapsulates access of ETC_GITCONFIG. · 506b17b1
      Johannes Sixt 提交于
      In a subsequent patch the path to the system-wide config file will be
      computed. This is a preparation for that change. It turns all accesses
      of ETC_GITCONFIG into function calls. There is no change in behavior.
      
      As a consequence, config.c is the only file that needs the definition of
      ETC_GITCONFIG. Hence, -DETC_GITCONFIG is removed from the CFLAGS and a
      special build rule for config.c is introduced. As a side-effect, changing
      the defintion of ETC_GITCONFIG (e.g. in config.mak) does not trigger a
      complete rebuild anymore.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      506b17b1
    • J
      Close files opened by lock_file() before unlinking. · 4723ee99
      Johannes Schindelin 提交于
      This is needed on Windows since open files cannot be unlinked.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4723ee99
    • J
      core.excludesfile clean-up · 039bc64e
      Junio C Hamano 提交于
      There are inconsistencies in the way commands currently handle
      the core.excludesfile configuration variable.  The problem is
      the variable is too new to be noticed by anything other than
      git-add and git-status.
      
       * git-ls-files does not notice any of the "ignore" files by
         default, as it predates the standardized set of ignore files.
         The calling scripts established the convention to use
         .git/info/exclude, .gitignore, and later core.excludesfile.
      
       * git-add and git-status know about it because they call
         add_excludes_from_file() directly with their own notion of
         which standard set of ignore files to use.  This is just a
         stupid duplication of code that need to be updated every time
         the definition of the standard set of ignore files is
         changed.
      
       * git-read-tree takes --exclude-per-directory=<gitignore>,
         not because the flexibility was needed.  Again, this was
         because the option predates the standardization of the ignore
         files.
      
       * git-merge-recursive uses hardcoded per-directory .gitignore
         and nothing else.  git-clean (scripted version) does not
         honor core.* because its call to underlying ls-files does not
         know about it.  git-clean in C (parked in 'pu') doesn't either.
      
      We probably could change git-ls-files to use the standard set
      when no excludes are specified on the command line and ignore
      processing was asked, or something like that, but that will be a
      change in semantics and might break people's scripts in a subtle
      way.  I am somewhat reluctant to make such a change.
      
      On the other hand, I think it makes perfect sense to fix
      git-read-tree, git-merge-recursive and git-clean to follow the
      same rule as other commands.  I do not think of a valid use case
      to give an exclude-per-directory that is nonstandard to
      read-tree command, outside a "negative" test in the t1004 test
      script.
      
      This patch is the first step to untangle this mess.
      
      The next step would be to teach read-tree, merge-recursive and
      clean (in C) to use setup_standard_excludes().
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      039bc64e
  15. 10 11月, 2007 1 次提交
    • J
      ce_match_stat, run_diff_files: use symbolic constants for readability · 4bd5b7da
      Junio C Hamano 提交于
      ce_match_stat() can be told:
      
       (1) to ignore CE_VALID bit (used under "assume unchanged" mode)
           and perform the stat comparison anyway;
      
       (2) not to perform the contents comparison for racily clean
           entries and report mismatch of cached stat information;
      
      using its "option" parameter.  Give them symbolic constants.
      
      Similarly, run_diff_files() can be told not to report anything
      on removed paths.  Also give it a symbolic constant for that.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4bd5b7da
  16. 08 11月, 2007 1 次提交
  17. 06 11月, 2007 1 次提交
  18. 03 11月, 2007 3 次提交
    • D
      Miscellaneous const changes and utilities · 4577370e
      Daniel Barkalow 提交于
      The list of remote refs in struct transport should be const, because
      builtin-fetch will get confused if it changes.
      
      The url in git_connect should be const (and work on a copy) instead of
      requiring the caller to copy it.
      
      match_refs doesn't modify the refspecs it gets.
      
      get_fetch_map and get_remote_ref don't change the list they get.
      
      Allow transport get_refs_list methods to modify the struct transport.
      
      Add a function to copy a list of refs, when a function needs a mutable
      copy of a const list.
      
      Add a function to check the type of a ref, as per the code in connect.c
      Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4577370e
    • J
      git-diff: complain about >=8 consecutive spaces in initial indent · 459fa6d0
      Junio C Hamano 提交于
      This introduces a new whitespace error type, "indent-with-non-tab".
      The error is about starting a line with 8 or more SP, instead of
      indenting it with a HT.
      
      This is not enabled by default, as some projects employ an
      indenting policy to use only SPs and no HTs.
      
      The kernel folks and git contributors may want to enable this
      detection with:
      
      	[core]
      		whitespace = indent-with-non-tab
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      459fa6d0
    • J
      War on whitespace: first, a bit of retreat. · a9cc857a
      Junio C Hamano 提交于
      This introduces core.whitespace configuration variable that lets
      you specify the definition of "whitespace error".
      
      Currently there are two kinds of whitespace errors defined:
      
       * trailing-space: trailing whitespaces at the end of the line.
      
       * space-before-tab: a SP appears immediately before HT in the
         indent part of the line.
      
      You can specify the desired types of errors to be detected by
      listing their names (unique abbreviations are accepted)
      separated by comma.  By default, these two errors are always
      detected, as that is the traditional behaviour.  You can disable
      detection of a particular type of error by prefixing a '-' in
      front of the name of the error, like this:
      
      	[core]
      		whitespace = -trailing-space
      
      This patch teaches the code to output colored diff with
      DIFF_WHITESPACE color to highlight the detected whitespace
      errors to honor the new configuration.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a9cc857a
  19. 21 10月, 2007 1 次提交
  20. 30 9月, 2007 1 次提交
  21. 27 9月, 2007 1 次提交
  22. 21 9月, 2007 1 次提交
    • P
      nfv?asprintf are broken without va_copy, workaround them. · 19247e55
      Pierre Habouzit 提交于
      * drop nfasprintf.
      * move nfvasprintf into imap-send.c back, and let it work on a 8k buffer,
        and die() in case of overflow. It should be enough for imap commands, if
        someone cares about imap-send, he's welcomed to fix it properly.
      * replace nfvasprintf use in merge-recursive with a copy of the strbuf_addf
        logic, it's one place, we'll live with it.
        To ease the change, output_buffer string list is replaced with a strbuf ;)
      * rework trace.c to call vsnprintf itself.  It's used to format strerror()s
        and git command names, it should never be more than a few octets long, let
        it work on a 8k static buffer with vsnprintf or die loudly.
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      19247e55
  23. 19 9月, 2007 1 次提交
    • D
      Make fetch a builtin · b888d61c
      Daniel Barkalow 提交于
      Thanks to Johannes Schindelin for review and fixes, and Julian
      Phillips for the original C translation.
      
      This changes a few small bits of behavior:
      
      branch.<name>.merge is parsed as if it were the lhs of a fetch
      refspec, and does not have to exactly match the actual lhs of a
      refspec, so long as it is a valid abbreviation for the same ref.
      
      branch.<name>.merge is no longer ignored if the remote is configured
      with a branches/* file. Neither behavior is useful, because there can
      only be one ref that gets fetched, but this is more consistant.
      
      Also, fetch prints different information to standard out.
      Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b888d61c
  24. 18 9月, 2007 1 次提交
  25. 17 9月, 2007 1 次提交
    • P
      Rewrite convert_to_{git,working_tree} to use strbuf's. · 5ecd293d
      Pierre Habouzit 提交于
      * Now, those functions take an "out" strbuf argument, where they store their
        result if any. In that case, it also returns 1, else it returns 0.
      * those functions support "in place" editing, in the sense that it's OK to
        call them this way:
          convert_to_git(path, sb->buf, sb->len, sb);
        When doable, conversions are done in place for real, else the strbuf
        content is just replaced with the new one, transparentely for the caller.
      
      If you want to create a new filter working this way, being the accumulation
      of filter1, filter2, ... filtern, then your meta_filter would be:
      
          int meta_filter(..., const char *src, size_t len, struct strbuf *sb)
          {
              int ret = 0;
              ret |= filter1(...., src, len, sb);
              if (ret) {
                  src = sb->buf;
                  len = sb->len;
              }
              ret |= filter2(...., src, len, sb);
              if (ret) {
                  src = sb->buf;
                  len = sb->len;
              }
              ....
              return ret | filtern(..., src, len, sb);
          }
      
      That's why subfilters the convert_to_* functions called were also rewritten
      to work this way.
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5ecd293d
  26. 13 9月, 2007 1 次提交
  27. 11 9月, 2007 1 次提交
  28. 04 9月, 2007 1 次提交
  29. 01 9月, 2007 1 次提交
    • J
      git-diff: resurrect the traditional empty "diff --git" behaviour · aecbf914
      Junio C Hamano 提交于
      The warning message to suggest "Consider running git-status" from
      "git-diff" that we experimented with during the 1.5.3 cycle turns
      out to be a bad idea.  It robbed cache-dirty information from people
      who valued it, while still asking users to run "update-index --refresh".
      It was hoped that the new behaviour would at least have some educational
      value, but not showing the cache-dirty paths like before meant that the
      user would not even know easily which paths were cache-dirty, and it
      made the need to refresh the index look like even more unnecessary chore.
      
      This commit reinstates the traditional behaviour, but with a twist.
      
      By default, the empty "diff --git" output is totally squelched out
      from "git diff" output.  At the end of the command, it automatically
      runs "update-index --refresh" as needed, without even bothering the
      user.  In other words, people who do not care about the cache-dirtyness
      do not even have to see the warning.
      
      The traditional behaviour to see the stat-dirty output and to bypassing
      the overhead of content comparison can be specified by setting the
      configuration variable diff.autorefreshindex to false.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      aecbf914
  30. 14 8月, 2007 1 次提交