Fix an edge case in rev_parse. #140

merged 1 commit into from Sep 4, 2012


None yet
3 participants

sbryant commented Sep 2, 2012

The Problem

Calling #rev_parse with a revision to parse that includes a ref and a path that contains .. in the filename.
Example HEAD:path/to/file/with/two..dots_in_the_file_name

This will attempt to split and then rev_parse on the two parts. At best we'll get an error and git will tell us that the path doesn't exist. At worst we'll run into a situation where that fille will exist and we will be returning bad information.

The Fix

Just don't split on revision specifiers that contain :.

Fix an edge case in rev_parse.
Make sure we don't split on a `ref:path' revision.

vmg commented Sep 2, 2012

This works, but is not pretty. On the other hand, rev-parse is not pretty, and I don't think there's any way to make it pretty.



rtomayko commented Sep 4, 2012

God, why? Can't you just call rev-parse twice?


vmg commented Sep 4, 2012

@rtomayko: I don't follow. How would that fix the issue? The paths becomes broken after the first rev-parse.


rtomayko commented Sep 4, 2012

Sorry, I misread the diff and thought you were adding splitting which makes no sense to me in the first place. Sigh. Merging.

rtomayko added a commit that referenced this pull request Sep 4, 2012

Merge pull request #140 from sbryant/fix_rev_parse
Fix an edge case in rev_parse.

@rtomayko rtomayko merged commit 4cdb531 into mojombo:master Sep 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment