Commit 93cfa7c
committed
approxidate_careful() reports errorneous date string
For a long time, the time based reflog syntax (e.g. master@{yesterday})
didn't complain when the "human readable" timestamp was misspelled, as
the underlying mechanism tried to be as lenient as possible. The funny
thing was that parsing of "@{now}" even relied on the fact that anything
not recognized by the machinery returned the current timestamp.
Introduce approxidate_careful() that takes an optional pointer to an
integer, that gets assigned 1 when the input does not make sense as a
timestamp.
As I am too lazy to fix all the callers that use approxidate(), most of
the callers do not take advantage of the error checking, but convert the
code to parse reflog to use it as a demonstration.
Tests are mostly from Jeff King.
Signed-off-by: Junio C Hamano <[email protected]>1 parent 35eabd1 commit 93cfa7c
4 files changed
+86
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
740 | 740 | | |
741 | 741 | | |
742 | 742 | | |
743 | | - | |
| 743 | + | |
| 744 | + | |
744 | 745 | | |
745 | 746 | | |
746 | 747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
699 | 704 | | |
700 | 705 | | |
701 | 706 | | |
| |||
770 | 775 | | |
771 | 776 | | |
772 | 777 | | |
| 778 | + | |
773 | 779 | | |
774 | 780 | | |
775 | 781 | | |
| |||
790 | 796 | | |
791 | 797 | | |
792 | 798 | | |
793 | | - | |
| 799 | + | |
794 | 800 | | |
795 | 801 | | |
796 | 802 | | |
| |||
804 | 810 | | |
805 | 811 | | |
806 | 812 | | |
| 813 | + | |
807 | 814 | | |
808 | 815 | | |
809 | 816 | | |
| |||
812 | 819 | | |
813 | 820 | | |
814 | 821 | | |
| 822 | + | |
815 | 823 | | |
816 | 824 | | |
817 | 825 | | |
| |||
821 | 829 | | |
822 | 830 | | |
823 | 831 | | |
| 832 | + | |
824 | 833 | | |
825 | 834 | | |
826 | 835 | | |
827 | | - | |
| 836 | + | |
828 | 837 | | |
| 838 | + | |
| 839 | + | |
829 | 840 | | |
830 | 841 | | |
831 | 842 | | |
| |||
835 | 846 | | |
836 | 847 | | |
837 | 848 | | |
| 849 | + | |
838 | 850 | | |
839 | 851 | | |
840 | 852 | | |
| |||
852 | 864 | | |
853 | 865 | | |
854 | 866 | | |
| 867 | + | |
855 | 868 | | |
856 | 869 | | |
857 | 870 | | |
| |||
866 | 879 | | |
867 | 880 | | |
868 | 881 | | |
| 882 | + | |
869 | 883 | | |
870 | 884 | | |
871 | 885 | | |
872 | 886 | | |
873 | 887 | | |
874 | 888 | | |
875 | 889 | | |
| 890 | + | |
876 | 891 | | |
877 | 892 | | |
878 | 893 | | |
| |||
929 | 944 | | |
930 | 945 | | |
931 | 946 | | |
932 | | - | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
933 | 950 | | |
934 | 951 | | |
| 952 | + | |
935 | 953 | | |
936 | 954 | | |
937 | 955 | | |
| |||
951 | 969 | | |
952 | 970 | | |
953 | 971 | | |
| 972 | + | |
954 | 973 | | |
955 | 974 | | |
956 | 975 | | |
957 | | - | |
| 976 | + | |
958 | 977 | | |
959 | 978 | | |
| 979 | + | |
| 980 | + | |
960 | 981 | | |
961 | 982 | | |
962 | 983 | | |
963 | 984 | | |
964 | 985 | | |
965 | 986 | | |
| 987 | + | |
966 | 988 | | |
967 | 989 | | |
968 | 990 | | |
969 | 991 | | |
970 | | - | |
| 992 | + | |
971 | 993 | | |
972 | 994 | | |
973 | | - | |
| 995 | + | |
974 | 996 | | |
975 | 997 | | |
976 | 998 | | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
977 | 1002 | | |
978 | | - | |
| 1003 | + | |
| 1004 | + | |
979 | 1005 | | |
| 1006 | + | |
980 | 1007 | | |
981 | 1008 | | |
982 | | - | |
| 1009 | + | |
983 | 1010 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| 398 | + | |
398 | 399 | | |
399 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
400 | 403 | | |
401 | 404 | | |
402 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments