forked fromgitpython-developers/GitPython
- Notifications
You must be signed in to change notification settings - Fork0
Commit8f043d8
committed
fix(index): don't write extension data by default
It turned out that the index is not actually corrupted, which is goodnews. What happens is that `git` writes `TREE` extension data into theindex, which causes it to write out the given tree *as is* next timea `git commit` is executed. When using `git add`, this extension datais maintained automatically. However, GitPython doesn't do that ... .Usually this is no problem at all, as you are supposed to use`IndexFile.commit(...)` along with `IndexFile.add(...)`.Thanks to a shortcoming in the GitPython API, the index wasautomatically written out whenever files have been added, withoutproviding control over whether or not *extension data* will bewritten along with it.My fix consists of an additional flag in `IndexFile.add(...)`, whichcauses extension data not to be written by default, so commits can besafely done via `git commit` or `IndexFile.commit(...)`.However, this might introduce new subtle bugs in case someone isrelying on extension data to be written. As this can be controlledthrough the said flag though, a fix is easily done in that case.Fixesgitpython-developers#2651 parentab7c322 commit8f043d8
3 files changed
+31
-27
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
5 | 11 |
| |
6 | 12 |
| |
7 | 13 |
| |
|
Lines changed: 25 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
172 | 172 |
| |
173 | 173 |
| |
174 | 174 |
| |
175 |
| - | |
| 175 | + | |
176 | 176 |
| |
177 |
| - | |
178 |
| - | |
179 |
| - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
180 | 181 |
| |
181 | 182 |
| |
182 | 183 |
| |
183 | 184 |
| |
184 |
| - | |
| 185 | + | |
185 | 186 |
| |
186 | 187 |
| |
187 | 188 |
| |
| |||
190 | 191 |
| |
191 | 192 |
| |
192 | 193 |
| |
193 |
| - | |
| 194 | + | |
194 | 195 |
| |
195 |
| - | |
| 196 | + | |
| 197 | + | |
196 | 198 |
| |
197 | 199 |
| |
198 | 200 |
| |
| |||
208 | 210 |
| |
209 | 211 |
| |
210 | 212 |
| |
211 |
| - | |
| 213 | + | |
212 | 214 |
| |
213 | 215 |
| |
214 | 216 |
| |
| |||
612 | 614 |
| |
613 | 615 |
| |
614 | 616 |
| |
615 |
| - | |
| 617 | + | |
616 | 618 |
| |
617 | 619 |
| |
618 | 620 |
| |
| |||
689 | 691 |
| |
690 | 692 |
| |
691 | 693 |
| |
692 |
| - | |
693 |
| - | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
694 | 707 |
| |
695 | 708 |
| |
696 | 709 |
| |
| |||
763 | 776 |
| |
764 | 777 |
| |
765 | 778 |
| |
766 |
| - | |
| 779 | + | |
767 | 780 |
| |
768 | 781 |
| |
769 | 782 |
| |
|
Lines changed: 0 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 |
| - | |
48 | 47 |
| |
49 | 48 |
| |
50 |
| - | |
51 |
| - | |
52 | 49 |
| |
53 | 50 |
| |
54 | 51 |
| |
| |||
768 | 765 |
| |
769 | 766 |
| |
770 | 767 |
| |
771 |
| - | |
772 |
| - | |
773 |
| - | |
774 |
| - | |
775 |
| - | |
776 |
| - | |
777 |
| - | |
778 |
| - | |
779 |
| - | |
780 |
| - | |
781 |
| - | |
782 |
| - |
0 commit comments
Comments
(0)