1. 07 2月, 2007 5 次提交
    • S
      Don't do non-fastforward updates in fast-import. · 7073e69e
      Shawn O. Pearce 提交于
      If fast-import is being used to update an existing branch of
      a repository, the user may not want to lose commits if another
      process updates the same ref at the same time.  For example, the
      user might be using fast-import to make just one or two commits
      against a live branch.
      
      We now perform a fast-forward check during the ref updating process.
      If updating a branch would cause commits in that branch to be lost,
      we skip over it and display the new SHA1 to standard error.
      
      This new default behavior can be overridden with `--force`, like
      git-push and git-fetch.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      7073e69e
    • S
      Support RFC 2822 date parsing in fast-import. · 63e0c8b3
      Shawn O. Pearce 提交于
      Since some frontends may be working with source material where
      the dates are only readily available as RFC 2822 strings, it is
      more friendly if fast-import exposes Git's parse_date() function
      to handle the conversion.  This way the frontend doesn't need
      to perform the parsing itself.
      
      The new --date-format option to fast-import can be used by a
      frontend to select which format it will supply date strings in.
      The default is the standard `raw` Git format, which fast-import
      has always supported.  Format rfc2822 can be used to activate the
      parse_date() function instead.
      
      Because fast-import could also be useful for creating new, current
      commits, the format `now` is also supported to generate the current
      system timestamp.  The implementation of `now` is a trivial call
      to datestamp(), but is actually a whole whopping 3 lines so that
      fast-import can verify the frontend really meant `now`.
      
      As part of this change I have added validation of the `raw` date
      format.  Prior to this change fast-import would accept anything
      in a `committer` command, even if it was seriously malformed.
      Now fast-import requires the '> ' near the end of the string and
      verifies the timestamp is formatted properly.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      63e0c8b3
    • S
      Minor fast-import documentation corrections. · ef94edb5
      Shawn O. Pearce 提交于
      Corrected a couple of header markup lines which were shorter than the
      actual header, and made the `data` commands two formats into a named
      list, which matches how we document the two formats of the `M` command
      within a commit.
      
      Also tried to simplify the language about our decimal integer format;
      Linus pointed out I was probably being too specific at the cost of
      reduced readability.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      ef94edb5
    • S
      Remove unnecessary null pointer checks in fast-import. · e7d06a4b
      Shawn O. Pearce 提交于
      There is no need to check for a NULL pointer before invoking free(),
      the runtime library automatically performs this check anyway and
      does nothing if a NULL pointer is supplied.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      e7d06a4b
    • S
      Correct fast-import timezone documentation. · c74ba3d3
      Shawn O. Pearce 提交于
      Andy Parkins and Linus Torvalds both noticed that the description
      of the timezone was incorrect.  Its not expressed in minutes.
      Its more like "hhmm", where "hh" is the number of hours and "mm"
      is the number of minutes shifted from GMT/UTC.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      c74ba3d3
  2. 06 2月, 2007 7 次提交
    • S
      Correct minor style issue in fast-import. · e5b1444b
      Shawn O. Pearce 提交于
      Junio noticed that I was using a different style in fast-import
      for returned pointers than the rest of Git.  Before merging this
      code into the main git.git tree I'd like to make it consistent,
      as this style variation was not intentional.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      e5b1444b
    • S
      Correct compiler warnings in fast-import. · 10e8d688
      Shawn O. Pearce 提交于
      Junio noticed these warnings/errors in fast-import when compiling
      with `-Werror -ansi -pedantic`.  A few changes are to reduce compiler
      warnings, while one (in cmd_merge) is a bug fix.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      10e8d688
    • S
      Remove --branch-log from fast-import. · 0b868e02
      Shawn O. Pearce 提交于
      The --branch-log option and its associated code hasn't been used in
      several months, as its not really very useful for debugging fast-import
      or a frontend.  I don't plan on supporting it in this state long-term,
      so I'm killing it now before it gets distributed to a wider audience.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      0b868e02
    • S
      Initial draft of fast-import documentation. · 6e411d20
      Shawn O. Pearce 提交于
      This is a first pass at the manpage for git-fast-import.
      
      I have tried to cover the input format in extreme detail, creating a
      reference which is more detailed than the BNF grammar appearing in
      the header of fast-import.c.  I have also covered some details about
      gfi's performance and memory utilization, as well as the average
      learning curve required to create a gfi frontend application (as it
      is far lower than it might appear on first glance).
      
      The documentation still lacks real example input streams, which may
      turn out to be difficult to format in asciidoc due to the blank lines
      which carry meaning within the format.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      6e411d20
    • S
      Don't support shell-quoted refnames in fast-import. · 6c3aac1c
      Shawn O. Pearce 提交于
      The current implementation of shell-style quoted refnames and
      SHA-1 expressions within fast-import contains a bad memory leak.
      We leak the unquoted strings used by the `from` and `merge`
      commands, maybe others.  Its also just muddling up the docs.
      
      Since Git refnames cannot contain LF, and that is our delimiter
      for the end of the refname, and we accept any other character
      as-is, there is no reason for these strings to support quoting,
      except to be nice to frontends.  But frontends shouldn't be
      expecting to use funny refs in Git, and its just as simple to
      never quote them as it is to always pass them through the same
      quoting filter as pathnames.  So frontends should never quote
      refs, or ref expressions.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      6c3aac1c
    • S
      Reduce memory usage of fast-import. · 10831c55
      Shawn O. Pearce 提交于
      Some structs are allocated rather frequently, but were using integer
      types which were far larger than required to actually store their
      full value range.
      
      As packfiles are limited to 4 GiB we don't need more than 32 bits to
      store the offset of an object within that packfile, an `unsigned long`
      on a 64 bit system is likely a 64 bit unsigned value.  Saving 4 bytes
      per object on a 64 bit system can add up fast on any sizable import.
      
      As atom strings are strictly single components in a path name these
      are probably limited to just 255 bytes by the underlying OS.  Going
      to that short of a string is probably too restrictive, but certainly
      `unsigned int` is far too large for their lengths.  `unsigned short`
      is a reasonable limit.
      
      Modes within a tree really only need two bytes to store their whole
      value; using `unsigned int` here is vast overkill.  Saving 4 bytes
      per file entry in an active branch can add up quickly on a project
      with a large number of files.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      10831c55
    • S
      Include checkpoint command in the BNF. · 8c1f22da
      Shawn O. Pearce 提交于
      This command isn't encouraged (as its slow) but it does exist and
      is accepted, so it still should be covered in the BNF.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      8c1f22da
  3. 31 1月, 2007 1 次提交
    • S
      Merge branch 'master' into sp/gfi · 76db9dec
      Shawn O. Pearce 提交于
      git-fast-import requires use of inttypes.h, but the master branch has
      added it to git-compat-util differently than git-fast-import originally
      had used it.  This merge back of master to the fast-import topic is to
      get (and use) inttypes.h the way master is using it.
      
      This is a partially evil merge to remove the call to setup_ident(),
      as the master branch now contains a change which makes this implicit
      and therefore removed the function declaration. (commit 01754769).
      
      Conflicts:
      
      	git-compat-util.h
      76db9dec
  4. 30 1月, 2007 6 次提交
  5. 29 1月, 2007 14 次提交
  6. 28 1月, 2007 7 次提交
    • S
      Compute accurate distances in git-describe before output. · 1b600e65
      Shawn O. Pearce 提交于
      My prior change to git-describe attempts to print the distance
      between the input commit and the best matching tag, but this distance
      was usually only an estimate as we always aborted revision walking
      as soon as we overflowed the configured limit on the number of
      possible tags (as set by --candidates).
      
      Displaying an estimated distance is not very useful and can just be
      downright confusing.  Most users (heck, most Git developers) don't
      immediately understand why this distance differs from the output
      of common tools such as `git rev-list | wc -l`.  Even worse, the
      estimated distance could change in the future (including decreasing
      despite no rebase occuring) if we find more possible tags earlier
      on during traversal.  (This could happen if more tags are merged
      into the branch between queries.)  These factors basically make an
      estimated distance useless.
      
      Fortunately we are usually most of the way through an accurate
      distance computation by the time we abort (due to reaching the
      current --candidates limit).  This means we can simply finish
      counting out the revisions still in our commit queue to present
      the accurate distance at the end.  The number of commits remaining
      in the commit queue is probably less than the number of commits
      already traversed, so finishing out the count is not likely to take
      very long.  This final distance will then always match the output of
      `git rev-list | wc -l`.
      
      We can easily reduce the total number of commits that need to be
      walked at the end by stopping as soon as all of the commits in the
      commit queue are flagged as being merged into the already selected
      best possible tag.  If that's true then there are no remaining
      unseen commits which can contribute to our best possible tag's
      depth counter, so further traversal is useless.
      
      Basic testing on my Mac OS X system shows there is no noticable
      performance difference between this accurate distance counting
      version of git-describe and the prior version of git-describe,
      at least when run on git.git.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1b600e65
    • J
      Update describe documentation. · 1891261e
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1891261e
    • S
      Teach git-describe to display distances from tags. · 237fb6ca
      Shawn O. Pearce 提交于
      If you get two different describes at different
      times from a non-rewinding branch and they both come up with the same
      tag name, you can tell which is the 'newer' one by distance.  This is
      rather common in practice, so its incredibly useful.
      
      [jc: still needs documentation and fixups when traversal gives up
       early.]
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      237fb6ca
    • J
      git-blame --porcelain: quote filename in c-style when needed. · 46e5e69d
      Junio C Hamano 提交于
      Otherwise a pathname that has funny characters such as LF would
      screw up the parsing programs of the output.
      
      Strictly speaking, this is not backward compatible, but the
      current output for pathnames that have embedded LF and such
      cannot be sanely parsed anyway, and pathnames that only use
      characters from the portable pathname character set won't be
      affected.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      46e5e69d
    • L
      git-blame --incremental · 717d1462
      Linus Torvalds 提交于
      This adds --incremental option to help GUI porcelains to show
      the result from git-blame incrementally.  The output gives the
      origin information in the same format as the porcelain format.
      The first line has commit object name, the line number of the
      first line in the group in the original file, the line number of
      that file in the final image, and number of lines in the group.
      Then subsequent lines show the metainformation for the commit
      when the commit is shown for the first time, except the filename
      information is always shown (we cannot even make it conditional
      to -C option as blame always follows the renaming of the file
      wholesale).
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      717d1462
    • J
      Don't force everybody to call setup_ident(). · 01754769
      Junio C Hamano 提交于
      Back when only handful commands that created commit and tag were
      the only users of committer identity information, it made sense
      to explicitly call setup_ident() to pre-fill the default value
      from the gecos information.  But it is much simpler for programs
      to make the call automatic when get_ident() is called these days,
      since many more programs want to use the information when updating
      the reflog.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      01754769
    • N
      git-log -g --pretty=oneline should display the reflog message · 903b45fe
      Nicolas Pitre 提交于
      In the context of reflog output the reflog message is more useful than
      the commit message's first line.  When relevant the reflog message
      will contain that line anyway.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      903b45fe