1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 06:47:52 +01:00
git/builtin
Johannes Schindelin ea56518dfe Handle more file writes correctly in shared repos
In shared repositories, we have to be careful when writing files whose
permissions do not allow users other than the owner to write them.

In particular, we force the marks file of fast-export and the FETCH_HEAD
when fetching to be rewritten from scratch.

This commit does not touch other calls to fopen() that want to
write files:

 - commands that write to working tree files (core.sharedRepository
   does not affect permission bits of working tree files),
   e.g. .rej file created by "apply --reject", result of applying a
   previous conflict resolution by "rerere", "git merge-file".

 - git am, when splitting mails (git-am correctly cleans up its directory
   after finishing, so there is no need to share those files between users)

 - git submodule clone, when writing the .git file, because the file
   will not be overwritten

 - git_terminal_prompt() in compat/terminal.c, because it is not writing to
   a file at all

 - git diff --output, because the output file is clearly not intended to be
   shared between the users of the current repository

 - git fast-import, when writing a crash report, because the reports' file
   names are unique due to an embedded process ID

 - mailinfo() in mailinfo.c, because the output is clearly not intended to
   be shared between the users of the current repository

 - check_or_regenerate_marks() in remote-testsvn.c, because this is only
   used for Git's internal testing

 - git fsck, when writing lost&found blobs (this should probably be
   changed, but left as a low-hanging fruit for future contributors).

Note that this patch does not touch callers of write_file() and
write_file_gently(), which would benefit from the same scrutiny as
to usage in shared repositories.  Most notable users are branch,
daemon, submodule & worktree, and a worrisome call in transport.c
when updating one ref (which ignores the shared flag).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-11 14:04:29 -08:00
..
add.c Merge branch 'jc/add-u-A-default-to-top' into maint 2015-11-05 12:18:12 -08:00
am.c Merge branch 'jc/am-3-fallback-regression-fix' into maint 2015-11-03 15:32:39 -08:00
annotate.c
apply.c Merge branch 'gb/apply-comment-typofix' 2015-09-14 11:44:44 -07:00
archive.c
bisect--helper.c
blame.c Merge branch 'mk/blame-error-message' into maint 2015-11-03 15:32:43 -08:00
branch.c strbuf: make stripspace() part of strbuf 2015-10-16 09:45:15 -07:00
bundle.c
cat-file.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
check-attr.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
check-ignore.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
check-mailmap.c
check-ref-format.c
checkout-index.c
checkout.c Merge branch 'jc/calloc-pathspec' into maint 2015-09-03 19:18:00 -07:00
clean.c
clone.c Merge branch 'nd/clone-linked-checkout' into maint 2015-11-05 12:18:08 -08:00
column.c
commit-tree.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
commit.c commit: allow editing the commit message even in shared repos 2016-01-07 13:52:55 -08:00
config.c get_urlmatch: avoid useless strbuf write 2015-08-20 13:16:50 -07:00
count-objects.c prepare_packed_git(): refactor garbage reporting in pack directory 2015-08-17 09:14:59 -07:00
credential.c
describe.c Merge branch 'sg/describe-contains' 2015-08-31 15:39:10 -07:00
diff-files.c
diff-index.c
diff-tree.c
diff.c
fast-export.c Handle more file writes correctly in shared repos 2016-01-11 14:04:29 -08:00
fetch-pack.c
fetch.c Handle more file writes correctly in shared repos 2016-01-11 14:04:29 -08:00
fmt-merge-msg.c Merge branch 'rs/pop-commit' into maint 2015-12-11 11:14:13 -08:00
for-each-ref.c
fsck.c Merge branch 'jc/fsck-dropped-errors' into maint 2015-10-16 14:32:50 -07:00
gc.c Merge branch 'dk/gc-idx-wo-pack' into maint 2015-12-04 11:33:08 -08:00
get-tar-commit-id.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
grep.c
hash-object.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
help.c
index-pack.c Merge branch 'jc/finalize-temp-file' 2015-08-19 14:48:55 -07:00
init-db.c write_file(): drop caller-supplied LF from calls to create a one-liner file 2015-08-25 12:49:19 -07:00
interpret-trailers.c
log.c builtin/log.c: minor reformat 2015-08-25 13:11:21 -07:00
ls-files.c ps_matched: xcalloc() takes nmemb and then element size 2015-08-20 09:57:38 -07:00
ls-remote.c ls-remote.txt: delete unsupported option 2015-09-28 11:07:04 -07:00
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c
merge-file.c Merge branch 'jk/merge-file-exit-code' into maint 2015-11-03 15:32:41 -08:00
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c react to errors in xdi_diff 2015-09-28 14:57:10 -07:00
merge.c Merge branch 'rs/pop-commit' into maint 2015-12-11 11:14:13 -08:00
mktag.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
mktree.c
mv.c
name-rev.c
notes.c strbuf: make stripspace() part of strbuf 2015-10-16 09:45:15 -07:00
pack-objects.c Merge branch 'ah/pack-objects-usage-strings' 2015-09-01 16:31:12 -07:00
pack-redundant.c
pack-refs.c
patch-id.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
prune-packed.c
prune.c Merge branch 'jk/repository-extension' into maint 2015-11-03 15:32:25 -08:00
pull.c Merge branch 'pt/pull-builtin' into maint 2015-10-16 14:32:32 -07:00
push.c push: add a config option push.gpgSign for default signed pushes 2015-08-19 12:58:58 -07:00
read-tree.c Merge branch 'ah/read-tree-usage-string' 2015-09-01 16:31:16 -07:00
receive-pack.c Merge branch 'jx/do-not-crash-receive-pack-wo-head' into maint 2015-08-19 14:41:26 -07:00
reflog.c Merge branch 'rs/pop-commit' into maint 2015-12-11 11:14:13 -08:00
remote-ext.c
remote-fd.c
remote.c
repack.c Merge branch 'jk/repository-extension' into maint 2015-11-03 15:32:25 -08:00
replace.c
rerere.c Sync with v2.5.4 2015-09-28 19:16:54 -07:00
reset.c
rev-list.c rev-list: make it obvious that we do not support notes 2015-08-24 10:33:15 -07:00
rev-parse.c use pop_commit() for consuming the first entry of a struct commit_list 2015-10-26 14:06:46 -07:00
revert.c
rm.c
send-pack.c push: add a config option push.gpgSign for default signed pushes 2015-08-19 12:58:58 -07:00
shortlog.c
show-branch.c Merge branch 'rs/show-branch-argv-array' into maint 2015-12-11 11:14:14 -08:00
show-ref.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
stripspace.c Merge branch 'jc/usage-stdin' into maint 2015-11-03 15:32:38 -08:00
symbolic-ref.c symbolic-ref: propagate error code from create_symref() 2015-12-21 12:03:03 -08:00
tag.c strbuf: make stripspace() part of strbuf 2015-10-16 09:45:15 -07:00
unpack-file.c
unpack-objects.c usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
update-index.c
update-ref.c tag, update-ref: improve description of option "create-reflog" 2015-09-11 09:50:02 -07:00
update-server-info.c
upload-archive.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c Merge branch 'es/worktree-add' into maint 2015-11-04 14:20:44 -08:00
write-tree.c