MCPcopy Create free account
hub / github.com/git/git / processContent

Method processContent

git-p4.py:1520–1545  ·  view source on GitHub ↗

Processes the content of git fast import. This method decides if a file is stored in the large file system and handles all necessary steps.

(self, git_mode, relPath, contents)

Source from the content-addressed store, hash-verified

1518 return relPath in self.largeFiles
1519
1520 def processContent(self, git_mode, relPath, contents):
1521 """Processes the content of git fast import. This method decides if a
1522 file is stored in the large file system and handles all necessary
1523 steps.
1524 """
1525 # symlinks aren't processed by smudge/clean filters
1526 if git_mode == "120000":
1527 return (git_mode, contents)
1528
1529 if self.exceedsLargeFileThreshold(relPath, contents) or self.hasLargeFileExtension(relPath):
1530 contentTempFile = self.generateTempFile(contents)
1531 pointer_git_mode, contents, localLargeFile = self.generatePointer(contentTempFile)
1532 if pointer_git_mode:
1533 git_mode = pointer_git_mode
1534 if localLargeFile:
1535 # Move temp file to final location in large file system
1536 largeFileDir = os.path.dirname(localLargeFile)
1537 if not os.path.isdir(largeFileDir):
1538 os.makedirs(largeFileDir)
1539 shutil.move(contentTempFile, localLargeFile)
1540 self.addLargeFile(relPath)
1541 if gitConfigBool('git-p4.largeFilePush'):
1542 self.pushFile(localLargeFile)
1543 if verbose:
1544 sys.stderr.write("%s moved to large file system (%s)\n" % (relPath, localLargeFile))
1545 return (git_mode, contents)
1546
1547
1548class MockLFS(LargeFileSystem):

Callers

nothing calls this directly

Calls 8

hasLargeFileExtensionMethod · 0.95
generateTempFileMethod · 0.95
generatePointerMethod · 0.95
addLargeFileMethod · 0.95
pushFileMethod · 0.95
gitConfigBoolFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected