Commit cc5851c
cat-file: make remote-object-info allow-list dynamic
The static allow-list in expand_atom() is hardcoded to only allow
"objectname" and "objectsize" for remote queries. This works because
up to this point all servers will either support object-info with name
and size or they do not support them at all, but we cannot expect that
in a future different servers with different git versions to have the
same object-info capabilities. Therefore, the allow_list needs to be
dynamic depending on what the server advertises.
The client will now:
1. Request the protocol option that the placeholder refers to (i.e.
"size" when "%(objectsize)").
2. Filters the request in fetch_object_info() dropping any option that
the server does not advertise.
3. After the fetching, the options that haven't been dropped are the ones
fetched and supported by the server, these supported options are
mapped and remote_allowed_atoms is populated with the placeholders.
4. expand_atom() checks remote_allowed_atoms with the same behaviour as
the static allow_list had.
Move object_info_options out of get_remote_info so the caller which has
data can select what options will be requested instead of requesting
always size.
Move batch_object_write() out so there will always be an output even if
all the placeholders are not supported by the server (returns an empty
line).
Include "type" in the object_info_options so once the server supports
it, the clients know already how to request it.
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Mentored-by: Chandra Pratap <chandrapratap3519@gmail.com>
Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent b2f69fa commit cc5851c
2 files changed
Lines changed: 84 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
345 | | - | |
346 | 344 | | |
347 | | - | |
348 | | - | |
349 | | - | |
| 345 | + | |
350 | 346 | | |
| 347 | + | |
| 348 | + | |
351 | 349 | | |
352 | 350 | | |
353 | 351 | | |
| |||
359 | 357 | | |
360 | 358 | | |
361 | 359 | | |
362 | | - | |
363 | | - | |
364 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
365 | 363 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 364 | + | |
373 | 365 | | |
374 | 366 | | |
375 | 367 | | |
| |||
685 | 677 | | |
686 | 678 | | |
687 | 679 | | |
688 | | - | |
| 680 | + | |
| 681 | + | |
689 | 682 | | |
690 | 683 | | |
691 | 684 | | |
692 | 685 | | |
693 | | - | |
694 | 686 | | |
695 | 687 | | |
696 | 688 | | |
| |||
738 | 730 | | |
739 | 731 | | |
740 | 732 | | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
| 733 | + | |
| 734 | + | |
745 | 735 | | |
746 | 736 | | |
747 | 737 | | |
748 | 738 | | |
749 | | - | |
750 | 739 | | |
751 | 740 | | |
752 | 741 | | |
| |||
832 | 821 | | |
833 | 822 | | |
834 | 823 | | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
835 | 839 | | |
836 | 840 | | |
837 | 841 | | |
| |||
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
| 848 | + | |
844 | 849 | | |
845 | 850 | | |
846 | 851 | | |
| |||
853 | 858 | | |
854 | 859 | | |
855 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
856 | 866 | | |
857 | | - | |
| 867 | + | |
858 | 868 | | |
859 | 869 | | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
860 | 877 | | |
861 | 878 | | |
| 879 | + | |
862 | 880 | | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
863 | 885 | | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | 886 | | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
| 887 | + | |
875 | 888 | | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
876 | 905 | | |
877 | 906 | | |
878 | 907 | | |
879 | 908 | | |
880 | 909 | | |
881 | 910 | | |
| 911 | + | |
882 | 912 | | |
883 | 913 | | |
884 | 914 | | |
| |||
1194 | 1224 | | |
1195 | 1225 | | |
1196 | 1226 | | |
| 1227 | + | |
1197 | 1228 | | |
1198 | 1229 | | |
1199 | 1230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
58 | 78 | | |
59 | 79 | | |
60 | 80 | | |
| |||
0 commit comments