@@ -643,7 +643,6 @@ def _preprocess_add_items(self, items):
643643 # END for each item
644644 return (paths , entries )
645645
646- @default_index
647646 def add (self , items , force = True , fprogress = lambda * args : None , path_rewriter = None ):
648647 """Add files from the working tree, specific blobs or BaseIndexEntries
649648 to the index. The underlying index file will be written immediately, hence
@@ -734,7 +733,9 @@ def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=Non
734733 for path in paths :
735734 abspath = os .path .abspath (path )
736735 gitrelative_path = abspath [len (self .repo .working_tree_dir )+ 1 :]
737- blob = Blob (self .repo , Blob .NULL_HEX_SHA , os .stat (abspath ).st_mode , gitrelative_path )
736+ blob = Blob (self .repo , Blob .NULL_HEX_SHA ,
737+ self ._stat_mode_to_index_mode (os .stat (abspath ).st_mode ),
738+ gitrelative_path )
738739 entries .append (BaseIndexEntry .from_blob (blob ))
739740 # END for each path
740741 del (paths [:])
@@ -754,7 +755,8 @@ def store_path(filepath):
754755 istream = self .repo .odb .store (IStream (Blob .type , st .st_size , stream ))
755756 fprogress (filepath , True , filepath )
756757
757- return BaseIndexEntry ((st .st_mode , istream .sha , 0 , filepath ))
758+ return BaseIndexEntry ((self ._stat_mode_to_index_mode (st .st_mode ),
759+ istream .sha , 0 , filepath ))
758760 # END utility method
759761
760762
@@ -799,36 +801,21 @@ def store_path(filepath):
799801 # END for each entry
800802 # END handle path rewriting
801803
802- # feed pure entries to stdin
803- proc = self .repo .git .update_index (index_info = True , istream = subprocess .PIPE , as_process = True )
804- lem1 = len (entries )- 1
804+ # just go through the remaining entries and provide progress info
805805 for i , entry in enumerate (entries ):
806806 progress_sent = i in null_entries_indices
807807 if not progress_sent :
808808 fprogress (entry .path , False , entry )
809-
810- proc .stdin .write (str (entry ))
811-
812- # the last entry is not \n terminated, as it exepcts to read
813- # another entry then and would block. Hence we skip the last one
814- if i != lem1 :
815- proc .stdin .write ('\n ' )
816- proc .stdin .flush ()
817- # END skip last newline
818-
819- if not progress_sent :
820809 fprogress (entry .path , True , entry )
810+ # END handle progress
821811 # END for each enty
822- self ._flush_stdin_and_wait (proc , ignore_stdout = True )
823812 entries_added .extend (entries )
824813 # END if there are base entries
825814
826815 # FINALIZE
827816 # add the new entries to this instance, and write it
828817 for entry in entries_added :
829818 self .entries [(entry .path , 0 )] = IndexEntry .from_base (entry )
830-
831- # finally write the changed index
832819 self .write ()
833820
834821 return entries_added
0 commit comments