Re: [PATCH] Fix renaming branch without config file
- From
- Geert Bosch <bosch@gnat.com>
- Date
- Apr 5, 2007, 16:00 UTC
- Message-ID
- <B0C79D8E-07A8-4178-B0A6-698EB2BB5A2A@gnat.com>
- In-Reply-To
- <Pine.LNX.4.63.0704051728400.4045@wbgn013.biozentrum.uni-wuerzburg.de>
On Apr 5, 2007, at 11:30, Johannes Schindelin wrote:
Show 11 quoted lines
> 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).
Looking at the code, I deduced that git_config_rename_section() returns a positive count of sections renamed, 0 if no matching section exists and negative for another error condition.
The proposed patch makes the behavior of an absent config file the same as the behavior of an empty one, which seems sane to me. There should be no warning, as it is perfectly fine to have no config file. Could you elaborate on why you believe my patch is not correct?
Currently, a repository without "config" file will be messed up by trying to rename a branch, as the rename will mostly succeed but leaves the HEAD dangling, requiring manual file editing to recover.
-Geert