git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Hjemli <hjemli@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: Geert Bosch <bosch@gnat.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org
Subject: [PATCH] rename_ref(): only print a warning when config-file update fails
Date: Fri,  6 Apr 2007 10:33:06 +0200	[thread overview]
Message-ID: <11758483861506-git-send-email-hjemli@gmail.com> (raw)

If git_config_rename_section() fails, rename_ref() used to return 1, which
left HEAD pointing to an absent refs/heads file (since the actual renaming
had already occurred).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---

On 4/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
> 
> On Thu, 5 Apr 2007, Geert Bosch wrote:
> 
> > Make git_config_rename_section return success if no config file
> > exists.
> 
> I don't think this is correct. git_config_rename_section() _should_ return
> an error.
> 
> > Otherwise, renaming a branch would abort, leaving the repository in an
> > inconsistent state.
> 
> This should take the hint from --rename-section, and print a warning (or
> not).

I think both arguments makes sense. There really is no reason to abort the
rename operation if the config file update fails (for any reason).


 refs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/refs.c b/refs.c
index f471152..2ac6384 100644
--- a/refs.c
+++ b/refs.c
@@ -835,7 +835,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
 		snprintf(oldsection, 1024, "branch.%s", oldref + 11);
 		snprintf(newsection, 1024, "branch.%s", newref + 11);
 		if (git_config_rename_section(oldsection, newsection) < 0)
-			return 1;
+			error("unable to update config-file");
 	}
 
 	return 0;
-- 
1.5.1.53.g77e6f

             reply	other threads:[~2007-04-06  9:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-06  8:33 Lars Hjemli [this message]
2007-04-06 10:35 ` [PATCH] rename_ref(): only print a warning when config-file update fails Geert Bosch
2007-04-06 20:35 ` Junio C Hamano
2007-04-06 23:53   ` Lars Hjemli
2007-04-07  0:14     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11758483861506-git-send-email-hjemli@gmail.com \
    --to=hjemli@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=bosch@gnat.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).