Sahl b. Mu'adh reported his father as saying:
We went on an expedition with the Prophet and the people occupied so much space that they encroached on the road,* so God’s Prophet sent a man to announce among the people, “Those who occupy much space or encroach on the road will not be credited with jihad.”
* This refers to times when they were encamping.
Abu Dawud transmitted it.