1. 26 2月, 2011 1 次提交
    • D
      fast-import: add 'ls' command · 8dc6a373
      David Barr 提交于
      Lazy fast-import frontend authors that want to rely on the backend to
      keep track of the content of the imported trees _almost_ have what
      they need in the 'cat-blob' command (v1.7.4-rc0~30^2~3, 2010-11-28).
      But it is not quite enough, since
      
       (1) cat-blob can be used to retrieve the content of files, but
           not their mode, and
      
       (2) using cat-blob requires the frontend to keep track of a name
           (mark number or object id) for each blob to be retrieved
      
      Introduce an 'ls' command to complement cat-blob and take care of the
      remaining needs.  The 'ls' command finds what is at a given path
      within a given tree-ish (tag, commit, or tree):
      
      	'ls' SP <dataref> SP <path> LF
      
      or in fast-import's active commit:
      
      	'ls' SP <path> LF
      
      The response is a single line sent through the cat-blob channel,
      imitating ls-tree output.  So for example:
      
      	FE> ls :1 Documentation
      	gfi> 040000 tree 9e6c2b599341d28a2a375f8207507e0a2a627fe9	Documentation
      	FE> ls 9e6c2b599341d28a2a375f8207507e0a2a627fe9 git-fast-import.txt
      	gfi> 100644 blob 4f92954396e3f0f97e75b6838a5635b583708870	git-fast-import.txt
      	FE> ls :1 RelNotes
      	gfi> 120000 blob b942e499449d97aeb50c73ca2bdc1c6e6d528743	RelNotes
      	FE> cat-blob b942e499449d97aeb50c73ca2bdc1c6e6d528743
      	gfi> b942e499449d97aeb50c73ca2bdc1c6e6d528743 blob 32
      	gfi> Documentation/RelNotes/1.7.4.txt
      
      The most interesting parts of the reply are the first word, which is
      a 6-digit octal mode (regular file, executable, symlink, directory,
      or submodule), and the part from the second space to the tab, which is
      a <dataref> that can be used in later cat-blob, ls, and filemodify (M)
      commands to refer to the content (blob, tree, or commit) at that path.
      
      If there is nothing there, the response is "missing some/path".
      
      The intent is for this command to be used to read files from the
      active commit, so a frontend can apply patches to them, and to copy
      files and directories from previous revisions.
      
      For example, proposed updates to svn-fe use this command in place of
      its internal representation of the repository directory structure.
      This simplifies the frontend a great deal and means support for
      resuming an import in a separate fast-import run (i.e., incremental
      import) is basically free.
      Signed-off-by: NDavid Barr <david.barr@cordelta.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Improved-by: NJunio C Hamano <gitster@pobox.com>
      Improved-by: NSverre Rabbelier <srabbelier@gmail.com>
      8dc6a373
  2. 10 2月, 2011 1 次提交
    • J
      fast-import: introduce "feature notes" command · 547e8b92
      Jonathan Nieder 提交于
      Here is a 'feature' command for streams to use to require support for
      the notemodify (N) command.
      
      When the 'feature' facility was introduced (v1.7.0-rc0~95^2~4,
      2009-12-04), the notes import feature was old news (v1.6.6-rc0~21^2~8,
      2009-10-09) and it was not obvious it deserved to be a named feature.
      But now that is clear, since all major non-git fast-import backends
      lack support for it.
      
      Details: on git version with this patch applied, any "feature notes"
      command in the features/options section at the beginning of a stream
      will be treated as a no-op.  On fast-import implementations without
      the feature (and older git versions), the command instead errors out
      with a message like
      
      	This version of fast-import does not support feature notes.
      
      So by declaring use of notes at the beginning of a stream, frontends
      can avoid wasting time and other resources when the backend does not
      support notes.  (This would be especially important for backends that
      do not support rewinding history after a botched import.)
      Improved-by: NThomas Rast <trast@student.ethz.ch>
      Improved-by: NSverre Rabbelier <srabbelier@gmail.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      547e8b92
  3. 28 1月, 2011 1 次提交
    • J
      fast-import: treat filemodify with empty tree as delete · 8fe533f6
      Jonathan Nieder 提交于
      Normal git processes do not allow one to build a tree with an empty
      subtree entry without trying hard at it.  This is in keeping with the
      general UI philosophy: git tracks content, not empty directories.
      
      v1.7.3-rc0~75^2 (2010-06-30) changed that by making it easy to include
      an empty subtree in fast-import's active commit:
      
      	M 040000 4b825dc642cb6eb9a060e54bf8d69288fbee4904 subdir
      
      One can trigger this by reading an empty tree (for example, the tree
      corresponding to an empty root commit) and trying to move it to a
      subtree.  It is better and more closely analogous to 'git read-tree
      --prefix' to treat such commands as requests to remove the subtree.
      Noticed-by: NDavid Barr <david.barr@cordelta.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8fe533f6
  4. 18 1月, 2011 1 次提交
    • R
      fast-import: Introduce --import-marks-if-exists · dded4f12
      Ramkumar Ramachandra 提交于
      When a frontend uses a marks file to ensure its state persists between
      runs, it may represent "clean slate" when bootstrapping with "no marks
      yet". In such a case, feeding the last state with --import-marks and
      saving the state after the current run with --export-marks would be a
      natural thing to do.
      
      The --import-marks option however errors out when the specified marks file
      doesn't exist; this makes bootstrapping a bit difficult.  The location of
      the marks file becomes backend-dependent when --relative-marks is in
      effect, and the frontend cannot check for the existence of the file in
      such a case.
      
      The --import-marks-if-exists option does the same thing as --import-marks
      but does not flag an error if the named file does not exist yet to help
      these frontends.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Helped-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NRamkumar Ramachandra <artagnon@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dded4f12
  5. 02 12月, 2010 3 次提交
  6. 25 11月, 2010 2 次提交
  7. 21 10月, 2010 1 次提交
  8. 19 10月, 2010 2 次提交
    • J
      fast-import: tighten M 040000 syntax · 34215783
      Jonathan Nieder 提交于
      When tree_content_set() is asked to modify the path "foo/bar/",
      it first recurses like so:
      
      	tree_content_set(root, "foo/bar/", sha1, S_IFDIR) ->
      	 tree_content_set(root:foo, "bar/", ...) ->
      	  tree_content_set(root:foo/bar, "", ...)
      
      And as a side-effect of 2794ad52 (fast-import: Allow filemodify to set
      the root, 2010-10-10), this last call is accepted and changes
      the tree entry for root:foo/bar to refer to the specified tree.
      
      That seems safe enough but let's reject the new syntax (we never meant
      to support it) and make it harder for frontends to introduce pointless
      incompatibilities with git fast-import 1.7.3.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      34215783
    • J
      fast-import: filemodify after M 040000 <tree> "" crashes · 5edde510
      Jonathan Nieder 提交于
      Until M 040000 <tree> "" syntax was introduced in commit 2794ad52
      (fast-import: Allow filemodify to set the root, 2010-10-10), it
      was impossible for the root entry to refer to an unloaded tree.
      Update various functions to take that possibility into account.
      Otherwise
      
      	M 040000 <tree> ""
      	M 100644 :1 "foo"
      
      and similar commands (using D, C, or R after resetting the root
      tree) segfault.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5edde510
  9. 14 10月, 2010 1 次提交
    • D
      fast-import: Allow filemodify to set the root · 2794ad52
      David Barr 提交于
      v1.7.3-rc0~75^2 (Teach fast-import to import subtrees named by tree id,
      2010-06-30) has a shortcoming - it doesn't allow the root to be set.
      Extend this behaviour by allowing the root to be referenced as the
      empty path, "".
      
      For a command (like filter-branch --subdirectory-filter) that wants
      to commit a lot of trees that already exist in the object db, writing
      undeltified objects as loose files only to repack them later can
      involve a significant amount of overhead.
      (23% slow-down observed on Linux 2.6.35, worse on Mac OS X 10.6)
      
      Fortunately we have fast-import (which is one of the only git commands
      that will write to a pack directly) but there is not an advertised way
      to tell fast-import to commit a given tree without unpacking it.
      
      This patch changes that, by allowing
      
      	M 040000 <tree id> ""
      
      as a filemodify line in a commit to reset to a particular tree without
      any need to parse it.  For example,
      
      	M 040000 4b825dc642cb6eb9a060e54bf8d69288fbee4904 ""
      
      is a synonym for the deleteall command and the fast-import equivalent of
      
      	git read-tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
      Signed-off-by: NDavid Barr <david.barr@cordelta.com>
      Commit-message-by: NJonathan Nieder <jrnieder@gmail.com>
      Acked-by: NSverre Rabbelier <srabbelier@gmail.com>
      Tested-by: NRamkumar Ramachandra <artagnon@gmail.com>
      Signed-off-by: NRamkumar Ramachandra <artagnon@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2794ad52
  10. 09 10月, 2010 1 次提交
  11. 07 10月, 2010 1 次提交
  12. 12 8月, 2010 1 次提交
  13. 10 7月, 2010 1 次提交
    • E
      fast-import: Improve robustness when D->F changes provided in wrong order · 253fb5f8
      Elijah Newren 提交于
      When older versions of fast-export came across a directory changing to a
      symlink (or regular file), it would output the changes in the form
        M 120000 :239821 dir-changing-to-symlink
        D dir-changing-to-symlink/filename1
      When fast-import sees the first line, it deletes the directory named
      dir-changing-to-symlink (and any files below it) and creates a symlink in
      its place.  When fast-import came across the second line, it was previously
      trying to remove the file and relevant leading directories in
      tree_content_remove(), and as a side effect it would delete the symlink
      that was just created.  This resulted in the symlink silently missing from
      the resulting repository.
      
      To improve robustness, we ignore file deletions underneath directory names
      that correspond to non-directories.  This can also be viewed as a minor
      optimization: since there cannot be a file and a directory with the same
      name in the same directory, the file clearly can't exist so nothing needs
      to be done to delete it.
      Signed-off-by: NElijah Newren <newren@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      253fb5f8
  14. 06 7月, 2010 1 次提交
  15. 12 6月, 2010 1 次提交
  16. 01 6月, 2010 1 次提交
    • G
      enums: omit trailing comma for portability · 4b05548f
      Gary V. Vaughan 提交于
      Without this patch at least IBM VisualAge C 5.0 (I have 5.0.2) on AIX
      5.1 fails to compile git.
      
      enum style is inconsistent already, with some enums declared on one
      line, some over 3 lines with the enum values all on the middle line,
      sometimes with 1 enum value per line... and independently of that the
      trailing comma is sometimes present and other times absent, often
      mixing with/without trailing comma styles in a single file, and
      sometimes in consecutive enum declarations.
      
      Clearly, omitting the comma is the more portable style, and this patch
      changes all enum declarations to use the portable omitted dangling
      comma style consistently.
      Signed-off-by: NGary V. Vaughan <gary@thewrittenword.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4b05548f
  17. 01 4月, 2010 1 次提交
  18. 07 3月, 2010 1 次提交
  19. 18 2月, 2010 7 次提交
  20. 05 2月, 2010 2 次提交
  21. 02 2月, 2010 1 次提交
  22. 15 1月, 2010 1 次提交
  23. 01 1月, 2010 1 次提交
  24. 08 12月, 2009 1 次提交
    • J
      fast-import: Proper notes tree manipulation · 2a113aee
      Johan Herland 提交于
      This patch teaches 'git fast-import' to automatically organize note objects
      in a fast-import stream into an appropriate fanout structure. The notes API
      in notes.h is NOT used to accomplish this, because trying to keep the
      fast-import and notes data structures in sync would yield a significantly
      larger patch with higher complexity.
      
      Note objects are added with the 'N' command, and accounted for with a
      per-branch counter, which is used to trigger fanout restructuring when
      needed. Note that when restructuring the branch tree, _any_ entry whose
      path consists of 40 hex chars (not including directory separators) will
      be recognized as a note object. It is therefore not advisable to
      manipulate note entries with M/D/R/C commands.
      
      Since note objects are stored in the same tree structure as other objects,
      the unloading and reloading of a fast-import branches handle note objects
      transparently.
      
      This patch has been improved by the following contributions:
      - Shawn O. Pearce: Several style- and logic-related improvements
      
      Cc: Shawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2a113aee
  25. 06 12月, 2009 1 次提交
    • S
      fast-import: add (non-)relative-marks feature · bc3c79ae
      Sverre Rabbelier 提交于
      After specifying 'feature relative-marks' the paths specified with
      'feature import-marks' and 'feature export-marks' are relative to an
      internal directory in the current repository.
      
      In git-fast-import this means that the paths are relative to the
      '.git/info/fast-import' directory. However, other importers may use a
      different location.
      
      Add 'feature non-relative-marks' to disable this behavior, this way
      it is possible to, for example, specify the import-marks location as
      relative, and the export-marks location as non-relative.
      
      Also add tests to verify this behavior.
      
      Cc: Daniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NSverre Rabbelier <srabbelier@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bc3c79ae
  26. 05 12月, 2009 4 次提交