Arabic hadith text
وَحَدَّثَنِي عَنْ مَالِكٍ، أَنَّهُ سَأَلَ ابْنَ شِهَابٍ وَنَافِعًا مَوْلَى ابْنِ عُمَرَ عَنْ رَجُلٍ، دَخَلَ مَعَ الإِمَامِ فِي الصَّلاَةِ وَقَدْ سَبَقَهُ الإِمَامُ بِرَكْعَةٍ أَيَتَشَهَّدُ مَعَهُ فِي الرَّكْعَتَيْنِ وَالأَرْبَعِ وَإِنْ كَانَ ذَلِكَ لَهُ وِتْرًا فَقَالاَ لِيَتَشَهَّدْ مَعَهُ ‏.‏ قَالَ مَالِكٌ وَهُوَ الأَمْرُ عِنْدَنَا ‏.‏
Translation

Yahya related to me from Malik that he asked Ibn Shihab and Nafi,the mawla of Ibn Umar, whether a man who joined an imam who hadalready done a raka should say the tashahhud with the imam in thesecond and fourth rakas, even though these were odd for him? Theysaid, "He should say tashahhud with him."

Malik said, "Thatis the position with us."