aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* commit, cherry-pick -s: remove broken support for multiline rfc2822 fieldsBrandon Casey2013-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with c1e01b0c (commit: More generous accepting of RFC-2822 footer lines, 2009-10-28), "git commit -s" carefully parses the last paragraph of each commit message to check if it consists only of RFC2822-style headers, in which case the signoff will be added as a new line in the same list: Reported-by: Reporter <reporter@example.com> Signed-off-by: Author <author@example.com> Acked-by: Lieutenant <lt@example.com> It even included support for accepting indented continuation lines for multiline fields. Unfortunately the multiline field support is broken because it checks whether buf[k] (the first character of the *next* line) instead of buf[i] is a whitespace character. The result is that any footer with a continuation line is not accepted, since the last continuation line neither starts with an RFC2822 field name nor is followed by a continuation line. That this has remained broken for so long is good evidence that nobody actually needed multiline fields. Rip out the broken continuation support. There should be no functional change. [Thanks to Jonathan Nieder for the excellent commit message] Signed-off-by: Brandon Casey <bcasey@nvidia.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* sequencer.c: rework search for start of footer to improve clarityJonathan Nieder2013-02-12
| | | | | | | | This code sequence is somewhat difficult to read. Let's rewrite it and add some comments to improve clarity. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Update draft release notes to 1.8.1Junio C Hamano2012-11-25
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'rr/submodule-diff-config'Junio C Hamano2012-11-25
|\ | | | | | | | | | | | | | | | | | | | | Allow "git diff --submodule=log" to set to be the default via configuration. * rr/submodule-diff-config: submodule: display summary header in bold diff: rename "set" variable diff: introduce diff.submodule configuration variable Documentation: move diff.wordRegex from config.txt to diff-config.txt
| * submodule: display summary header in boldRamkumar Ramachandra2012-11-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, 'git diff --submodule' displays output with a bold diff header for non-submodules. So this part is in bold: diff --git a/file1 b/file1 index 30b2f6c..2638038 100644 --- a/file1 +++ b/file1 For submodules, the header looks like this: Submodule submodule1 012b072..248d0fd: Unfortunately, it's easy to miss in the output because it's not bold. Change this. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * diff: rename "set" variableJeff King2012-11-18
| | | | | | | | | | | | | | | | | | | | | | | | | | Once upon a time the builtin_diff function used one color, and the color variables were called "set" and "reset". Nowadays it is a much longer function and we use several colors (e.g., "add", "del"). Rename "set" to "meta" to show that it is the color for showing diff meta-info (it still does not indicate that it is a "color", but at least it matches the scheme of the other color variables). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * diff: introduce diff.submodule configuration variableRamkumar Ramachandra2012-11-18
| | | | | | | | | | | | | | | | | | Introduce a diff.submodule configuration variable corresponding to the '--submodule' command-line option of 'git diff'. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Documentation: move diff.wordRegex from config.txt to diff-config.txtRamkumar Ramachandra2012-11-18
| | | | | | | | | | | | | | | | | | | | | | 19299a8 (Documentation: Move diff.<driver>.* from config.txt to diff-config.txt, 2011-04-07) moved the diff configuration options to diff-config.txt, but forgot about diff.wordRegex, which was left behind in config.txt. Fix this. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'nd/maint-compat-fnmatch-fix'Junio C Hamano2012-11-25
|\ \ | | | | | | | | | | | | * nd/maint-compat-fnmatch-fix: compat/fnmatch: fix off-by-one character class's length check
| * | compat/fnmatch: fix off-by-one character class's length checkNguyễn Thái Ngọc Duy2012-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Character class "xdigit" is the only one that hits 6 character limit defined by CHAR_CLASS_MAX_LENGTH. All other character classes are 5 character long and therefore never caught by this. This should make xdigit tests in t3070 pass on Windows. Reported-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'bc/do-not-recurse-in-die'Junio C Hamano2012-11-25
|\ \ \ | | | | | | | | | | | | | | | | * bc/do-not-recurse-in-die: usage.c: detect recursion in die routines and bail out immediately
| * | | usage.c: detect recursion in die routines and bail out immediatelyBrandon Casey2012-11-15
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | It is theoretically possible for a die handler to get into a state of infinite recursion. For example, if a die handler called another function which itself called die(). Let's at least detect this situation, inform the user, and call exit. Signed-off-by: Brandon Casey <bcasey@nvidia.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'mk/complete-tcsh'Junio C Hamano2012-11-25
|\ \ \ | | | | | | | | | | | | | | | | * mk/complete-tcsh: tcsh-completion re-using git-completion.bash
| * | | tcsh-completion re-using git-completion.bashMarc Khouzam2012-11-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current tcsh-completion support for Git, as can be found on the Internet, takes the approach of defining the possible completions explicitly. This has the obvious draw-back to require constant updating as the Git code base evolves. The approach taken by this commit is to to re-use the advanced bash completion script and use its result for tcsh completion. This is achieved by sourcing the bash script and outputting the completion result for tcsh consumption. Three solutions were looked at to implement this approach with (C) being retained: A) Modifications: git-completion.bash and new git-completion.tcsh Modify the existing git-completion.bash script to support being sourced using bash (as now), but also executed using bash. When being executed, the script will output the result of the computed completion to be re-used elsewhere (e.g., in tcsh). The modification to git-completion.bash is made not to be tcsh-specific, but to allow future users to also re-use its output. Therefore, to be general, git-completion.bash accepts a second optional parameter, which is not used by tcsh, but could prove useful for other users. Pros: 1- allows the git-completion.bash script to easily be re-used 2- tcsh support is mostly isolated in git-completion.tcsh Cons (for tcsh users only): 1- requires the user to copy both git-completion.tcsh and git-completion.bash to ${HOME} 2- requires bash script to have a fixed name and location: ${HOME}/.git-completion.bash B) Modifications: git-completion.bash Modify the existing git-completion.bash script to support being sourced using bash (as now), but also executed using bash, and sourced using tcsh. Pros: 1- only requires the user to deal with a single file 2- maintenance more obvious for tcsh since it is entirely part of the same git-completion.bash script. Cons: 1- tcsh support could affect bash support as they share the same script 2- small tcsh section must use syntax suitable for both tcsh and bash and must be at the beginning of the script 3- requires script to have a fixed name and location: ${HOME}/.git-completion.sh (for tcsh users only) C) Modifications: New git-completion.tcsh Provide a short tcsh script that generates another script which extends git-completion.bash. This new script can be used by tcsh to perform completion. Pros: 1- tcsh support is entirely isolated in git-completion.tcsh 2- new tcsh script can be as complex as needed Cons (for tcsh users only): 1- requires the user to copy both git-completion.tcsh and git-completion.bash to ${HOME} 2- requires bash script to have a fixed name and location: ${HOME}/.git-completion.bash 3- sourcing the new script will generate a third script Approach (C) was selected avoid any modification to git-completion.bash. Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com> Reviewed-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'jh/update-ref-d-through-symref'Junio C Hamano2012-11-25
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "update-ref -d --deref SYM" to delete a ref through a symbolic ref that points to it did not remove it correctly. * jh/update-ref-d-through-symref: Fix failure to delete a packed ref through a symref t1400-update-ref: Add test verifying bug with symrefs in delete_ref()
| * | | | Fix failure to delete a packed ref through a symrefJohan Herland2012-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deleting a ref through a symref (e.g. using 'git update-ref -d HEAD' to delete refs/heads/master), we would remove the loose ref, but a packed version of the same ref would remain, the end result being that instead of deleting refs/heads/master we would appear to reset it to its state as of the last repack. This patch fixes the issue, by making sure we pass the correct ref name when invoking repack_without_ref() from within delete_ref(). Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | t1400-update-ref: Add test verifying bug with symrefs in delete_ref()Johan Herland2012-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deleting a ref through a symref (e.g. using 'git update-ref -d HEAD' to delete refs/heads/master), we currently fail to remove the packed version of that ref. This testcase demonstrates the bug. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'lt/diff-stat-show-0-lines'Junio C Hamano2012-11-25
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We failed to mention a file without any content change but whose permission bit was modified, or (worse yet) a new file without any content in the "git diff --stat" output. * lt/diff-stat-show-0-lines: Fix "git diff --stat" for interesting - but empty - file changes
| * | | | | Fix "git diff --stat" for interesting - but empty - file changesLinus Torvalds2012-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The behavior of "git diff --stat" is rather odd for files that have zero lines of changes: it will discount them entirely unless they were renames. Which means that the stat output will simply not show files that only had "other" changes: they were created or deleted, or their mode was changed. Now, those changes do show up in the summary, but so do renames, so the diffstat logic is inconsistent. Why does it show renames with zero lines changed, but not mode changes or added files with zero lines changed? So change the logic to not check for "is_renamed", but for "is_interesting" instead, where "interesting" is judged to be any action but a pure data change (because a pure data change with zero data changed really isn't worth showing, if we ever get one in our diffpairs). So if you did chmod +x Makefile git diff --stat before, it would show empty (" 0 files changed"), with this it shows Makefile | 0 1 file changed, 0 insertions(+), 0 deletions(-) which I think is a more correct diffstat (and then with "--summary" it shows *what* the metadata change to Makefile was - this is completely consistent with our handling of renamed files). Side note: the old behavior was *really* odd. With no changes at all, "git diff --stat" output was empty. With just a chmod, it said "0 files changed". No way is our legacy behavior sane. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | Merge branch 'sg/complete-help-undup'Junio C Hamano2012-11-25
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sg/complete-help-undup: completion: remove 'help' duplicate from porcelain commands
| * | | | | | completion: remove 'help' duplicate from porcelain commandsSZEDER Gábor2012-11-14
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The list of all git commands is computed from the output of 'git help -a', which already includes 'help', so there is no need to explicitly add it once more when computing the list of porcelain commands. Note that 'help' wasn't actually offered twice because of this, because Bash filters duplicates from possible completion words. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | Sync with 1.8.0.1Junio C Hamano2012-11-25
|\ \ \ \ \ \
| * | | | | | Git 1.8.0.1v1.8.0.1Junio C Hamano2012-11-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | Merge branch 'jk/checkout-out-of-unborn' into maintJunio C Hamano2012-11-25
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jk/checkout-out-of-unborn: checkout: print a message when switching unborn branches
| * \ \ \ \ \ \ Merge branch 'cn/config-missing-path' into maintJunio C Hamano2012-11-25
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cn/config-missing-path: config: don't segfault when given --path with a missing value
| * \ \ \ \ \ \ \ Merge branch 'jk/maint-gitweb-xss' into maintJunio C Hamano2012-11-25
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes an XSS vulnerability in gitweb. * jk/maint-gitweb-xss: gitweb: escape html in rss title
| * | | | | | | | | Completion must sort before using uniqMarc Khouzam2012-11-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The user can be presented with invalid completion results when trying to complete a 'git checkout' command. This can happen when using a branch name prefix that matches multiple remote branches. For example, if available branches are: master remotes/GitHub/maint remotes/GitHub/master remotes/origin/maint remotes/origin/master When performing completion on 'git checkout ma' the user will be given the choices: maint master However, 'git checkout maint' will fail in this case, although completion previously said 'maint' was valid. Furthermore, when performing completion on 'git checkout mai', no choices will be suggested. So, the user is first told that the branch name 'maint' is valid, but when trying to complete 'mai' into 'maint', that completion is no longer valid. The completion results should never propose 'maint' as a valid branch name, since 'git checkout' will refuse it. The reason for this bug is that the uniq program only works with sorted input. The man page states "uniq prints the unique lines in a sorted file". When __git_refs uses the guess heuristic employed by checkout for tracking branches it wants to consider remote branches but only if the branch name is unique. To do that, it calls 'uniq -u'. However the input given to 'uniq -u' is not sorted. Therefore, in the above example, when dealing with 'git checkout ma', "__git_refs '' 1" will find the following list: master maint master maint master which, when passed to 'uniq -u' will remain the same. Therefore 'maint' will be wrongly suggested as a valid option. When dealing with 'git checkout mai', the list will be: maint maint which happens to be sorted and will be emptied by 'uniq -u', properly ignoring 'maint'. A solution for preventing the completion script from suggesting such invalid branch names is to first call 'sort' and then 'uniq -u'. Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com> Reviewed-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | | Update draft release notes for 1.8.1Junio C Hamano2012-11-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | | Merge branch 'esr/maint-doc-fast-import'Junio C Hamano2012-11-21
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * esr/maint-doc-fast-import: doc/fast-import: clarify how content states are built
| * | | | | | | | | | doc/fast-import: clarify how content states are builtEric S. Raymond2012-11-08
| | |_|_|_|_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Eric S. Raymond <esr@thyrsus.com> Signed-off-by: Jeff King <peff@peff.net>
* | | | | | | | | | Merge branch 'wtk/submodule-doc-fixup'Junio C Hamano2012-11-21
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * wtk/submodule-doc-fixup: git-submodule: wrap branch option with "<>" in usage strings.
| * | | | | | | | | | git-submodule: wrap branch option with "<>" in usage strings.W. Trevor King2012-10-25
| | |_|_|_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use "-b <branch>" instead of "-b branch". This brings the usage strings in line with other options, e.g. "--reference <repository>". Signed-off-by: W. Trevor King <wking@tremily.us> Signed-off-by: Jeff King <peff@peff.net>
* | | | | | | | | | Merge branch 'so/prompt-command'Junio C Hamano2012-11-21
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updates __git_ps1 so that it can be used as $PROMPT_COMMAND, instead of being used for command substitution in $PS1, to embed color escape sequences in its output. * so/prompt-command: coloured git-prompt: paint detached HEAD marker in red Fix up colored git-prompt show color hints based on state of the git tree Allow __git_ps1 to be used in PROMPT_COMMAND
| * | | | | | | | | | coloured git-prompt: paint detached HEAD marker in redJunio C Hamano2012-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Paint the marker for normal state in green and detached state in red, instead of the other way around. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | | | | | Fix up colored git-promptSimon Oosthoek2012-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main point is to match the colors to be more close to the color output of "git status -sb". - the branchname is green, or in red when the HEAD is detached; - the flags are either red or green for unstaged/staged and the remaining flags get a different color or none at all. Signed-off-by: Simon Oosthoek <s.oosthoek@xs4all.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | | | | | show color hints based on state of the git treeSimon Oosthoek2012-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By setting GIT_PS1_SHOW_COLORHINTS when using __git_ps1 as PROMPT_COMMAND, you will get color hints in addition to a different character (*+% etc.) to indicate the state of the tree. Signed-off-by: Simon Oosthoek <s.oosthoek@xs4all.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | | | | | Allow __git_ps1 to be used in PROMPT_COMMANDSimon Oosthoek2012-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes __git_ps1 to allow its use as PROMPT_COMMAND in bash in addition to setting PS1 with __git_ps1 in a command substitution. PROMPT_COMMAND has advantages for using color without running into prompt-wrapping issues. Only by assigning \[ and \] to PS1 directly can bash know that these and the enclosed zero-width codes in between don't count in the length of the prompt. Signed-off-by: Simon Oosthoek <s.oosthoek@xs4all.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | | | Merge branch 'jk/config-ignore-duplicates'Junio C Hamano2012-11-21
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop duplicate detection from "git-config --get"; this lets it better match the internal config callbacks, which clears up some corner cases with includes. * jk/config-ignore-duplicates: builtin/config.c: Fix a sparse warning git-config: use git_config_with_options git-config: do not complain about duplicate entries git-config: collect values instead of immediately printing git-config: fix regexp memory leaks on error conditions git-config: remove memory leak of key regexp t1300: test "git config --get-all" more thoroughly t1300: remove redundant test t1300: style updates
| * | | | | | | | | | | builtin/config.c: Fix a sparse warningRamsay Jones2012-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sparse issues an "Using plain integer as NULL pointer" warning while checking a 'struct strbuf_list' initializer expression. The initial field of the struct has pointer type, but the initializer expression is given as '{0}'. In order to suppress the warning, we simply replace the initializer with '{NULL}'. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | git-config: use git_config_with_optionsJeff King2012-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The git-config command has always implemented its own file lookup and parsing order. This was necessary because its duplicate-entry handling did not match the way git's internal callbacks worked. Now that this is no longer the case, we are free to reuse the existing parsing code. This saves us a few lines of code, but most importantly, it means that the logic for which files are examined is contained only in one place and cannot diverge. Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | git-config: do not complain about duplicate entriesJeff King2012-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If git-config is asked for a single value, it will complain and exit with an error if it finds multiple instances of that value. This is unlike the usual internal config parsing, however, which will generally overwrite previous values, leaving only the final one. For example: [set a multivar] $ git config user.email one@example.com $ git config --add user.email two@example.com [use the internal parser to fetch it] $ git var GIT_AUTHOR_IDENT Your Name <two@example.com> ... [use git-config to fetch it] $ git config user.email one@example.com error: More than one value for the key user.email: two@example.com This overwriting behavior is critical for the regular parser, which starts with the lowest-priority file (e.g., /etc/gitconfig) and proceeds to the highest-priority file ($GIT_DIR/config). Overwriting yields the highest priority value at the end. Git-config solves this problem by implementing its own parsing. It goes from highest to lowest priorty, but does not proceed to the next file if it has seen a value. So in practice, this distinction never mattered much, because it only triggered for values in the same file. And there was not much point in doing that; the real value is in overwriting values from lower-priority files. However, this changed with the implementation of config include files. Now we might see an include overriding a value from the parent file, which is a sensible thing to do, but git-config will flag as a duplication. This patch drops the duplicate detection for git-config and switches to a pure-overwrite model (for the single case; --get-all can still be used if callers want to do something more fancy). As is shown by the modifications to the test suite, this is a user-visible change in behavior. An alternative would be to just change the include case, but this is much cleaner for a few reasons: 1. If you change the include case, then to what? If you just stop parsing includes after getting a value, then you will get a _different_ answer than the regular config parser (you'll get the first value instead of the last value). So you'd want to implement overwrite semantics anyway. 2. Even though it is a change in behavior for git-config, it is bringing us in line with what the internal parsers already do. 3. The file-order reimplementation is the only thing keeping us from sharing more code with the internal config parser, which will help keep differences to a minimum. Going under the assumption that the primary purpose of git-config is to behave identically to how git's internal parsing works, this change can be seen as a bug-fix. Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | git-config: collect values instead of immediately printingJeff King2012-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactor that will allow us to more easily tweak the behavior for multi-valued variables, and it will ultimately allow us to remove a lot git-config's custom code in favor of the regular git_config code. It does mean we're no longer streaming, and we're storing more in memory for the --get-all case, but in practice it is a tiny amount of data, and the results are instantaneous. Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | git-config: fix regexp memory leaks on error conditionsJeff King2012-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The get_value function has a goto label for cleaning up on errors, but it only cleans up half of what the function might allocate. Let's also clean up the key and regexp variables there. Note that we need to take special care when compiling the regex fails to clean it up ourselves, since it is in a half-constructed state (we would want to free it, but not regfree it). Similarly, we fix git_config_parse_key to return NULL when it fails, not a pointer to some already-freed memory. Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | git-config: remove memory leak of key regexpJeff King2012-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is only called once per invocation, so it's not a major leak, but it's easy to fix. Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | t1300: test "git config --get-all" more thoroughlyJeff King2012-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We check that we can "--get-all" a multi-valued variable, but we do not actually confirm that the output is sensible. Doing so reveals that it works fine, but this will help us ensure we do not have regressions in the next few patches, which will touch this area. Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | t1300: remove redundant testJeff King2012-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test checks that git-config fails for an ambiguous "get", but we check the exact same thing 3 tests beforehand. Signed-off-by: Jeff King <peff@peff.net>
| * | | | | | | | | | | t1300: style updatesJeff King2012-10-24
| | |/ / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The t1300 test script is quite old, and does not use our modern techniques or styles. This patch updates it in the following ways: 1. Use test_cmp instead of cmp (to make failures easier to debug). 2. Use test_cmp instead of 'test $(command) = expected'. This makes failures much easier to debug, and also makes sure that $(command) exits appropriately. 3. Use test_must_fail (easier to read, and checks more rigorously for signal death). 4. Write tests with the usual style of: test_expect_success 'test name' ' test commands && ... ' rather than one-liners, or using backslash-continuation. This is purely a style fixup. There are still a few command happening outside of test_expect invocations, but they are all innoccuous system commands like "cat" and "cp". In an ideal world, each test would be self sufficient and all commands would happen inside test_expect, but it is not immediately obvious how the grouping should work (some of the commands impact the subsequent tests, and some of them are setting up and modifying state that many tests depend on). This patch just picks the low-hanging style fruit, and we can do more fixes on top later. Signed-off-by: Jeff King <peff@peff.net>
* | | | | | | | | | | Merge branch 'jk/maint-http-half-auth-fetch'Junio C Hamano2012-11-21
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Finishing touches to squelch a compiler warning. * jk/maint-http-half-auth-fetch: remote-curl.c: Fix a compiler warning
| * | | | | | | | | | | remote-curl.c: Fix a compiler warningRamsay Jones2012-11-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In particular, gcc issues an "'gzip_size' might be used uninitialized" warning (-Wuninitialized). However, this warning is a false positive, since the 'gzip_size' variable would not, in fact, be used uninitialized. In order to suppress the warning, we simply initialise the variable to zero in it's declaration. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | | | | Sixth batch for 1.8.1Junio C Hamano2012-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>