From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id DC74820966 for ; Sun, 26 Mar 2017 02:44:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751314AbdCZCnt (ORCPT ); Sat, 25 Mar 2017 22:43:49 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33587 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293AbdCZCns (ORCPT ); Sat, 25 Mar 2017 22:43:48 -0400 Received: by mail-pg0-f68.google.com with SMTP id 79so4695595pgf.0 for ; Sat, 25 Mar 2017 19:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b3woIHbCALzbtcjBSfDd4URRnzbCNaQfVshYryolEGg=; b=Wzvq/u+D7ovYYPbjJuGMpgQsVnbrQqKMZK0VzAeF5ivdbERdaEH+voyNhMf5CxMvYn Gejxqx2ASqHayFT8BdyiSJUt2u/M9urS2lc/u9uoCAxedQ/S0IFsPEqnff9nq3udEXk6 b/ZyZDYtJxO9DcAVJiIcMORBvd4qliW6WVeiwt17SCsui1RwrwxdPXxnYKqMGRTtUpue Mc/z82SP3M2tP2sdkg1K65M3nOSry+jWR3FGWUfcTeW0nnfFmOTfcxMFUWd9B9A58pQa u2DgsJzU7W7eiJNpkAQzABGT0pG8/7bkqadvEypbBk40PiKzn4dlKpvBKX6V7pez7pbc CNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b3woIHbCALzbtcjBSfDd4URRnzbCNaQfVshYryolEGg=; b=rWHQCAsjqWeJYNZBA/XtTF7AYmG1nM4LYbwQ1zys8Q/LbTv8P7pJtAbYNKVjaW1E82 UR2gk2Hux2iCshtWlkcuRQ6o5zjxHDjAJIzo5SsZr6Cy3O7H3NnZSnFBoHfjfYyHJ1uD /tRaVbB+vEpIo0zI65JaVgh8PpAkTNQpHKLUVLFJ2SDFQOaf/3qftXTgn8zVFxoWf+6r 1LWmkQLpC2TCzIsh7ukEuNG8CdKoqI/NK7O+Y36kNKT9n9ZAqucGTJ7zxaoI2OL3P3zz mS2+rbIOSuN5jBNlT0qs2evn5VZrdDPasyzocmkTlPJ0/2XeWXGTGl0Jfnbk96RhNg2g 7OIw== X-Gm-Message-State: AFeK/H284jHtmOtUwKKa294DhlHEwn1Lk5N77Dqjx9NPAbjD0IPekXrdOcTJ0KxoeEKFGQ== X-Received: by 10.84.230.129 with SMTP id e1mr20694949plk.66.1490496221971; Sat, 25 Mar 2017 19:43:41 -0700 (PDT) Received: from ash ([115.72.187.186]) by smtp.gmail.com with ESMTPSA id g27sm12811655pfk.95.2017.03.25.19.43.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Mar 2017 19:43:41 -0700 (PDT) Received: by ash (sSMTP sendmail emulation); Sun, 26 Mar 2017 09:43:35 +0700 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Michael Haggerty , Johannes Schindelin , Ramsay Jones , Stefan Beller , novalis@novalis.org, =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Subject: [PATCH v7 08/28] files-backend: move "logs/" out of TMP_RENAMED_LOG Date: Sun, 26 Mar 2017 09:42:21 +0700 Message-Id: <20170326024241.31984-9-pclouds@gmail.com> X-Mailer: git-send-email 2.11.0.157.gd943d85 In-Reply-To: <20170326024241.31984-1-pclouds@gmail.com> References: <20170318020337.22767-1-pclouds@gmail.com> <20170326024241.31984-1-pclouds@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This makes reflog path building consistent, always in the form of strbuf_git_path(sb, "logs/%s", refname); It reduces the mental workload a bit in the next patch when that function call is converted. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 5f9b0ab9bc..3e0bafcaf9 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2510,7 +2510,7 @@ static int files_delete_refs(struct ref_store *ref_store, * IOW, to avoid cross device rename errors, the temporary renamed log must * live into logs/refs. */ -#define TMP_RENAMED_LOG "logs/refs/.tmp-renamed-log" +#define TMP_RENAMED_LOG "refs/.tmp-renamed-log" struct rename_cb { const char *tmp_renamed_log; @@ -2546,7 +2546,7 @@ static int rename_tmp_log(const char *newrefname) int ret; strbuf_git_path(&path, "logs/%s", newrefname); - strbuf_git_path(&tmp, TMP_RENAMED_LOG); + strbuf_git_path(&tmp, "logs/%s", TMP_RENAMED_LOG); cb.tmp_renamed_log = tmp.buf; ret = raceproof_create_file(path.buf, rename_tmp_log_callback, &cb); if (ret) { @@ -2608,7 +2608,7 @@ static int files_rename_ref(struct ref_store *ref_store, strbuf_git_path(&sb_oldref, "logs/%s", oldrefname); strbuf_git_path(&sb_newref, "logs/%s", newrefname); - strbuf_git_path(&tmp_renamed_log, TMP_RENAMED_LOG); + strbuf_git_path(&tmp_renamed_log, "logs/%s", TMP_RENAMED_LOG); log = !lstat(sb_oldref.buf, &loginfo); if (log && S_ISLNK(loginfo.st_mode)) { @@ -2633,7 +2633,7 @@ static int files_rename_ref(struct ref_store *ref_store, } if (log && rename(sb_oldref.buf, tmp_renamed_log.buf)) { - ret = error("unable to move logfile logs/%s to "TMP_RENAMED_LOG": %s", + ret = error("unable to move logfile logs/%s to logs/"TMP_RENAMED_LOG": %s", oldrefname, strerror(errno)); goto out; } @@ -2719,7 +2719,7 @@ static int files_rename_ref(struct ref_store *ref_store, oldrefname, newrefname, strerror(errno)); if (!logmoved && log && rename(tmp_renamed_log.buf, sb_oldref.buf)) - error("unable to restore logfile %s from "TMP_RENAMED_LOG": %s", + error("unable to restore logfile %s from logs/"TMP_RENAMED_LOG": %s", oldrefname, strerror(errno)); ret = 1; out: -- 2.11.0.157.gd943d85