Commit 87bc689fbf571aa3cbc77e510f14304cc3502ca5

Ben Straub 2012-12-20T15:50:33

git_remote_create calls git_remote_save

diff --git a/include/git2/remote.h b/include/git2/remote.h
index e77deaf..aa3f93c 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -34,7 +34,8 @@ typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, voi
  */
 
 /**
- * Add a remote with the default fetch refspec to the repository's configuration
+ * Add a remote with the default fetch refspec to the repository's configuration.  This
+ * calls git_remote_save before returning.
  *
  * @param out the resulting remote
  * @param repo the repository in which to create the remote
@@ -52,7 +53,8 @@ GIT_EXTERN(int) git_remote_create(
  * Create a remote in memory
  *
  * Create a remote with the given refspec in memory. You can use
- * this when you have a URL instead of a remote's name.
+ * this when you have a URL instead of a remote's name.  Note that in-memory
+ * remotes cannot be converted to persisted remotes.
  *
  * The name, when provided, will be checked for validity.
  * See `git_tag_create()` for rules about valid names.
diff --git a/src/repository.c b/src/repository.c
index ea4be9d..33aaee8 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1141,7 +1141,6 @@ static int repo_init_create_origin(git_repository *repo, const char *url)
 	git_remote *remote;
 
 	if (!(error = git_remote_create(&remote, repo, GIT_REMOTE_ORIGIN, url))) {
-		error = git_remote_save(remote);
 		git_remote_free(remote);
 	}