summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-01-07try_remove_empty_parents(): teach to remove parents of reflogs, tooLibravatar Michael Haggerty1-6/+18
Add a new "flags" parameter that tells the function whether to remove empty parent directories of the loose reference file, of the reflog file, or both. The new functionality is not yet used. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07try_remove_empty_parents(): don't trash argument contentsLibravatar Michael Haggerty1-7/+9
It's bad manners and surprising and therefore error-prone. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07try_remove_empty_parents(): rename parameter "name" -> "refname"Libravatar Michael Haggerty1-4/+4
This is the standard nomenclature. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07delete_ref_loose(): inline functionLibravatar Michael Haggerty1-18/+7
It was hardly doing anything anymore, and had only one caller. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07delete_ref_loose(): derive loose reference path from lockLibravatar Michael Haggerty1-4/+1
It is simpler to derive the path to the file that must be deleted from "lock->ref_name" than from the lock_file object. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07log_ref_write_1(): inline functionLibravatar Michael Haggerty1-10/+3
Now files_log_ref_write() doesn't do anything beyond call log_ref_write_1(), so inline the latter into the former. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07log_ref_setup(): manage the name of the reflog file internallyLibravatar Michael Haggerty1-35/+34
Instead of writing the name of the reflog file into a strbuf that is supplied by the caller but not needed there, write it into a local temporary buffer and remove the strbuf parameter entirely. And while we're adjusting the function signature, reorder the arguments to move the input parameters before the output parameters. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07log_ref_write_1(): don't depend on logfile argumentLibravatar Michael Haggerty1-4/+8
It's unnecessary to pass a strbuf holding the reflog path up and down the call stack now that it is hardly needed by the callers. Remove the places where log_ref_write_1() uses it, in preparation for making it internal to log_ref_setup(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07log_ref_setup(): pass the open file descriptor back to the callerLibravatar Michael Haggerty1-17/+22
This function will most often be called by log_ref_write_1(), which wants to append to the reflog file. In that case, it is silly to close the file only for the caller to reopen it immediately. So, in the case that the file was opened, pass the open file descriptor back to the caller. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07log_ref_setup(): improve robustness against racesLibravatar Michael Haggerty1-23/+18
Change log_ref_setup() to use raceproof_create_file() to create the new logfile. This makes it more robust against a race against another process that might be trying to clean up empty directories while we are trying to create a new logfile. This also means that it will only call create_leading_directories() if open() fails, which should be a net win. Even in the cases where we are willing to create a new logfile, it will usually be the case that the logfile already exists, or if not then that the directory containing the logfile already exists. In such cases, we will save some work that was previously done unconditionally. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07log_ref_setup(): separate code for create vs non-createLibravatar Michael Haggerty1-20/+39
The behavior of this function (especially how it handles errors) is quite different depending on whether we are willing to create the reflog vs. whether we are only trying to open an existing reflog. So separate the code paths. This also simplifies the next steps. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07log_ref_write(): inline functionLibravatar Michael Haggerty1-14/+10
This function doesn't do anything beyond call files_log_ref_write(), so replace it with the latter at its call sites. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07rename_tmp_log(): improve error reportingLibravatar Michael Haggerty1-3/+4
* Don't capitalize error strings * Report true paths of affected files Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07rename_tmp_log(): use raceproof_create_file()Libravatar Michael Haggerty1-43/+30
Besides shortening the code, this saves an unnecessary call to safe_create_leading_directories_const() in almost all cases. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07lock_ref_sha1_basic(): use raceproof_create_file()Libravatar Michael Haggerty1-26/+9
Instead of coding the retry loop inline, use raceproof_create_file() to make lock acquisition safe against directory creation/deletion races. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07lock_ref_sha1_basic(): inline constantLibravatar Michael Haggerty1-2/+1
`lflags` is set a single time then never changed, so just inline it. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07raceproof_create_file(): new functionLibravatar Michael Haggerty2-0/+111
Add a function that tries to create a file and any containing directories in a way that is robust against races with other processes that might be cleaning up empty directories at the same time. The actual file creation is done by a callback function, which, if it fails, should set errno to EISDIR or ENOENT according to the convention of open(). raceproof_create_file() detects such failures, and respectively either tries to delete empty directories that might be in the way of the file or tries to create the containing directories. Then it retries the callback function. This function is not yet used. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07safe_create_leading_directories(): set errno on SCLD_EXISTSLibravatar Michael Haggerty2-3/+6
The exit path for SCLD_EXISTS wasn't setting errno, which some callers use to generate error messages for the user. Fix the problem and document that the function sets errno correctly to help avoid similar regressions in the future. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07safe_create_leading_directories_const(): preserve errnoLibravatar Michael Haggerty1-0/+4
Some implementations of free() change errno (even thought they shouldn't): https://sourceware.org/bugzilla/show_bug.cgi?id=17924 So preserve the errno from safe_create_leading_directories() across the call to free(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07t5505: use "for-each-ref" to test for the non-existence of referencesLibravatar Michael Haggerty1-1/+1
Instead of looking on the filesystem inside ".git/refs/remotes/origin", use "git for-each-ref" to check for leftover references under the remote's old name. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07refname_is_safe(): correct docstringLibravatar Michael Haggerty1-5/+6
The behavior of refname_is_safe() was changed in e40f355 "refname_is_safe(): insist that the refname already be normalized", 2016-04-27 without a corresponding update to its docstring. The function is in fact stricter than documented, because it now insists that the result of normalizing the part of a refname following "refs/" is identical to that part of the original refname. Fix the docstring. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07files_rename_ref(): tidy up whitespaceLibravatar Michael Haggerty1-1/+1
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-27Fourth batch for 2.12Libravatar Junio C Hamano1-0/+42
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-27Merge branch 'jc/lock-report-on-error'Libravatar Junio C Hamano1-1/+1
* jc/lock-report-on-error: lockfile: move REPORT_ON_ERROR bit elsewhere
2016-12-27lockfile: move REPORT_ON_ERROR bit elsewhereLibravatar Junio C Hamano1-1/+1
There was LOCK_NO_DEREF defined as 2 = 1<<1 with the same value, which was missed due to a huge comment block. Deconflict by moving the new one to 4 = 1<<2 for now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-27Merge branch 'js/mingw-isatty'Libravatar Junio C Hamano1-114/+84
Update the isatty() emulation for Windows by updating the previous hack that depended on internals of (older) MSVC runtime. * js/mingw-isatty: mingw: replace isatty() hack mingw: fix colourization on Cygwin pseudo terminals mingw: adjust is_console() to work with stdin
2016-12-27Merge branch 'ls/p4-lfs'Libravatar Junio C Hamano2-14/+14
Update GitLFS integration with "git p4". * ls/p4-lfs: git-p4: add diff/merge properties to .gitattributes for GitLFS files
2016-12-27Merge branch 'va/i18n-even-more'Libravatar Junio C Hamano2-3/+4
* va/i18n-even-more: i18n: fix misconversion in shell scripts
2016-12-27Merge branch 'lt/shortlog-by-committer'Libravatar Junio C Hamano4-3/+36
"git shortlog" learned "--committer" option to group commits by committer, instead of author. * lt/shortlog-by-committer: t4201: make tests work with and without the MINGW prerequiste shortlog: test and document --committer option shortlog: group by committer information
2016-12-27Merge branch 'mk/mingw-winansi-ttyname-termination-fix'Libravatar Junio C Hamano1-1/+1
A potential but unlikely buffer overflow in Windows port has been fixed. * mk/mingw-winansi-ttyname-termination-fix: mingw: consider that UNICODE_STRING::Length counts bytes
2016-12-27Merge branch 'gv/p4-multi-path-commit-fix'Libravatar Junio C Hamano2-3/+23
"git p4" that tracks multile p4 paths imported a single changelist that touches files in these multiple paths as one commit, followed by many empty commits. This has been fixed. * gv/p4-multi-path-commit-fix: git-p4: fix multi-path changelist empty commits
2016-12-27Merge branch 'jk/difftool-in-subdir'Libravatar Junio C Hamano1-24/+29
Even though an fix was attempted in Git 2.9.3 days, but running "git difftool --dir-diff" from a subdirectory never worked. This has been fixed. * jk/difftool-in-subdir: difftool: rename variables for consistency difftool: chdir as early as possible difftool: sanitize $workdir as early as possible difftool: fix dir-diff index creation when in a subdirectory
2016-12-27Merge branch 'ld/p4-compare-dir-vs-symlink'Libravatar Junio C Hamano2-6/+63
"git p4" misbehaved when swapping a directory and a symbolic link. * ld/p4-compare-dir-vs-symlink: git-p4: avoid crash adding symlinked directory
2016-12-27Merge branch 'ls/filter-process'Libravatar Junio C Hamano4-29/+24
Doc update. * ls/filter-process: t0021: fix flaky test docs: warn about possible '=' in clean/smudge filter process values
2016-12-27Merge branch 'bw/transport-protocol-policy'Libravatar Junio C Hamano12-85/+362
Finer-grained control of what protocols are allowed for transports during clone/fetch/push have been enabled via a new configuration mechanism. * bw/transport-protocol-policy: http: respect protocol.*.allow=user for http-alternates transport: add from_user parameter to is_transport_allowed http: create function to get curl allowed protocols transport: add protocol policy config option http: always warn if libcurl version is too old lib-proto-disable: variable name fix
2016-12-27Merge branch 'cp/merge-continue'Libravatar Junio C Hamano4-1/+45
"git merge --continue" has been added as a synonym to "git commit" to conclude a merge that has stopped due to conflicts. * cp/merge-continue: merge: mark usage error strings for translation merge: ensure '--abort' option takes no arguments completion: add --continue option for merge merge: add '--continue' option as a synonym for 'git commit'
2016-12-27Merge branch 'va/i18n-perl-scripts'Libravatar Junio C Hamano8-218/+408
Porcelain scripts written in Perl are getting internationalized. * va/i18n-perl-scripts: i18n: difftool: mark warnings for translation i18n: send-email: mark composing message for translation i18n: send-email: mark string with interpolation for translation i18n: send-email: mark warnings and errors for translation i18n: send-email: mark strings for translation i18n: add--interactive: mark status words for translation i18n: add--interactive: remove %patch_modes entries i18n: add--interactive: mark edit_hunk_manually message for translation i18n: add--interactive: i18n of help_patch_cmd i18n: add--interactive: mark patch prompt for translation i18n: add--interactive: mark plural strings i18n: clean.c: match string with git-add--interactive.perl i18n: add--interactive: mark strings with interpolation for translation i18n: add--interactive: mark simple here-documents for translation i18n: add--interactive: mark strings for translation Git.pm: add subroutines for commenting lines
2016-12-27Merge branch 'sb/submodule-config-cleanup'Libravatar Junio C Hamano4-42/+48
Minor code clean-up. * sb/submodule-config-cleanup: submodule-config: clarify parsing of null_sha1 element submodule-config: rename commit_sha1 to treeish_name submodule config: inline config_from_{name, path}
2016-12-27Merge branch 'jc/push-default-explicit'Libravatar Junio C Hamano2-2/+15
A lazy "git push" without refspec did not internally use a fully specified refspec to perform 'current', 'simple', or 'upstream' push, causing unnecessary "ambiguous ref" errors. * jc/push-default-explicit: push: test pushing ambiguously named branches push: do not use potentially ambiguous default refspec
2016-12-22mingw: replace isatty() hackLibravatar Jeff Hostetler1-107/+69
Git for Windows has carried a patch that depended on internals of MSVC runtime, but it does not work correctly with recent MSVC runtime. A replacement was written originally for compiling with VC++. The patch in this message is a backport of that replacement, and it also fixes the previous attempt to make isatty() tell that /dev/null is *not* an interactive terminal. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Tested-by: Beat Bolli <dev+git@drbeat.li> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22mingw: fix colourization on Cygwin pseudo terminalsLibravatar Alan Davies1-2/+6
Git only colours the output and uses pagination if isatty() returns 1. MSYS2 and Cygwin emulate pseudo terminals via named pipes, meaning that isatty() returns 0. f7f90e0f4f (mingw: make isatty() recognize MSYS2's pseudo terminals (/dev/pty*), 2016-04-27) fixed this for MSYS2 terminals, but not for Cygwin. The named pipes that Cygwin and MSYS2 use are very similar. MSYS2 PTY pipes are called 'msys-*-pty*' and Cygwin uses 'cygwin-*-pty*'. This commit modifies the existing check to allow both MSYS2 and Cygwin PTY pipes to be identified as TTYs. Note that pagination is still broken when running Git for Windows from within Cygwin, as MSYS2's less.exe is spawned (and does not like to interact with Cygwin's PTY). This partially fixes https://github.com/git-for-windows/git/issues/267 Signed-off-by: Alan Davies <alan.n.davies@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22mingw: adjust is_console() to work with stdinLibravatar Johannes Schindelin1-1/+5
When determining whether a handle corresponds to a *real* Win32 Console (as opposed to, say, a character device such as /dev/null), we use the GetConsoleOutputBufferInfo() function as a tell-tale. However, that does not work for *input* handles associated with a console. Let's just use the GetConsoleMode() function for input handles, and since it does not work on output handles fall back to the previous method for those. This patch prepares for using is_console() instead of my previous misguided attempt in cbb3f3c9b1 (mingw: intercept isatty() to handle /dev/null as Git expects it, 2016-12-11) that broke everything on Windows. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-21Third batch for 2.12Libravatar Junio C Hamano1-0/+40
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-21Merge branch 'jt/mailinfo-fold-in-body-headers'Libravatar Junio C Hamano1-1/+2
Fix for NDEBUG builds. * jt/mailinfo-fold-in-body-headers: mailinfo.c: move side-effects outside of assert
2016-12-21Merge branch 'jk/index-pack-wo-repo-from-stdin'Libravatar Junio C Hamano7-47/+42
"git index-pack --stdin" needs an access to an existing repository, but "git index-pack file.pack" to generate an .idx file that corresponds to a packfile does not. * jk/index-pack-wo-repo-from-stdin: index-pack: skip collision check when not in repository t: use nongit() function where applicable index-pack: complain when --stdin is used outside of a repo t5000: extract nongit function to test-lib-functions.sh
2016-12-21Merge branch 'jk/parseopt-usage-msg-opt'Libravatar Junio C Hamano1-1/+1
The function usage_msg_opt() has been updated to say "fatal:" before the custom message programs give, when they want to die with a message about wrong command line options followed by the standard usage string. * jk/parseopt-usage-msg-opt: parse-options: print "fatal:" before usage_msg_opt()
2016-12-21Merge branch 'jk/quote-env-path-list-component'Libravatar Junio C Hamano5-12/+102
A recent update to receive-pack to make it easier to drop garbage objects made it clear that GIT_ALTERNATE_OBJECT_DIRECTORIES cannot have a pathname with a colon in it (no surprise!), and this in turn made it impossible to push into a repository at such a path. This has been fixed by introducing a quoting mechanism used when appending such a path to the colon-separated list. * jk/quote-env-path-list-component: t5615-alternate-env: double-quotes in file names do not work on Windows t5547-push-quarantine: run the path separator test on Windows, too tmp-objdir: quote paths we add to alternates alternates: accept double-quoted paths
2016-12-21Merge branch 'vs/submodule-clone-nested-submodules-alternates'Libravatar Junio C Hamano2-2/+83
"git clone --reference $there --recurse-submodules $super" has been taught to guess repositories usable as references for submodules of $super that are embedded in $there while making a clone of the superproject borrow objects from $there; extend the mechanism to also allow submodules of these submodules to borrow repositories embedded in these clones of the submodules embedded in the clone of the superproject. * vs/submodule-clone-nested-submodules-alternates: submodule--helper: set alternateLocation for cloned submodules
2016-12-21Merge branch 'nd/shallow-fixup'Libravatar Junio C Hamano1-19/+20
Code cleanup in shallow boundary computation. * nd/shallow-fixup: shallow.c: remove useless code shallow.c: bit manipulation tweaks shallow.c: avoid theoretical pointer wrap-around shallow.c: make paint_alloc slightly more robust shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools shallow.c: rename fields in paint_info to better express their purposes
2016-12-21Merge branch 'sb/sequencer-abort-safety'Libravatar Junio C Hamano3-2/+61
Unlike "git am --abort", "git cherry-pick --abort" moved HEAD back to where cherry-pick started while picking multiple changes, when the cherry-pick stopped to ask for help from the user, and the user did "git reset --hard" to a different commit in order to re-attempt the operation. * sb/sequencer-abort-safety: Revert "sequencer: remove useless get_dir() function" sequencer: remove useless get_dir() function sequencer: make sequencer abort safer t3510: test that cherry-pick --abort does not unsafely change HEAD am: change safe_to_abort()'s not rewinding error into a warning am: fix filename in safe_to_abort() error message