diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-04-20 19:13:47 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-04-20 19:45:40 +0200 |
commit | 1be680c4d0909ee5160292d7b56c4522c4bc309c (patch) | |
tree | 605d1eeee4933f727219d8c8d7fd8fd23a09c133 /src/refspec.c | |
parent | bc6374eac485ab9ad9cfd7165b6d071c3dcb673a (diff) | |
download | libgit2-1be680c4d0909ee5160292d7b56c4522c4bc309c.tar.gz |
refspec: unify the string and parsed data
It used to be separate as an attempt to make the querying easier, but
it didn't work out that way, so put all the data together.
Add git_refspec_string() as well to get the original string, which is
now stored alongside the independent parts.
Diffstat (limited to 'src/refspec.c')
-rw-r--r-- | src/refspec.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/refspec.c b/src/refspec.c index 0ed02f48b..fbdea9d93 100644 --- a/src/refspec.c +++ b/src/refspec.c @@ -120,6 +120,9 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch) } } + refspec->string = git__strdup(input); + GITERR_CHECK_ALLOC(refspec->string); + return 0; invalid: @@ -133,6 +136,7 @@ void git_refspec__free(git_refspec *refspec) git__free(refspec->src); git__free(refspec->dst); + git__free(refspec->string); } const char *git_refspec_src(const git_refspec *refspec) @@ -145,6 +149,11 @@ const char *git_refspec_dst(const git_refspec *refspec) return refspec == NULL ? NULL : refspec->dst; } +const char *git_refspec_string(const git_refspec *refspec) +{ + return refspec == NULL ? NULL : refspec->string; +} + int git_refspec_force(const git_refspec *refspec) { assert(refspec); |