diff options
| author | Heiko Voigt <hvoigt@hvoigt.net> | 2019-04-26 15:59:49 +0200 |
|---|---|---|
| committer | Heiko Voigt <hvoigt@hvoigt.net> | 2019-05-03 13:38:26 +0200 |
| commit | d55bb479ddad2e8feaed7bf3e1773cf344db108c (patch) | |
| tree | 6cc30bf9d17ad61e33aeea4c0412b60a44b3e3a2 /src | |
| parent | af95615faa87d3181fb5e8bc140c1aa6a8eda085 (diff) | |
| download | libgit2-d55bb479ddad2e8feaed7bf3e1773cf344db108c.tar.gz | |
git_revwalk_push_range: do not crash if range is missing
If someone passes just one ref (i.e. "master") and misses passing the
range we should be nice and return an error code instead of crashing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/revwalk.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/revwalk.c b/src/revwalk.c index 6d12d34eb..9428cc6c0 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -194,6 +194,12 @@ int git_revwalk_push_range(git_revwalk *walk, const char *range) if ((error = git_revparse(&revspec, walk->repo, range))) return error; + if (!revspec.to) { + git_error_set(GIT_ERROR_INVALID, "invalid revspec. Only range supported."); + error = GIT_EINVALIDSPEC; + goto out; + } + if (revspec.flags & GIT_REVPARSE_MERGE_BASE) { /* TODO: support "<commit>...<commit>" */ git_error_set(GIT_ERROR_INVALID, "symmetric differences not implemented in revwalk"); |
