@@ -1639,6 +1639,8 @@ EXAMPLES
16391639 dest = 'max_blob_size' , default = 0 ,
16401640 help = _ ("Strip blobs (files) bigger than specified size (e.g. '5M', "
16411641 "'2G', etc)" ))
1642+ contents .add_argument ('--strip-blobs-with-ids' , metavar = 'BLOB-ID-FILENAME' ,
1643+ help = _ ("Strip blob with the specified git object ids (hashes)" ))
16421644
16431645 refrename = parser .add_argument_group (title = _ ("Renaming of refs "
16441646 "(see also --refname-callback)" ))
@@ -1926,6 +1928,11 @@ EXAMPLES
19261928 args .mailmap = MailmapInfo (args .mailmap )
19271929 if args .replace_text :
19281930 args .replace_text = FilteringOptions .get_replace_text (args .replace_text )
1931+ if args .strip_blobs_with_ids :
1932+ with open (args .strip_blobs_with_ids , 'br' ) as f :
1933+ args .strip_blobs_with_ids = set (f .read ().split ())
1934+ else :
1935+ args .strip_blobs_with_ids = set ()
19291936 return args
19301937
19311938class RepoAnalyze (object ):
@@ -2919,6 +2926,9 @@ class RepoFilter(object):
29192926 if self ._args .max_blob_size and len (blob .data ) > self ._args .max_blob_size :
29202927 blob .skip ()
29212928
2929+ if blob .original_id in self ._args .strip_blobs_with_ids :
2930+ blob .skip ()
2931+
29222932 if self ._args .replace_text :
29232933 for literal , replacement in self ._args .replace_text ['literals' ]:
29242934 blob .data = blob .data .replace (literal , replacement )
@@ -3051,6 +3061,10 @@ class RepoFilter(object):
30513061 if self ._args .max_blob_size and \
30523062 self ._unpacked_size .get (change .blob_id , 0 ) > self ._args .max_blob_size :
30533063 continue
3064+ if self ._args .strip_blobs_with_ids and \
3065+ change .blob_id in self ._args .strip_blobs_with_ids :
3066+ continue
3067+ # Otherwise, record the change
30543068 new_file_changes [change .filename ] = change
30553069 commit .file_changes = [v for k ,v in sorted (new_file_changes .items ())]
30563070
0 commit comments