diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-08-31 15:39:01 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-31 15:39:03 -0700 |
commit | d75bb73bcf2ecce38c147980aac0cbc27a6b838a (patch) | |
tree | 915571f195467d0a8b441455a94d6dca3c95f697 /builtin/worktree.c | |
parent | 2ba6183b0b809ff10ec212e1f7b4c9f72fc076ae (diff) | |
parent | 1f76a10b2d72245332ac41bd79249cb82f3946f0 (diff) | |
download | git-d75bb73bcf2ecce38c147980aac0cbc27a6b838a.tar.gz |
Merge branch 'jc/am-state-fix'
Recent reimplementation of "git am" changed the format of state
files kept in $GIT_DIR/rebase-apply/ without meaning to do so,
primarily because write_file() API was cumbersome to use and it was
easy to mistakenly make text files with incomplete lines. Update
write_file() interface to make it harder to misuse.
* jc/am-state-fix:
write_file(): drop caller-supplied LF from calls to create a one-liner file
write_file_v(): do not leave incomplete line at the end
write_file(): drop "fatal" parameter
builtin/am: make sure state files are text
builtin/am: introduce write_state_*() helper functions
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r-- | builtin/worktree.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c index 430b51e7a7..71bb770f7a 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -238,7 +238,7 @@ static int add_worktree(const char *path, const char *refname, * after the preparation is over. */ strbuf_addf(&sb, "%s/locked", sb_repo.buf); - write_file(sb.buf, 1, "initializing\n"); + write_file(sb.buf, "initializing"); strbuf_addf(&sb_git, "%s/.git", path); if (safe_create_leading_directories_const(sb_git.buf)) @@ -248,8 +248,8 @@ static int add_worktree(const char *path, const char *refname, strbuf_reset(&sb); strbuf_addf(&sb, "%s/gitdir", sb_repo.buf); - write_file(sb.buf, 1, "%s\n", real_path(sb_git.buf)); - write_file(sb_git.buf, 1, "gitdir: %s/worktrees/%s\n", + write_file(sb.buf, "%s", real_path(sb_git.buf)); + write_file(sb_git.buf, "gitdir: %s/worktrees/%s", real_path(get_git_common_dir()), name); /* * This is to keep resolve_ref() happy. We need a valid HEAD @@ -260,10 +260,10 @@ static int add_worktree(const char *path, const char *refname, */ strbuf_reset(&sb); strbuf_addf(&sb, "%s/HEAD", sb_repo.buf); - write_file(sb.buf, 1, "0000000000000000000000000000000000000000\n"); + write_file(sb.buf, "0000000000000000000000000000000000000000"); strbuf_reset(&sb); strbuf_addf(&sb, "%s/commondir", sb_repo.buf); - write_file(sb.buf, 1, "../..\n"); + write_file(sb.buf, "../.."); fprintf_ln(stderr, _("Preparing %s (identifier %s)"), path, name); |