Merge branch 'ar/maint-mksnpath' into ar/mksnpath

* ar/maint-mksnpath:
  Use git_pathdup instead of xstrdup(git_path(...))
  git_pathdup: returns xstrdup-ed copy of the formatted path
  Fix potentially dangerous use of git_path in ref.c
  Add git_snpath: a .git path formatting routine with output buffer

Conflicts:
	builtin-revert.c
	refs.c
	rerere.c
This commit is contained in:
Junio C Hamano
2008-10-30 18:08:58 -07:00
11 changed files with 60 additions and 15 deletions

View File

@ -277,11 +277,11 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
lock = lock_any_ref_for_update(ref, sha1, 0);
if (!lock)
return error("cannot lock ref '%s'", ref);
log_file = xstrdup(git_path("logs/%s", ref));
log_file = git_pathdup("logs/%s", ref);
if (!file_exists(log_file))
goto finish;
if (!cmd->dry_run) {
newlog_path = xstrdup(git_path("logs/%s.lock", ref));
newlog_path = git_pathdup("logs/%s.lock", ref);
cb.newlog = fopen(newlog_path, "w");
}