Merge branch 'dl/subtree-avoid-tricky-echo'
[gitweb.git] / builtin / fetch.c
index 75a55e590bdc3411e5e4aeee6275fbfff4451904..7910419c93275c58f4881202905ae1f24bfe8c91 100644 (file)
@@ -415,8 +415,10 @@ static int s_update_ref(const char *action,
 
        transaction = ref_transaction_begin(&err);
        if (!transaction ||
-           ref_transaction_update(transaction, ref->name, ref->new_sha1,
-                                  ref->old_sha1, 0, check_old, msg, &err))
+           ref_transaction_update(transaction, ref->name,
+                                  ref->new_sha1,
+                                  check_old ? ref->old_sha1 : NULL,
+                                  0, msg, &err))
                goto fail;
 
        ret = ref_transaction_commit(transaction, &err);
@@ -586,7 +588,8 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
        struct strbuf note = STRBUF_INIT;
        const char *what, *kind;
        struct ref *rm;
-       char *url, *filename = dry_run ? "/dev/null" : git_path("FETCH_HEAD");
+       char *url;
+       const char *filename = dry_run ? "/dev/null" : git_path("FETCH_HEAD");
        int want_status;
 
        fp = fopen(filename, "a");
@@ -820,7 +823,7 @@ static void check_not_current_branch(struct ref *ref_map)
 
 static int truncate_fetch_head(void)
 {
-       char *filename = git_path("FETCH_HEAD");
+       const char *filename = git_path("FETCH_HEAD");
        FILE *fp = fopen(filename, "w");
 
        if (!fp)