summaryrefslogtreecommitdiff
path: root/contrib/fast-import
AgeCommit message (Collapse)Author
2020-03-24import-tars: ignore the global PAX headerJohannes Schindelin
The tar importer in `contrib/fast-import/import-tars.perl` has a very convenient feature: if _all_ paths stored in the imported `.tar` start with a common prefix, e.g. `git-2.26.0/` in the tar at https://github.com/git/git/archive/v2.26.0.tar.gz, then this prefix is stripped. This feature makes a ton of sense because it is relatively common to import two or more revisions of the same project into Git, and obviously we don't want all files to live in a tree whose name changes from revision to revision. Now, the problem with that feature is that it breaks down if there is a `pax_global_header` "file" located outside of said prefix, at the top of the tree. This is the case for `.tar` files generated by Git's very own `git archive` command: it inserts that header, and `git archive` allows specifying a common prefix (that the header does _not_ share with the other files contained in the archive) via `--prefix=my-project-1.0.0/`. Let's just skip any global header when importing `.tar` files into Git. Note: this global header might contain useful information. For example, in the output of `git archive`, it lists the original commit, which _is_ useful information. A future improvement to the `import-tars.perl` script might be to include that information in the commit message, or do other things with the information (e.g. use `mtime` information contained in the global header as date of the commit). This patch does not prevent any future patch from making that happen, it only prevents the header from being treated as if it was a regular file. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-23import-tars: read overlong names from pax extended headerPedro Alvarez Piedehierro
Importing gcc tarballs[1] with import-tars script (in contrib) fails when hitting a pax extended header. Make sure we always read the extended attributes from the pax entries, and store the 'path' value if found to be used in the next ustar entry. The code to parse pax extended headers was written consulting the Pax Pax Interchange Format documentation [2]. [1] http://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.xz [2] https://www.freebsd.org/cgi/man.cgi?manpath=FreeBSD+8-current&query=tar&sektion=5 Signed-off-by: Pedro Alvarez <palvarez89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-09Replace Free Software Foundation address in license noticesTodd Zullinger
The mailing address for the FSF has changed over the years. Rather than updating the address across all files, refer readers to gnu.org, as the GNU GPL documentation now suggests for license notices. The mailing address is retained in the full license files (COPYING and LGPL-2.1). The old address is still present in t/diff-lib/COPYING. This is intentional, as the file is used in tests and the contents are not expected to change. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-03import-tars: support hard linksJohannes Schindelin
Previously, we simply treated hard links as if they were plain files with size 0, ignoring the link type "1" and hence the link target. What we should do instead, of course, is to use the link target to get at the import mark for the contents, even if we cannot recreate the hard link per se, as Git has no concept of hard links. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-31comments: fix misuses of "nor"Justin Lebar
Signed-off-by: Justin Lebar <jlebar@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-24contrib/fast-import/import-zips.py: use spaces instead of tabsDavid Aguilar
Follow the conventional Python style by using 4-space indents instead of hard tabs. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-24contrib/fast-import/import-zips.py: fix broken error messageDavid Aguilar
The 'sys' module is not imported but all of the bits we want from it are. Adjust the script to not fail when run on old Python versions and fix the inconsistent use of tabs. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-24contrib/fast-import: use a lowercase "usage:" stringDavid Aguilar
Make the usage string consistent with Git. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28Add checks to Python scripts for version dependencies.Eric S. Raymond
Signed-off-by: Eric S. Raymond <esr@thyrsus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-09git-p4: move to toplevelPete Wyckoff
Move git-p4 out of contrib/fast-import into the main code base, aside other foreign SCM tools. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-27Merge branch 'maint'Junio C Hamano
* maint: Document accumulated fixes since 1.7.9.2 Git 1.7.8.5 grep -P: Fix matching ^ and $ am: don't infloop for an empty input file rebase -m: only call "notes copy" when rewritten exists and is non-empty git-p4: remove bash-ism in t9800 git-p4: remove bash-ism in t9809 git-p4: fix submit regression with clientSpec and subdir clone git-p4: set useClientSpec variable on initial clone Makefile: add thread-utils.h to LIB_H Conflicts: RelNotes t/t9809-git-p4-client-view.sh
2012-02-27git-p4: fix submit regression with clientSpec and subdir clonePete Wyckoff
When the --use-client-spec is given to clone, and the clone path is a subset of the full tree as specified in the client, future submits will go to the wrong place. Factor out getClientSpec() so both clone/sync and submit can use it. Introduce getClientRoot() that is needed for the client spec case, and use it instead of p4Where(). Test the five possible submit behaviors (add, modify, rename, copy, delete). Reported-by: Laurent Charrière <lcharriere@promptu.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-27git-p4: set useClientSpec variable on initial clonePete Wyckoff
If --use-client-spec was given, set the matching configuration variable. This is necessary to ensure that future submits work properly. The alternatives of requiring the user to set it, or providing a command-line option on every submit, are error prone. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-23Merge branch 'ld/git-p4-expanded-keywords'Junio C Hamano
* ld/git-p4-expanded-keywords: : Teach git-p4 to unexpand $RCS$-like keywords that are embedded in : tracked contents in order to reduce unnecessary merge conflicts. git-p4: add initial support for RCS keywords
2012-02-23git-p4: add initial support for RCS keywordsLuke Diamand
RCS keywords cause problems for git-p4 as perforce always expands them (if +k is set) and so when applying the patch, git reports that the files have been modified by both sides, when in fact they haven't. This change means that when git-p4 detects a problem applying a patch, it will check to see if keyword expansion could be the culprit. If it is, it strips the keywords in the p4 repository so that they match what git is expecting. It then has another go at applying the patch. This behaviour is enabled with a new git-p4 configuration option and is off by default. Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-22git-p4: the option to specify 'host' is -H, not -hRussell Myers
This was broken since the feature was introduced initially at abcaf07 (If the user has configured various parameters, use them., 2008-08-10). Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-01Merge branch 'va/git-p4-branch'Junio C Hamano
* va/git-p4-branch: t9801: do not overuse test_must_fail git-p4: Change p4 command invocation git-p4: Add test case for complex branch import git-p4: Search for parent commit on branch creation
2012-02-01Merge branch 'ld/git-p4-branches-and-labels'Junio C Hamano
* ld/git-p4-branches-and-labels: git-p4: label import fails with multiple labels at the same changelist git-p4: add test for p4 labels git-p4: importing labels should cope with missing owner git-p4: cope with labels with empty descriptions git-p4: handle p4 branches and labels containing shell chars
2012-01-26git-p4: Change p4 command invocationPete Wyckoff
Change p4 command invocation to avoid going through the shell. This allows names with spaces and wildcards to work. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-26git-p4: Search for parent commit on branch creationVitor Antunes
To find out which is its parent the commit of the new branch is compared sequentially to each blob of the parent branch from the newest to the oldest. The first blob which results in a zero diff is considered the parent commit. If none is found, then the commit is applied to the top of the parent branch. A fast-import "checkpoint" call is required because diff-tree is only able to work with blobs on disk. But most of these commits will not be part of the final imported tree, making fast-import fail. To avoid this, the temporary branches are tracked and then removed at the end of the import process. Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-20git-p4: importing labels should cope with missing ownerLuke Diamand
In p4, the Owner field is optional. If it is missing, construct something sensible rather than crashing. Signed-off-by: Luke Diamand <luke@diamand.org> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-20git-p4: cope with labels with empty descriptionsLuke Diamand
Use an explicit length for the data in a label, rather than EOT, so that labels with empty descriptions are passed through correctly. Signed-off-by: Luke Diamand <luke@diamand.org> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-20git-p4: handle p4 branches and labels containing shell charsLuke Diamand
Don't use shell expansion when detecting branches, as it will fail if the branch name contains a shell metachar. Similarly for labels. Add additional test for branches with shell metachars. Signed-off-by: Luke Diamand <luke@diamand.org> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12git-p4: clarify commentPete Wyckoff
Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12git-p4: fix verbose comment typoPete Wyckoff
Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12git-p4: only a single ... wildcard is supportedPete Wyckoff
Catch the case where a ... exists at the end, and also elsehwere. Reported-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03git-p4: rewrite view handlingPete Wyckoff
The old code was not very complete or robust. Redo it. This new code should be useful for a few possible additions in the future: - support for * and %%n wildcards - allowing ... inside paths - representing branch specs (not just client specs) - tracking changes to views Mark the remaining 12 tests in t9809 as fixed. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03git-p4: support single file p4 client view mapsGary Gibbons
Perforce client views can map individual files, mapping one //depot file path to one //client file path. These mappings contain no meta/masking characters. This patch add support for these file maps to the currently supported '...' view mappings. [pw: one test now suceeds] Signed-off-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03git-p4: sort client views by reverse View numberGary Gibbons
Correct view sorting to support the Perforce order, where client views are ordered and later views override earlier view mappings. [pw: one test now succeeds] Signed-off-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03git-p4: fix test for unsupported P4 Client ViewsGary Gibbons
Change re method in test for unsupported Client View types (containing %% or *) anywhere in the string rather than at the begining. [pw: two tests now succeed] Signed-off-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: document and test submit optionsPete Wyckoff
Clarify there is a -M option, but no -C. These are both configurable through variables. Explain that the allowSubmit variable takes a comma-separated list of branch names. Catch earlier an invalid branch name given as an argument to "git p4 clone". Test option --origin, variable allowSubmit, and explicit master branch name. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: test and document --use-client-specPete Wyckoff
The depot path is required, even with this option. Make sure git-p4 fails and exits with non-zero. Contents in the specified depot path will be rearranged according to the client spec. Test this and add a note in the docs. Leave an XXX suggesting that this is somewhat confusing behavior that might be good to fix later. Function stripRepoPath() looks at self.useClientSpec. Make sure this is set both for command-line option --use-client-spec and for configuration variable git-p4.useClientSpec. Test this. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: honor --changesfile option and testPete Wyckoff
When an explicit list of changes is given, it makes no sense to use @all or @3,5 or any of the other p4 revision specifiers. Make the code notice when this happens, instead of just ignoring --changesfile. Test it. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: clone does not use --git-dirPete Wyckoff
Complain if --git-dir is given during a clone. It has no effect. Only --destination and --bare can change where the newly cloned git dir will be. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: introduce asciidoc documentationPete Wyckoff
Add proper documentation for git-p4. Delete the old .txt documentation from contrib/fast-import. Cc: Frans Klaver <fransklaver@gmail.com> Cc: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-18git-p4: fix skipSubmitEdit regressionPete Wyckoff
Commit 7c766e5 (git-p4: introduce skipSubmitEdit, 2011-12-04) made it easier to automate submission to p4, but broke the most common case. Add a test for when the user really does edit and save the change template, and fix the bug that causes the test to fail. Also add a confirmation message when submission is cancelled. Reported-by: Michael Horowitz <michael.horowitz@ieee.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12git-p4: use absolute directory for PWD env varGary Gibbons
P4 only looks at the environment variable $PWD to figure out where it is, so chdir() has code to set that every time. But when the clone --destination is not an absolute path, PWD will not be absolute and P4 won't be able to find any files expected to be in the current directory. Fix this by expanding PWD to an absolute path. One place this crops up is when using a P4CONFIG environment variable to specify P4 parameters, such as P4USER or P4PORT. Setting P4CONFIG=.p4config works for p4 invocations from the current directory. But if the value of PWD is not absolute, it fails. [ update description --pw ] Signed-off-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12git-p4: ensure submit clientPath exists before chdirGary Gibbons
Submitting patches back to p4 requires a p4 "client". This is a mapping from server depot paths into a local directory. The directory need not exist or be populated with files; only the mapping on the server is required. When there is no directory, make git-p4 automatically create it. [ reword description --pw ] Signed-off-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-05git-p4: introduce skipSubmitEditPete Wyckoff
Add a configuration variable to skip invoking the editor in the submit path. The existing variable skipSubmitEditCheck continues to make sure that the submit template was indeed modified by the editor; but, it is not considered if skipSubmitEdit is true. Reported-by: Loren A. Linden Levy <lindenle@gmail.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-07Merge branch 'pw/p4-appledouble-fix'Junio C Hamano
* pw/p4-appledouble-fix: git-p4: ignore apple filetype
2011-11-06git-p4: ignore apple filetypePete Wyckoff
Revert 97a21ca (git-p4: stop ignoring apple filetype, 2011-10-16) and add a test case. Reported-by: Michael Wookey <michaelwookey@gmail.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18git-p4: stop ignoring apple filetypePete Wyckoff
Currently "apple" filetype is ignored explicitly, and the file is not even included in the git repository. This seems wrong. Remove this, letting it be treated like a "binary" filetype. Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18git-p4: handle files with shell metacharactersLuke Diamand
git-p4 used to simply pass strings into system() and popen(), and relied on the shell doing the necessary expansion. This though meant that shell metacharacters in file names would be corrupted - for example files with $ or space in them. Switch to using subprocess.Popen() and friends, and pass in explicit arrays in the places where it matters. This then avoids needing shell expansion. Add trivial helper functions for some common perforce operations. Add test case. [pw: test cleanup] Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18git-p4: recognize all p4 filetypesPete Wyckoff
The previous code was approximate in the filetypes it recognized. Put in the canonical list and be more careful about matching elements of the file type. This might change behavior in some cases, hopefully for the better. Windows newline mangling will now happen on all text files. Previously some like "text+ko" were oddly exempt. Files with multiple combinations of modifiers, like "text+klx", are now recognized for keyword expansion. I expect these to be seen only rarely. Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18git-p4: keyword flattening fixesPete Wyckoff
Join the text before looking for keywords. There is nothing to prevent the p4 output marshaller from splitting in the middle of a keyword, although it has never been known to happen. Also remove the (?i) regexp modifier; perforce keywords are documented as case-sensitive. Remove the "\n" end-character match. I don't know why that is in there, and every keyword in a fairly large production p4 repository always ends with a $. Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18git-p4: handle utf16 filetype properlyPete Wyckoff
One of the filetypes that p4 supports is utf16. Its behavior is odd in this case. The data delivered through "p4 -G print" is not encoded in utf16, although "p4 print -o" will produce the proper utf16-encoded file. When dealing with this filetype, discard the data from -G, and instead read the contents directly. An alternate approach would be to try to encode the data in python. That worked for true utf16 files, but for other files marked as utf16, p4 delivers mangled text in no recognizable encoding. Add a test case to check utf16 handling, and +k and +ko handling. Reported-by: Chris Li <git@chrisli.org> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-23git-p4: Allow branch definition with git configVitor Antunes
Perforce does not strictly require the usage of branch specifications to create branches. In these cases the branch detection code of git-p4 will not be able to import them. This patch adds support for git-p4.branchList configuration option, allowing branches to be defined in git config. Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-23git-p4: Allow filtering Perforce branches by userVitor Antunes
All branches in the Perforce server are downloaded to allow branch detection. If you have a centralized server on a remote location and there is a big number of branches this operation can take some time. This patch adds the configuration option git-p4.branchUser to allow filtering the branch list by user. Although this limits the branch maintenance in Perforce to be done by a single user, it might be an advantage when the number of branches being used in a specific depot is very small when compared with the branches available in the server. Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-23git-p4: Correct branch base depot path detectionVitor Antunes
When branch detection is enabled each branch is named in git after their relative depot path in Perforce. To do this the depot paths are compared against each other to find their common base path. The current algorithm makes this comparison on a character by character basis. Assuming we have the following branches: //depot/branches/featureA //depot/branches/featureB Then the base depot path would be //depot/branches/feature, which is an invalid depot path. The current patch fixes this by splitting the path into a list and comparing the list entries, making it choose correctly //depot/branches as the base path. Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22git-p4: Process detectCopiesHarder with --boolVitor Antunes
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>