@@ -1463,7 +1463,7 @@ def __init__(self, writeToGitStream):
1463
1463
self .largeFiles = set ()
1464
1464
self .writeToGitStream = writeToGitStream
1465
1465
1466
- def generatePointer (self , cloneDestination , contentFile ):
1466
+ def generatePointer (self , contentFile ):
1467
1467
"""Return the content of a pointer file that is stored in Git instead
1468
1468
of the actual content.
1469
1469
"""
@@ -1517,20 +1517,14 @@ def removeLargeFile(self, relPath):
1517
1517
def isLargeFile (self , relPath ):
1518
1518
return relPath in self .largeFiles
1519
1519
1520
- def processContent (self , git_mode , relPath , contents ):
1520
+ def processContent (self , relPath , contents ):
1521
1521
"""Processes the content of git fast import. This method decides if a
1522
1522
file is stored in the large file system and handles all necessary
1523
1523
steps.
1524
1524
"""
1525
- # symlinks aren't processed by smudge/clean filters
1526
- if git_mode == "120000" :
1527
- return (git_mode , contents )
1528
-
1529
1525
if self .exceedsLargeFileThreshold (relPath , contents ) or self .hasLargeFileExtension (relPath ):
1530
1526
contentTempFile = self .generateTempFile (contents )
1531
- pointer_git_mode , contents , localLargeFile = self .generatePointer (contentTempFile )
1532
- if pointer_git_mode :
1533
- git_mode = pointer_git_mode
1527
+ contents , localLargeFile = self .generatePointer (contentTempFile )
1534
1528
if localLargeFile :
1535
1529
# Move temp file to final location in large file system
1536
1530
largeFileDir = os .path .dirname (localLargeFile )
@@ -1542,7 +1536,7 @@ def processContent(self, git_mode, relPath, contents):
1542
1536
self .pushFile (localLargeFile )
1543
1537
if verbose :
1544
1538
sys .stderr .write ("%s moved to large file system (%s)\n " % (relPath , localLargeFile ))
1545
- return ( git_mode , contents )
1539
+ return contents
1546
1540
1547
1541
1548
1542
class MockLFS (LargeFileSystem ):
@@ -1555,10 +1549,9 @@ def generatePointer(self, contentFile):
1555
1549
"""
1556
1550
with open (contentFile , 'r' ) as f :
1557
1551
content = next (f )
1558
- gitMode = '100644'
1559
1552
pointerContents = 'pointer-' + content
1560
1553
localLargeFile = os .path .join (os .getcwd (), '.git' , 'mock-storage' , 'local' , content [:- 1 ])
1561
- return (gitMode , pointerContents , localLargeFile )
1554
+ return (pointerContents , localLargeFile )
1562
1555
1563
1556
def pushFile (self , localLargeFile ):
1564
1557
"""The remote filename of the large file storage is the same as the
@@ -1586,7 +1579,7 @@ def generatePointer(self, contentFile):
1586
1579
content.
1587
1580
"""
1588
1581
if os .path .getsize (contentFile ) == 0 :
1589
- return (None , '' , None )
1582
+ return ('' , None )
1590
1583
1591
1584
pointerProcess = subprocess .Popen (
1592
1585
['git' , 'lfs' , 'pointer' , '--file=' + contentFile ],
@@ -1616,9 +1609,7 @@ def generatePointer(self, contentFile):
1616
1609
'objects' , oid [:2 ], oid [2 :4 ],
1617
1610
oid ,
1618
1611
)
1619
- # LFS Spec states that pointer files should not have the executable bit set.
1620
- gitMode = '100644'
1621
- return (gitMode , pointerFile , localLargeFile )
1612
+ return (pointerFile , localLargeFile )
1622
1613
1623
1614
def pushFile (self , localLargeFile ):
1624
1615
uploadProcess = subprocess .Popen (
@@ -1652,12 +1643,12 @@ def removeLargeFile(self, relPath):
1652
1643
LargeFileSystem .removeLargeFile (self , relPath )
1653
1644
self .writeToGitStream ('100644' , '.gitattributes' , self .generateGitAttributes ())
1654
1645
1655
- def processContent (self , git_mode , relPath , contents ):
1646
+ def processContent (self , relPath , contents ):
1656
1647
if relPath == '.gitattributes' :
1657
1648
self .baseGitAttributes = contents
1658
- return ( git_mode , self .generateGitAttributes () )
1649
+ return self .generateGitAttributes ()
1659
1650
else :
1660
- return LargeFileSystem .processContent (self , git_mode , relPath , contents )
1651
+ return LargeFileSystem .processContent (self , relPath , contents )
1661
1652
1662
1653
1663
1654
class Command :
@@ -3217,8 +3208,9 @@ def streamOneP4File(self, file, contents):
3217
3208
if regexp :
3218
3209
contents = [regexp .sub (br'$\1$' , c ) for c in contents ]
3219
3210
3220
- if self .largeFileSystem :
3221
- git_mode , contents = self .largeFileSystem .processContent (git_mode , relPath , contents )
3211
+ # symlinks aren't processed by smudge/clean filters
3212
+ if git_mode != '120000' and self .largeFileSystem :
3213
+ contents = self .largeFileSystem .processContent (relPath , contents )
3222
3214
3223
3215
self .writeToGitStream (git_mode , relPath , contents )
3224
3216
0 commit comments