]> git.proxmox.com Git - libgit2.git/commitdiff
remote: use constants for well-known names
authornulltoken <emeric.fermas@gmail.com>
Sun, 7 Oct 2012 19:00:46 +0000 (21:00 +0200)
committernulltoken <emeric.fermas@gmail.com>
Sun, 7 Oct 2012 19:03:37 +0000 (21:03 +0200)
src/clone.c
src/remote.h
src/repository.c

index 9dfc22c591b937a2a66b9912b55f6df2e959b24a..211288c2ca403c9e0f782cc312579613126543f8 100644 (file)
@@ -51,7 +51,7 @@ static int create_tracking_branch(git_repository *repo, const git_oid *target, c
                        if (!git_buf_printf(&remote, "branch.%s.remote", name) &&
                                 !git_buf_printf(&merge, "branch.%s.merge", name) &&
                                 !git_buf_printf(&merge_target, GIT_REFS_HEADS_DIR "%s", name) &&
-                                !git_config_set_string(cfg, git_buf_cstr(&remote), "origin") &&
+                                !git_config_set_string(cfg, git_buf_cstr(&remote), GIT_REMOTE_ORIGIN) &&
                                 !git_config_set_string(cfg, git_buf_cstr(&merge), git_buf_cstr(&merge_target))) {
                                retcode = 0;
                        }
@@ -150,7 +150,7 @@ static int setup_remotes_and_fetch(git_repository *repo,
        if (!fetch_stats) fetch_stats = &dummy_stats;
 
        /* Create the "origin" remote */
-       if (!git_remote_add(&origin, repo, "origin", origin_url)) {
+       if (!git_remote_add(&origin, repo, GIT_REMOTE_ORIGIN, origin_url)) {
                /* Connect and download everything */
                if (!git_remote_connect(origin, GIT_DIR_FETCH)) {
                        if (!git_remote_download(origin, &bytes, fetch_stats)) {
index b8bb2c55d5b6132a17b1c8af545541dd2a3ad27b..05073db8c84009774e191ede63385e5d8ed2facf 100644 (file)
@@ -13,6 +13,8 @@
 #include "transport.h"
 #include "repository.h"
 
+#define GIT_REMOTE_ORIGIN "origin"
+
 struct git_remote {
        char *name;
        char *url;
index 1641129d3da42d2ca4d9cc3d325e60d18beb3574..1b49228fbff1a75a05e78e41273b318ea7fc2c99 100644 (file)
@@ -19,6 +19,7 @@
 #include "refs.h"
 #include "filter.h"
 #include "odb.h"
+#include "remote.h"
 
 #define GIT_FILE_CONTENT_PREFIX "gitdir:"
 
@@ -1095,7 +1096,7 @@ static int repo_init_create_origin(git_repository *repo, const char *url)
        int error;
        git_remote *remote;
 
-       if (!(error = git_remote_add(&remote, repo, "origin", url))) {
+       if (!(error = git_remote_add(&remote, repo, GIT_REMOTE_ORIGIN, url))) {
                error = git_remote_save(remote);
                git_remote_free(remote);
        }