summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-08-24 13:20:39 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-08-25 12:49:19 -0700
commit1f76a10b2d72245332ac41bd79249cb82f3946f0 (patch)
treefe99b9539117ac164cd05ea50143539c8abf21cd /builtin
parentwrite_file_v(): do not leave incomplete line at the end (diff)
downloadtgif-1f76a10b2d72245332ac41bd79249cb82f3946f0.tar.xz
write_file(): drop caller-supplied LF from calls to create a one-liner file
All of the callsites covered by this change call write_file() or write_file_gently() to create a one-liner file. Drop the caller supplied LF and let these callees to append it as necessary. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/init-db.c2
-rw-r--r--builtin/worktree.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index bfe1d08234..69323e186c 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -378,7 +378,7 @@ static void separate_git_dir(const char *git_dir)
die_errno(_("unable to move %s to %s"), src, git_dir);
}
- write_file(git_link, "gitdir: %s\n", git_dir);
+ write_file(git_link, "gitdir: %s", git_dir);
}
int init_db(const char *template_dir, unsigned int flags)
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 368502d837..bbb169a5d0 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -213,7 +213,7 @@ static int add_worktree(const char *path, const char **child_argv)
* after the preparation is over.
*/
strbuf_addf(&sb, "%s/locked", sb_repo.buf);
- write_file(sb.buf, "initializing\n");
+ write_file(sb.buf, "initializing");
strbuf_addf(&sb_git, "%s/.git", path);
if (safe_create_leading_directories_const(sb_git.buf))
@@ -223,8 +223,8 @@ static int add_worktree(const char *path, const char **child_argv)
strbuf_reset(&sb);
strbuf_addf(&sb, "%s/gitdir", sb_repo.buf);
- write_file(sb.buf, "%s\n", real_path(sb_git.buf));
- write_file(sb_git.buf, "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
@@ -241,10 +241,10 @@ static int add_worktree(const char *path, const char **child_argv)
die(_("unable to resolve HEAD"));
strbuf_reset(&sb);
strbuf_addf(&sb, "%s/HEAD", sb_repo.buf);
- write_file(sb.buf, "%s\n", sha1_to_hex(rev));
+ write_file(sb.buf, "%s", sha1_to_hex(rev));
strbuf_reset(&sb);
strbuf_addf(&sb, "%s/commondir", sb_repo.buf);
- write_file(sb.buf, "../..\n");
+ write_file(sb.buf, "../..");
fprintf_ln(stderr, _("Enter %s (identifier %s)"), path, name);