summaryrefslogtreecommitdiff
path: root/contrib
AgeCommit message (Collapse)AuthorFilesLines
2015-12-08Merge branch 'sg/bash-prompt-dirty-orphan' into maintLibravatar Junio C Hamano1-4/+3
Produce correct "dirty" marker for shell prompts, even when we are on an orphan or an unborn branch. * sg/bash-prompt-dirty-orphan: bash prompt: indicate dirty index even on orphan branches bash prompt: remove a redundant 'git diff' option bash prompt: test dirty index and worktree while on an orphan branch
2015-11-24bash prompt: indicate dirty index even on orphan branchesLibravatar SZEDER Gábor1-3/+2
__git_ps1() doesn't indicate dirty index while on an orphan branch. To check the dirtiness of the index, __git_ps1() runs 'git diff-index --cached ... HEAD', which doesn't work on an orphan branch, because HEAD doesn't point to a valid commit. Run 'git diff ... --cached' instead, as it does the right thing both on valid and invalid HEAD, i.e. compares the index to the existing HEAD in the former case and to the empty tree in the latter. This fixes the two failing tests added in the first commit of this series. The dirtiness of the worktree is already checked with 'git diff' and is displayed correctly even on an orphan branch. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Jeff King <peff@peff.net>
2015-11-24bash prompt: remove a redundant 'git diff' optionLibravatar SZEDER Gábor1-1/+1
To get the dirty state indicator __git_ps1() runs 'git diff' with '--quiet --exit-code' options. '--quiet' already implies '--exit-code', so the latter is unnecessary and can be removed. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20Escape Git's exec path in contrib/rerere-train.sh scriptLibravatar Daniel Knittl-Frank1-1/+1
Whitespace can cause the source command to fail. This is usually not a problem on Unix systems, but on Windows Git is likely to be installed under "C:/Program Files/", thus rendering the script broken. Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com> Signed-off-by: Jeff King <peff@peff.net>
2015-10-16Merge branch 'pt/pull-builtin' into maintLibravatar Junio C Hamano1-1/+1
* pt/pull-builtin: pull: enclose <options> in brackets in the usage string merge: grammofix in please-commit-before-merge message
2015-10-02merge: grammofix in please-commit-before-merge messageLibravatar Alex Henrie1-1/+1
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-14Merge branch 'js/maint-am-skip-performance-regression'Libravatar Junio C Hamano1-1/+1
Recent versions of scripted "git am" has a performance regression in "git am --skip" codepath, which no longer exists in the built-in version on the 'master' front. Fix the regression in the last scripted version that appear in 2.5.x maintenance track and older. * js/maint-am-skip-performance-regression: am --skip/--abort: merge HEAD/ORIG_HEAD tree into index
2015-08-31Merge branch 'sg/config-name-only'Libravatar Junio C Hamano1-12/+4
"git config --list" output was hard to parse when values consist of multiple lines. "--name-only" option is added to help this. * sg/config-name-only: get_urlmatch: avoid useless strbuf write format_config: simplify buffer handling format_config: don't init strbuf config: restructure format_config() for better control flow completion: list variable names reliably with 'git config --name-only' config: add '--name-only' option to list only variable names
2015-08-26Merge branch 'ep/http-configure-ssl-version'Libravatar Junio C Hamano1-0/+1
A new configuration variable http.sslVersion can be used to specify what specific version of SSL/TLS to use to make a connection. * ep/http-configure-ssl-version: http: add support for specifying the SSL version
2015-08-25Sync with maintLibravatar Junio C Hamano1-1/+1
* maint: pull: pass upload_pack only when it was given
2015-08-19Merge branch 'tb/complete-rebase-i-edit-todo'Libravatar Junio C Hamano1-1/+4
The command-line completion script (in contrib/) has been updated. * tb/complete-rebase-i-edit-todo: completion: offer '--edit-todo' during interactive rebase
2015-08-19Merge branch 'jk/git-path'Libravatar Junio C Hamano1-2/+2
git_path() and mkpath() are handy helper functions but it is easy to misuse, as the callers need to be careful to keep the number of active results below 4. Their uses have been reduced. * jk/git-path: memoize common git-path "constant" files get_repo_path: refactor path-allocation find_hook: keep our own static buffer refs.c: remove_empty_directories can take a strbuf refs.c: avoid git_path assignment in lock_ref_sha1_basic refs.c: avoid repeated git_path calls in rename_tmp_log refs.c: simplify strbufs in reflog setup and writing path.c: drop git_path_submodule refs.c: remove extra git_path calls from read_loose_refs remote.c: drop extraneous local variable from migrate_file prefer mkpathdup to mkpath in assignments prefer git_pathdup to git_path in some possibly-dangerous cases add_to_alternates_file: don't add duplicate entries t5700: modernize style cache.h: complete set of git_path_submodule helpers cache.h: clarify documentation for git_path, et al
2015-08-19Merge branch 'mm/pull-upload-pack'Libravatar Junio C Hamano1-1/+1
"git pull" in recent releases of Git has a regression in the code that allows custom path to the --upload-pack=<program>. This has been corrected. Note that this is irrelevant for 'master' with "git pull" rewritten in C. * mm/pull-upload-pack: pull.sh: quote $upload_pack when passing it to git-fetch
2015-08-19Merge branch 'da/subtree-date-confusion' into maintLibravatar Junio C Hamano2-1/+5
"git subtree" (in contrib/) depended on "git log" output to be stable, which was a no-no. Apply a workaround to force a particular date format. * da/subtree-date-confusion: contrib/subtree: ignore log.date configuration
2015-08-17http: add support for specifying the SSL versionLibravatar Elia Pinto1-0/+1
Teach git about a new option, "http.sslVersion", which permits one to specify the SSL version to use when negotiating SSL connections. The setting can be overridden by the GIT_SSL_VERSION environment variable. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-12Merge branch 'pt/am-builtin'Libravatar Junio C Hamano1-0/+975
Rewrite "am" in "C". * pt/am-builtin: (46 commits) git-am: add am.threeWay config variable builtin-am: remove redirection to git-am.sh builtin-am: check for valid committer ident builtin-am: implement legacy -b/--binary option builtin-am: implement -i/--interactive builtin-am: support and auto-detect mercurial patches builtin-am: support and auto-detect StGit series files builtin-am: support and auto-detect StGit patches builtin-am: rerere support builtin-am: invoke post-applypatch hook builtin-am: invoke pre-applypatch hook builtin-am: invoke applypatch-msg hook builtin-am: support automatic notes copying builtin-am: invoke post-rewrite hook builtin-am: implement -S/--gpg-sign, commit.gpgsign builtin-am: implement --committer-date-is-author-date builtin-am: implement --ignore-date builtin-am: pass git-apply's options to git-apply builtin-am: implement --[no-]scissors builtin-am: support --keep-cr, am.keepcr ...
2015-08-10memoize common git-path "constant" filesLibravatar Jeff King1-2/+2
One of the most common uses of git_path() is to pass a constant, like git_path("MERGE_MSG"). This has two drawbacks: 1. The return value is a static buffer, and the lifetime is dependent on other calls to git_path, etc. 2. There's no compile-time checking of the pathname. This is OK for a one-off (after all, we have to spell it correctly at least once), but many of these constant strings appear throughout the code. This patch introduces a series of functions to "memoize" these strings, which are essentially globals for the lifetime of the program. We compute the value once, take ownership of the buffer, and return the cached value for subsequent calls. cache.h provides a helper macro for defining these functions as one-liners, and defines a few common ones for global use. Using a macro is a little bit gross, but it does nicely document the purpose of the functions. If we need to touch them all later (e.g., because we learned how to change the git_dir variable at runtime, and need to invalidate all of the stored values), it will be much easier to have the complete list. Note that the shared-global functions have separate, manual declarations. We could do something clever with the macros (e.g., expand it to a declaration in some places, and a declaration _and_ a definition in path.c). But there aren't that many, and it's probably better to stay away from too-magical macros. Likewise, if we abandon the C preprocessor in favor of generating these with a script, we could get much fancier. E.g., normalizing "FOO/BAR-BAZ" into "git_path_foo_bar_baz". But the small amount of saved typing is probably not worth the resulting confusion to readers who want to grep for the function's definition. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-10completion: list variable names reliably with 'git config --name-only'Libravatar SZEDER Gábor1-12/+3
Recenty I created a multi-line branch description with '.' and '=' characters on one of the lines, and noticed that fragments of that line show up when completing set variable names for 'git config', e.g.: $ git config --get branch.b.description Branch description to fool the completion script with a second line containing dot . and equals = characters. $ git config --unset <TAB> ... second line containing dot . and equals ... The completion script runs 'git config --list' and processes its output to strip the values and keep only the variable names. It does so by looking for lines containing '.' and '=' and outputting everything before the '=', which was fooled by my multi-line branch description. A similar issue exists with aliases and pretty format aliases with multi-line values, but in that case 'git config --get-regexp' is run and lines in its output are simply stripped after the first space, so subsequent lines don't even have to contain '.' and '=' to fool the completion script. Use the new '--name-only' option added in the previous commit to list config variable names reliably in both cases, without error-prone post processing. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-10config: add '--name-only' option to list only variable namesLibravatar SZEDER Gábor1-0/+1
'git config' can only show values or name-value pairs, so if a shell script needs the names of set config variables it has to run 'git config --list' or '--get-regexp' and parse the output to separate config variable names from their values. However, such a parsing can't cope with multi-line values. Though 'git config' can produce null-terminated output for newline-safe parsing, that's of no use in such a case, becase shells can't cope with null characters. Even our own bash completion script suffers from these issues. Help the completion script, and shell scripts in general, by introducing the '--name-only' option to modify the output of '--list' and '--get-regexp' to list only the names of config variables, so they don't have to perform error-prone post processing to separate variable names from their values anymore. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-05completion: offer '--edit-todo' during interactive rebaseLibravatar Thomas Braun1-1/+4
Helped-by: John Keeping <john@keeping.me.uk> Helped-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-04builtin-am: remove redirection to git-am.shLibravatar Paul Tan1-0/+975
At the beginning of the rewrite of git-am.sh to C, in order to not break existing test scripts that depended on a functional git-am, a redirection to git-am.sh was introduced that would activate if the environment variable _GIT_USE_BUILTIN_AM was not defined. Now that all of git-am.sh's functionality has been re-implemented in builtin/am.c, remove this redirection, and retire git-am.sh into contrib/examples/. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-03Merge branch 'da/subtree-date-confusion'Libravatar Junio C Hamano2-1/+5
"git subtree" (in contrib/) depended on "git log" output to be stable, which was a no-no. Apply a workaround to force a particular date format. * da/subtree-date-confusion: contrib/subtree: ignore log.date configuration
2015-08-03Merge branch 'sg/bash-prompt-untracked-optim'Libravatar Junio C Hamano1-1/+1
Optimize computation of untracked status indicator by bash prompt script (in contrib/). * sg/bash-prompt-untracked-optim: bash prompt: faster untracked status indicator with untracked directories bash prompt: test untracked files status indicator with untracked dirs
2015-08-03Merge branch 'pt/pull-builtin'Libravatar Junio C Hamano1-0/+381
Reimplement 'git pull' in C. * pt/pull-builtin: pull: remove redirection to git-pull.sh pull --rebase: error on no merge candidate cases pull --rebase: exit early when the working directory is dirty pull: configure --rebase via branch.<name>.rebase or pull.rebase pull: teach git pull about --rebase pull: set reflog message pull: implement pulling into an unborn branch pull: fast-forward working tree if head is updated pull: check if in unresolved merge state pull: support pull.ff config pull: error on no merge candidates pull: pass git-fetch's options to git-fetch pull: pass git-merge's options to git-merge pull: pass verbosity, --progress flags to fetch and merge pull: implement fetch + merge pull: implement skeletal builtin pull argv-array: implement argv_array_pushv() parse-options-cb: implement parse_opt_passthru_argv() parse-options-cb: implement parse_opt_passthru()
2015-08-03Merge branch 'sg/completion-commit-cleanup' into maintLibravatar Junio C Hamano1-1/+1
* sg/completion-commit-cleanup: completion: teach 'scissors' mode to 'git commit --cleanup='
2015-07-23contrib/subtree: ignore log.date configurationLibravatar David Aguilar2-1/+5
git-subtree's log format string uses "%ad" and "%cd", which respect the user's configured log.date value. This is problematic for git-subtree because it needs to use real dates so that copied commits come through unchanged. Add a test and tweak the format strings to use %aD and %cD so that the default date format is used instead. Reported-by: Bryan Jacobs <b@q3q.us> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-20bash prompt: faster untracked status indicator with untracked directoriesLibravatar SZEDER Gábor1-1/+1
If the untracked status indicator is enabled, __git_ps1() looks for untracked files by running 'git ls-files'. This can be perceptibly slow in case of an untracked directory containing lot of files, because it lists all files found in the untracked directory only to be redirected into /dev/null right away (this is the actual command run by __git_ps1()): $ ls untracked-dir/ |wc -l 100000 $ time git ls-files --others --exclude-standard --error-unmatch \ -- ':/*' >/dev/null 2>/dev/null real 0m0.955s user 0m0.936s sys 0m0.016s Eliminate this delay by additionally passing the '--directory --no-empty-directory' options to 'git ls-files' to show only the name of non-empty untracked directories instead of all their content: $ time git ls-files --others --exclude-standard --directory \ --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null real 0m0.010s user 0m0.008s sys 0m0.000s This follows suit of ea95c7b8f5 (completion: improve untracked directory filtering for filename completion, 2013-09-18). Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-15Merge branch 'jc/prompt-document-ps1-state-separator' into maintLibravatar Junio C Hamano1-0/+4
Docfix. * jc/prompt-document-ps1-state-separator: git-prompt.sh: document GIT_PS1_STATESEPARATOR
2015-07-15Merge branch 'af/tcsh-completion-noclobber' into maintLibravatar Junio C Hamano1-1/+1
The tcsh completion writes a bash scriptlet but that would have failed for users with noclobber set. * af/tcsh-completion-noclobber: git-completion.tcsh: fix redirect with noclobber
2015-07-15Merge branch 'pa/auto-gc-mac-osx' into maintLibravatar Junio C Hamano1-1/+1
Recent Mac OS X updates breaks the logic to detect that the machine is on the AC power in the sample pre-auto-gc script. * pa/auto-gc-mac-osx: hooks/pre-auto-gc: adjust power checking for newer OS X
2015-07-10Merge branch 'cb/subtree-tests-update'Libravatar Junio C Hamano1-152/+150
Tests update in contrib/subtree. * cb/subtree-tests-update: contrib/subtree: small tidy-up to test contrib/subtree: fix broken &&-chains and revealed test error contrib/subtree: use tabs consitently for indentation in tests
2015-07-06git-multimail: update to release 1.1.1Libravatar Matthieu Moy4-6/+17
The only change is a bugfix: the SMTP mailer was not working with Python 2.4. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-01Merge branch 'jc/prompt-document-ps1-state-separator'Libravatar Junio C Hamano1-0/+4
Docfix. * jc/prompt-document-ps1-state-separator: git-prompt.sh: document GIT_PS1_STATESEPARATOR
2015-06-24Merge branch 'pa/auto-gc-mac-osx'Libravatar Junio C Hamano1-1/+1
Recent Mac OS X updates breaks the logic to detect that the machine is on the AC power in the sample pre-auto-gc script. * pa/auto-gc-mac-osx: hooks/pre-auto-gc: adjust power checking for newer OS X
2015-06-24Merge branch 'af/tcsh-completion-noclobber'Libravatar Junio C Hamano1-1/+1
The tcsh completion writes a bash scriptlet but that would have failed for users with noclobber set. * af/tcsh-completion-noclobber: git-completion.tcsh: fix redirect with noclobber
2015-06-24Merge branch 'sg/completion-commit-cleanup'Libravatar Junio C Hamano1-1/+1
* sg/completion-commit-cleanup: completion: teach 'scissors' mode to 'git commit --cleanup='
2015-06-22contrib/subtree: small tidy-up to testLibravatar Charles Bailey1-3/+1
There's no need to switch branches to parse another branch's ancestry. Signed-off-by: Charles Bailey <cbailey32@bloomberg.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-22contrib/subtree: fix broken &&-chains and revealed test errorLibravatar Charles Bailey1-4/+4
This fixes two instances where a &&-chain was broken in the subtree tests and fixes a test error that was revealed because of this. Many tests in t7900-subtree.sh make a commit and then use 'undo' to reset the state for the next test. In the 'check hash of split' test, an 'undo' was being invoked after a 'subtree split' even though the particular invocation of 'subtree split' did not actually make a commit. The subsequent check_equal was failing, but this failure was masked by that broken &&-chain. Removing this undo causes the failing check_equal to succeed but breaks the a check_equal later on in the same test. It turns out that an earlier test ('check if --message for merge works with squash too') makes a commit but doesn't 'undo' to the state expected by the remaining tests. None of the intervening tests cared enough about the state of the test repo to fail and the spurious 'undo' in 'check hash of split' restored the expected state for any remaining test that might care. Adding the missing 'undo' to 'check if --message for merge works with squash too' and removing the spurious one from 'check hash of split' fixes all tests once the &&-chains are completed. Signed-off-by: Charles Bailey <cbailey32@bloomberg.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-22contrib/subtree: use tabs consitently for indentation in testsLibravatar Charles Bailey1-147/+147
Although subtrees tests uses more spaces for indentation than tabs, there are still quite a lot of lines indented with tabs. As tabs conform with Git coding guidelines resolve the inconsistency in favour of tabs. Signed-off-by: Charles Bailey <cbailey32@bloomberg.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-18pull: remove redirection to git-pull.shLibravatar Paul Tan1-0/+333
At the beginning of the rewrite of git-pull.sh to C, we introduced a redirection to git-pull.sh if the environment variable _GIT_USE_BUILTIN_PULL was not defined in order to not break test scripts that relied on a functional git-pull. Now that all of git-pull's functionality has been re-implemented in builtin/pull.c, remove this redirection, and retire the old git-pull.sh into contrib/examples/. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-18git-multimail: update to release 1.1.0Libravatar Matthieu Moy6-326/+1017
The changes are described in CHANGES. Contributions-by: Matthieu Moy <Matthieu.Moy@imag.fr> Contributions-by: Richard Hansen <rhansen@rhansen.org> Contributions-by: Michael Haggerty <mhagger@alum.mit.edu> Contributions-by: Elijah Newren <newren@gmail.com> Contributions-by: Luke Mewburn <luke@mewburn.net> Contributions-by: Dave Boutcher <daveboutcher@gmail.com> Contributions-by: Azat Khuzhin <a3at.mail@gmail.com> Contributions-by: Sebastian Schuberth <sschuberth@gmail.com> Contributions-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi> Contributions-by: Elijah Newren <newren@palantir.com> Contributions-by: Benoît Ryder <benoit@ryder.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-12hooks/pre-auto-gc: adjust power checking for newer OS XLibravatar Panagiotis Astithas1-1/+1
The output of "pmset -g batt" changed at some point from "Currently drawing from 'AC Power'" to the slightly different "Now drawing from 'AC Power'". Starting the match from "drawing" makes the check work in both old and new versions of OS X. Signed-off-by: Panagiotis Astithas <pastith@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-11Merge branch 'tb/complete-sequencing'Libravatar Junio C Hamano1-0/+5
The bash completion script (in contrib/) learned a few options that "git revert" takes. * tb/complete-sequencing: completion: suggest sequencer commands for revert
2015-06-10git-prompt.sh: document GIT_PS1_STATESEPARATORLibravatar Joe Cridge1-0/+4
The environment variable GIT_PS1_STATESEPARATOR can be used to set the separator between the branch name and the state symbols in the prompt. At present the variable is not mentioned in the inline documentation which makes it difficult for the casual user to identify. Signed-off-by: Joe Cridge <joe.cridge@me.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-09git-completion.tcsh: fix redirect with noclobberLibravatar Ariel Faigon1-1/+1
tcsh users who happen to have 'set noclobber' elsewhere in their ~/.tcshrc or ~/.cshrc startup files get a 'File exist' error, and the tcsh completion file doesn't get generated/updated. Adding a `!` in the redirect works correctly for both clobber (default) and 'set noclobber' users. Reviewed-by: Christian Couder <christian.couder@gmail.com> Signed-off-by: Ariel Faigon <github.2009@yendor.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-08completion: teach 'scissors' mode to 'git commit --cleanup='Libravatar SZEDER Gábor1-1/+1
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-01completion: suggest sequencer commands for revertLibravatar Thomas Braun1-0/+5
Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de> Acked-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-26Merge branch 'sg/complete-decorate-full-not-long' into maintLibravatar Junio C Hamano1-1/+1
The completion for "log --decorate=" parameter value was incorrect. * sg/complete-decorate-full-not-long: completion: fix and update 'git log --decorate=' options
2015-05-22Merge branch 'sg/completion-config'Libravatar Junio C Hamano1-24/+14
Code clean-up for completion script (in contrib/). * sg/completion-config: completion: simplify query for config variables completion: add a helper function to get config variables
2015-05-22Merge branch 'ls/http-ssl-cipher-list'Libravatar Junio C Hamano1-0/+1
Introduce http.<url>.SSLCipherList configuration variable to tweak the list of cipher suite to be used with libcURL when talking with https:// sites. * ls/http-ssl-cipher-list: http: add support for specifying an SSL cipher list