Community
Participate
Working Groups
I pasted in a commit in the open commit slideout and it said "not found." So I fetched the remote repo again, tried again. Still not found. Then figured out that I had a blank space at the end of my commit name. (one could argue that the slideout should trim the spaces...let me know what you think).
Space is not a valid SHA-1 character, so a simple regex validator should be enough to let you know there is something wrong with the commit name.
(In reply to comment #1) > Space is not a valid SHA-1 character, so a simple regex validator should be > enough to let you know there is something wrong with the commit name. If I use a commit hash with blank spaces at the end in Google, it will find the commit anyway. So I guess this is what Susan expects from our open commit slideout. "Find File Named..." dialog also trims white spaces. But "Find Text" in Eclipse SDK does not. I agree with Tomek to rather use field validators in open commit than trim commit hash.
(In reply to comment #2) > (In reply to comment #1) > > Space is not a valid SHA-1 character, so a simple regex validator should be > > enough to let you know there is something wrong with the commit name. > > If I use a commit hash with blank spaces at the end in Google, it will find the > commit anyway. So I guess this is what Susan expects from our open commit > slideout. "Find File Named..." dialog also trims white spaces. But "Find Text" > in Eclipse SDK does not. I agree with Tomek to rather use field validators in > open commit than trim commit hash. I really didn't have any expectations at all when it happened. At the time, I didn't realize there was a space at the end, as I had just copied the commit id out of a bug. So it was confusing until I realized the problem.
(In reply to comment #2) > I agree with Tomek to rather use field validators in > open commit than trim commit hash. I agree we should have a validator to make sure the input is well-formed. At the same time, I don't see a problem with trimming leading/trailing whitespace as well. If the trimmed result is a valid hash then use it. This would be a common problem when copying/pasting the commit hash from somewhere else. On Git command line extra whitespace would not cause any problem.
I trim blanks in the slideout code now, so my original problem is handled. You can either close this bug or keep it open if you want to think about smarter validation for SHA.
Marking FIXED. I raised bug 380512 for adding validators.