t/t4102-apply-rename.sh: avoid "test <cond> -a/-o <cond>"
[gitweb.git] / builtin / checkout.c
index d3fc3a8532078fe2064c0418ca3dcc740423570f..f1dc56e55f7b2200412142b10517458ccfda2952 100644 (file)
@@ -624,7 +624,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
                /* Nothing to do. */
        } else if (opts->force_detach || !new->path) {  /* No longer on any branch. */
                update_ref(msg.buf, "HEAD", new->commit->object.sha1, NULL,
-                          REF_NODEREF, DIE_ON_ERR);
+                          REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
                if (!opts->quiet) {
                        if (old->path && advice_detached_head)
                                detach_advice(new->name);
@@ -651,10 +651,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
                        }
                }
                if (old->path && old->name) {
-                       char ref_file[PATH_MAX];
-
-                       git_snpath(ref_file, sizeof(ref_file), "%s", old->path);
-                       if (!file_exists(ref_file) && reflog_exists(old->path))
+                       if (!ref_exists(old->path) && reflog_exists(old->path))
                                delete_reflog(old->path);
                }
        }