1. 26 4月, 2007 2 次提交
  2. 24 4月, 2007 2 次提交
  3. 23 4月, 2007 2 次提交
    • J
      Make read-cache.c "the_index" free. · 4aab5b46
      Junio C Hamano 提交于
      This makes all low-level functions defined in read-cache.c to
      take an explicit index_state structure as their first parameter,
      to specify which index to work on.  These functions
      traditionally operated on "the_index" and were named foo_cache();
      the counterparts this patch introduces are called foo_index().
      
      The traditional foo_cache() functions are made into macros that
      give "the_index" to their corresponding foo_index() functions.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      4aab5b46
    • J
      Move index-related variables into a structure. · 228e94f9
      Junio C Hamano 提交于
      This defines a index_state structure and moves index-related
      global variables into it.  Currently there is one instance of
      it, the_index, and everybody accesses it, so there is no code
      change.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      228e94f9
  4. 22 4月, 2007 1 次提交
    • J
      lockfile: record the primary process. · 5e635e39
      Junio C Hamano 提交于
      The usual process flow is the main process opens and holds the lock to
      the index, does its thing, perhaps spawning children during the course,
      and then writes the resulting index out by releaseing the lock.
      
      However, the lockfile interface uses atexit(3) to clean it up, without
      regard to who actually created the lock.  This typically leads to a
      confusing behaviour of lock being released too early when the child
      exits, and then the parent process when it calls commit_lockfile()
      finds that it cannot unlock it.
      
      This fixes the problem by recording who created and holds the lock, and
      upon atexit(3) handler, child simply ignores the lockfile the parent
      created.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5e635e39
  5. 21 4月, 2007 1 次提交
  6. 18 4月, 2007 1 次提交
  7. 17 4月, 2007 3 次提交
  8. 16 4月, 2007 1 次提交
    • J
      attribute macro support · f48fd688
      Junio C Hamano 提交于
      This adds "attribute macros" (for lack of better name).  So far,
      we have low-level attributes such as crlf and diff, which are
      defined in operational terms --- setting or unsetting them on a
      particular path directly affects what is done to the path.  For
      example, in order to decline diffs or crlf conversions on a
      binary blob, no diffs on PostScript files, and treat all other
      files normally, you would have something like these:
      
      	*		diff crlf
      	*.ps		!diff
      	proprietary.o	!diff !crlf
      
      That is fine as the operation goes, but gets unwieldy rather
      rapidly, when we start adding more low-level attributes that are
      defined in operational terms.  A near-term example of such an
      attribute would be 'merge-3way' which would control if git
      should attempt the usual 3-way file-level merge internally, or
      leave merging to a specialized external program of user's
      choice.  When it is added, we do _not_ want to force the users
      to update the above to:
      
      	*		diff crlf merge-3way
      	*.ps		!diff
      	proprietary.o	!diff !crlf !merge-3way
      
      The way this patch solves this issue is to realize that the
      attributes the user is assigning to paths are not defined in
      terms of operations but in terms of what they are.
      
      All of the three low-level attributes usually make sense for
      most of the files that sane SCM users have git operate on (these
      files are typically called "text').  Only a few cases, such as
      binary blob, need exception to decline the "usual treatment
      given to text files" -- and people mark them as "binary".
      
      So this allows the $GIT_DIR/info/alternates and .gitattributes
      at the toplevel of the project to also specify attributes that
      assigns other attributes.  The syntax is '[attr]' followed by an
      attribute name followed by a list of attribute names:
      
      	[attr] binary	!diff !crlf !merge-3way
      
      When "binary" attribute is set to a path, if the path has not
      got diff/crlf/merge-3way attribute set or unset by other rules,
      this rule unsets the three low-level attributes.
      
      It is expected that the user level .gitattributes will be
      expressed mostly in terms of attributes based on what the files
      are, and the above sample would become like this:
      
      	(built-in attribute configuration)
      	[attr] binary	!diff !crlf !merge-3way
      	*		diff crlf merge-3way
      
      	(project specific .gitattributes)
      	proprietary.o	binary
      
      	(user preference $GIT_DIR/info/attributes)
      	*.ps		!diff
      
      There are a few caveats.
      
       * As described above, you can define these macros only in
         $GIT_DIR/info/attributes and toplevel .gitattributes.
      
       * There is no attempt to detect circular definition of macro
         attributes, and definitions are evaluated from bottom to top
         as usual to fill in other attributes that have not yet got
         values.  The following would work as expected:
      
      	[attr] text	diff crlf
      	[attr] ps	text !diff
      	*.ps	ps
      
         while this would most likely not (I haven't tried):
      
      	[attr] ps	text !diff
      	[attr] text	diff crlf
      	*.ps	ps
      
       * When a macro says "[attr] A B !C", saying that a path does
         not have attribute A does not let you tell anything about
         attributes B or C.  That is, given this:
      
      	[attr] text	diff crlf
      	[attr] ps	text !diff
      	*.txt !ps
      
        path hello.txt, which would match "*.txt" pattern, would have
        "ps" attribute set to zero, but that does not make text
        attribute of hello.txt set to false (nor diff attribute set to
        true).
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      f48fd688
  9. 14 4月, 2007 1 次提交
    • J
      Add basic infrastructure to assign attributes to paths · d0bfd026
      Junio C Hamano 提交于
      This adds the basic infrastructure to assign attributes to
      paths, in a way similar to what the exclusion mechanism does
      based on $GIT_DIR/info/exclude and .gitignore files.
      
      An attribute is just a simple string that does not contain any
      whitespace.  They can be specified in $GIT_DIR/info/attributes
      file, and .gitattributes file in each directory.
      
      Each line in these files defines a pattern matching rule.
      Similar to the exclusion mechanism, a later match overrides an
      earlier match in the same file, and entries from .gitattributes
      file in the same directory takes precedence over the ones from
      parent directories.  Lines in $GIT_DIR/info/attributes file are
      used as the lowest precedence default rules.
      
      A line is either a comment (an empty line, or a line that begins
      with a '#'), or a rule, which is a whitespace separated list of
      tokens.  The first token on the line is a shell glob pattern.
      The rest are names of attributes, each of which can optionally
      be prefixed with '!'.  Such a line means "if a path matches this
      glob, this attribute is set (or unset -- if the attribute name
      is prefixed with '!').  For glob matching, the same "if the
      pattern does not have a slash in it, the basename of the path is
      matched with fnmatch(3) against the pattern, otherwise, the path
      is matched with the pattern with FNM_PATHNAME" rule as the
      exclusion mechanism is used.
      
      This does not define what an attribute means.  Tying an
      attribute to various effects it has on git operation for paths
      that have it will be specified separately.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      d0bfd026
  10. 11 4月, 2007 3 次提交
  11. 07 4月, 2007 1 次提交
    • J
      A new merge stragety 'subtree'. · 68faf689
      Junio C Hamano 提交于
      This merge strategy largely piggy-backs on git-merge-recursive.
      When merging trees A and B, if B corresponds to a subtree of A,
      B is first adjusted to match the tree structure of A, instead of
      reading the trees at the same level.  This adjustment is also
      done to the common ancestor tree.
      
      If you are pulling updates from git-gui repository into git.git
      repository, the root level of the former corresponds to git-gui/
      subdirectory of the latter.  The tree object of git-gui's toplevel
      is wrapped in a fake tree object, whose sole entry has name 'git-gui'
      and records object name of the true tree, before being used by
      the 3-way merge code.
      
      If you are merging the other way, only the git-gui/ subtree of
      git.git is extracted and merged into git-gui's toplevel.
      
      The detection of corresponding subtree is done by comparing the
      pathnames and types in the toplevel of the tree.
      
      Heuristics galore!  That's the git way ;-).
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      68faf689
  12. 06 4月, 2007 3 次提交
  13. 04 4月, 2007 2 次提交
    • J
      git-read-tree --index-output=<file> · 5e7f56ac
      Junio C Hamano 提交于
      This corrects the interface mistake of the previous one, and
      gives a command line parameter to the only plumbing command that
      currently needs it: "git-read-tree".
      
      We can add the calls to set_alternate_index_output() to other
      plumbing commands that update the index if/when needed.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5e7f56ac
    • J
      _GIT_INDEX_OUTPUT: allow plumbing to output to an alternative index file. · 30ca07a2
      Junio C Hamano 提交于
      When defined, this allows plumbing commands that update the
      index (add, apply, checkout-index, merge-recursive, mv,
      read-tree, rm, update-index, and write-tree) to write their
      resulting index to an alternative index file while holding a
      lock to the original index file.  With this, git-commit that
      jumps the index does not have to make an extra copy of the index
      file, and more importantly, it can do the update while holding
      the lock on the index.
      
      However, I think the interface to let an environment variable
      specify the output is a mistake, as shown in the documentation.
      If a curious user has the environment variable set to something
      other than the file GIT_INDEX_FILE points at, almost everything
      will break.  This should instead be a command line parameter to
      tell these plumbing commands to write the result in the named
      file, to prevent stupid mistakes.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      30ca07a2
  14. 21 3月, 2007 1 次提交
  15. 19 3月, 2007 1 次提交
    • S
      Limit the size of the new delta_base_cache · 18bdec11
      Shawn O. Pearce 提交于
      The new configuration variable core.deltaBaseCacheLimit allows the
      user to control how much memory they are willing to give to Git for
      caching base objects of deltas.  This is not normally meant to be
      a user tweakable knob; the "out of the box" settings are meant to
      be suitable for almost all workloads.
      
      We default to 16 MiB under the assumption that the cache is not
      meant to consume all of the user's available memory, and that the
      cache's main purpose was to cache trees, for faster path limiters
      during revision traversal.  Since trees tend to be relatively small
      objects, this relatively small limit should still allow a large
      number of objects.
      
      On the other hand we don't want the cache to start storing 200
      different versions of a 200 MiB blob, as this could easily blow
      the entire address space of a 32 bit process.
      
      We evict OBJ_BLOB from the cache first (credit goes to Junio) as
      we want to favor OBJ_TREE within the cache.  These are the objects
      that have the highest inflate() startup penalty, as they tend to
      be small and thus don't have that much of a chance to ammortize
      that penalty over the entire data.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      18bdec11
  16. 17 3月, 2007 1 次提交
    • N
      [PATCH] clean up pack index handling a bit · 42873078
      Nicolas Pitre 提交于
      Especially with the new index format to come, it is more appropriate
      to encapsulate more into check_packed_git_idx() and assume less of the
      index format in struct packed_git.
      
      To that effect, the index_base is renamed to index_data with void * type
      so it is not used directly but other pointers initialized with it. This
      allows for a couple pointer cast removal, as well as providing a better
      generic name to grep for when adding support for new index versions or
      formats.
      
      And index_data is declared const too while at it.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      42873078
  17. 13 3月, 2007 1 次提交
  18. 11 3月, 2007 2 次提交
    • J
      prepare_packed_git(): sort packs by age and localness. · b867092f
      Junio C Hamano 提交于
      When accessing objects, we first look for them in packs that
      are linked together in the reverse order of discovery.
      
      Since younger packs tend to contain more recent objects, which
      are more likely to be accessed often, and local packs tend to
      contain objects more relevant to our specific projects, sort the
      list of packs before starting to access them.  In addition,
      favoring local packs over the ones borrowed from alternates can
      be a win when alternates are mounted on network file systems.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      b867092f
    • P
      git-branch, git-checkout: autosetup for remote branch tracking · 0746d19a
      Paolo Bonzini 提交于
      In order to track and build on top of a branch 'topic' you track from
      your upstream repository, you often would end up doing this sequence:
      
        git checkout -b mytopic origin/topic
        git config --add branch.mytopic.remote origin
        git config --add branch.mytopic.merge refs/heads/topic
      
      This would first fork your own 'mytopic' branch from the 'topic'
      branch you track from the 'origin' repository; then it would set up two
      configuration variables so that 'git pull' without parameters does the
      right thing while you are on your own 'mytopic' branch.
      
      This commit adds a --track option to git-branch, so that "git
      branch --track mytopic origin/topic" performs the latter two actions
      when creating your 'mytopic' branch.
      
      If the configuration variable branch.autosetupmerge is set to true, you
      do not have to pass the --track option explicitly; further patches in
      this series allow setting the variable with a "git remote add" option.
      The configuration variable is off by default, and there is a --no-track
      option to countermand it even if the variable is set.
      Signed-off-by: NPaolo Bonzini  <bonzini@gnu.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      0746d19a
  19. 08 3月, 2007 3 次提交
    • S
      Use off_t when we really mean a file offset. · c4001d92
      Shawn O. Pearce 提交于
      Not all platforms have declared 'unsigned long' to be a 64 bit value,
      but we want to support a 64 bit packfile (or close enough anyway)
      in the near future as some projects are getting large enough that
      their packed size exceeds 4 GiB.
      
      By using off_t, the POSIX type that is declared to mean an offset
      within a file, we support whatever maximum file size the underlying
      operating system will handle.  For most modern systems this is up
      around 2^60 or higher.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      c4001d92
    • S
      Use uint32_t for all packed object counts. · 326bf396
      Shawn O. Pearce 提交于
      As we permit up to 2^32-1 objects in a single packfile we cannot
      use a signed int to represent the object offset within a packfile,
      after 2^31-1 objects we will start seeing negative indexes and
      error out or compute bad addresses within the mmap'd index.
      
      This is a minor cleanup that does not introduce any significant
      logic changes.  It is roach free.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      326bf396
    • S
      General const correctness fixes · 3a55602e
      Shawn O. Pearce 提交于
      We shouldn't attempt to assign constant strings into char*, as the
      string is not writable at runtime.  Likewise we should always be
      treating unsigned values as unsigned values, not as signed values.
      
      Most of these are very straightforward.  The only exception is the
      (unnecessary) xstrdup/free in builtin-branch.c for the detached
      head case.  Since this is a user-level interactive type program
      and that particular code path is executed no more than once, I feel
      that the extra xstrdup call is well worth the easy elimination of
      this warning.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      3a55602e
  20. 05 3月, 2007 1 次提交
  21. 03 3月, 2007 1 次提交
    • J
      Add core.symlinks to mark filesystems that do not support symbolic links. · 78a8d641
      Johannes Sixt 提交于
      Some file systems that can host git repositories and their working copies
      do not support symbolic links. But then if the repository contains a symbolic
      link, it is impossible to check out the working copy.
      
      This patch enables partial support of symbolic links so that it is possible
      to check out a working copy on such a file system.  A new flag
      core.symlinks (which is true by default) can be set to false to indicate
      that the filesystem does not support symbolic links. In this case, symbolic
      links that exist in the trees are checked out as small plain files, and
      checking in modifications of these files preserve the symlink property in
      the database (as long as an entry exists in the index).
      
      Of course, this does not magically make symbolic links work on such defective
      file systems; hence, this solution does not help if the working copy relies
      on that an entry is a real symbolic link.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      78a8d641
  22. 01 3月, 2007 2 次提交
  23. 28 2月, 2007 2 次提交
  24. 27 2月, 2007 1 次提交
    • N
      convert object type handling from a string to a number · 21666f1a
      Nicolas Pitre 提交于
      We currently have two parallel notation for dealing with object types
      in the code: a string and a numerical value.  One of them is obviously
      redundent, and the most used one requires more stack space and a bunch
      of strcmp() all over the place.
      
      This is an initial step for the removal of the version using a char array
      found in object reading code paths.  The patch is unfortunately large but
      there is no sane way to split it in smaller parts without breaking the
      system.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      21666f1a
  25. 17 2月, 2007 1 次提交
    • J
      Do not take mode bits from index after type change. · 185c975f
      Junio C Hamano 提交于
      When we do not trust executable bit from lstat(2), we copied
      existing ce_mode bits without checking if the filesystem object
      is a regular file (which is the only thing we apply the "trust
      executable bit" business) nor if the blob in the index is a
      regular file (otherwise, we should do the same as registering a
      new regular file, which is to default non-executable).
      
      Noticed by Johannes Sixt.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      185c975f