summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-05-28 10:13:07 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2015-05-28 10:13:07 -0400
commitfb92b48d541edde845e8cde176152f13592db71b (patch)
tree3fe5e8316c6bb9ffa33bfee48372ee11a1b8196d /src
parent2b92283221114843c36e4e6372b5b793b2d5ffff (diff)
parent5014fe95f5691ec9c48e1bb33fa03d925a4159f0 (diff)
downloadlibgit2-fb92b48d541edde845e8cde176152f13592db71b.tar.gz
Merge pull request #3149 from libgit2/cmn/upstream-matching-push
Fill the pointers for matching refspecs
Diffstat (limited to 'src')
-rw-r--r--src/branch.c9
-rw-r--r--src/refspec.c6
2 files changed, 12 insertions, 3 deletions
diff --git a/src/branch.c b/src/branch.c
index 10be6f70c..791d55106 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -551,7 +551,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
git_remote *remote = NULL;
git_config *config;
const char *name, *shortname;
- int local;
+ int local, error;
const git_refspec *fetchspec;
name = git_reference_name(branch);
@@ -586,9 +586,12 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
* that.
*/
if (local)
- git_buf_puts(&value, ".");
+ error = git_buf_puts(&value, ".");
else
- git_branch_remote_name(&value, repo, git_reference_name(upstream));
+ error = git_branch_remote_name(&value, repo, git_reference_name(upstream));
+
+ if (error < 0)
+ goto on_error;
if (git_buf_printf(&key, "branch.%s.remote", shortname) < 0)
goto on_error;
diff --git a/src/refspec.c b/src/refspec.c
index ad8141248..961f939c6 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -42,6 +42,12 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
*/
if (!is_fetch && rhs == lhs && rhs[1] == '\0') {
refspec->matching = 1;
+ refspec->string = git__strdup(input);
+ GITERR_CHECK_ALLOC(refspec->string);
+ refspec->src = git__strdup("");
+ GITERR_CHECK_ALLOC(refspec->src);
+ refspec->dst = git__strdup("");
+ GITERR_CHECK_ALLOC(refspec->dst);
return 0;
}