diff options
author | Geert Bosch <bosch@gnat.com> | 2007-04-05 10:20:55 -0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-05 14:53:22 -0700 |
commit | 01ebb9dc8846af729c13d5d8c9d939a6d1159240 (patch) | |
tree | 9f845d14b1dae32599e4c03f96dc5d257a477c89 /config.c | |
parent | 1e31fbe24fac983b0057af39824f73d65dba6502 (diff) | |
download | git-01ebb9dc8846af729c13d5d8c9d939a6d1159240.tar.gz git-01ebb9dc8846af729c13d5d8c9d939a6d1159240.tar.xz |
Fix renaming branch without config file
Make git_config_rename_section return success if no config file
exists. Otherwise, renaming a branch would abort, leaving the
repository in an inconsistent state.
[jc: test]
Signed-off-by: Geert Bosch <bosch@gnat.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -916,8 +916,8 @@ int git_config_rename_section(const char *old_name, const char *new_name) } if (!(config_file = fopen(config_filename, "rb"))) { - ret = error("Could not open config file!"); - goto out; + /* no config file means nothing to rename, no error */ + goto unlock_and_out; } while (fgets(buf, sizeof(buf), config_file)) { @@ -951,6 +951,7 @@ int git_config_rename_section(const char *old_name, const char *new_name) } } fclose(config_file); + unlock_and_out: if (close(out_fd) || commit_lock_file(lock) < 0) ret = error("Cannot commit config file!"); out: |