summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-10-28sha1_file: move comment about return value where it belongsChristian Couder
Commit 5b0864070 (sha1_object_info_extended: make type calculation optional, Jul 12 2013) changed the return value of the sha1_object_info_extended function to 0/-1 for success/error. Previously this function returned the object type for success or -1 for error. But unfortunately the above commit forgot to change or move the comment above this function that says "returns enum object_type or negative". To fix this inconsistency, let's move the comment above the sha1_object_info function where it is still true. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-28tests: undo special treatment of CRLF for WindowsJohannes Sixt
Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-28Windows: a test_cmp that is agnostic to random LF <> CRLF conversionsJohannes Sixt
In a number of tests, output that was produced by a shell script is compared to expected output using test_cmp. Unfortunately, the MSYS bash-- when invoked via git, such as in hooks--converts LF to CRLF on output (as produced by echo and printf), which leads to many false positives. Implements a diff tool that undoes the converted CRLF. To avoid that sub-processes are spawned (which is very slow on Windows), the tool is implemented as a shell function. Diff is invoked as usual only when a difference is detected by the shell code. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-28t5300-pack-object: do not compare binary data using test_cmpJohannes Sixt
Users may set test_cmp to a comparison tool of their liking. The intent is that the tool performs comparison of line-oriented texts. However, t5300 uses it also to compare binary data. Change those tests to use 'cmp'. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-28cache: remove unused function 'have_git_dir'Stefan Beller
This function was added in d2b0708 (2008-09-27, add have_git_dir() function) as a preparation for adbc0b6 (2008-09-30, cygwin: Use native Win32 API for stat). However the second referenced commit was reverted in f66450a (2013-06-22, cygwin: Remove the Win32 l/stat() implementation), so we don't need to expose this wrapper function any more as a public API. Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Acked-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-28refs: remove unused function invalidate_ref_cacheStefan Beller
The function 'invalidate_ref_cache' was introduced in 79c7ca5 (2011-10-17, invalidate_ref_cache(): rename function from invalidate_cached_refs()) by a rename and elevated to be publicly usable in 8be8bde (2011-10-17, invalidate_ref_cache(): expose this function in the refs API) However it is not used anymore, as 8bf90dc (2011-10-17, write_ref_sha1(): only invalidate the loose ref cache) and (much) later 506a760 (2013-04-22, refs: change how packed refs are deleted) removed any calls to this function. So it seems as if we don't need that function any more, good bye! Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Acked-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-25howto: add article on recovering a corrupted objectJeff King
This is an asciidoc-ified version of a corruption post-mortem sent to the git list. It complements the existing howto article, since it covers a case where the object couldn't be easily recreated or copied from elsewhere. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-25reset: pass real rev name to add--interactiveJeff King
The add--interactive --patch mode adjusts the UI based on whether we are pulling changes from HEAD or elsewhere (in the former case it asks to unstage the reverse hunk, rather than apply the forward hunk). Commit 166ec2e taught reset to work on an unborn branch, but in doing so, switched to always providing add--interactive with the sha1 rather than the symbolic name. This meant we always used the "apply" interface, even for "git reset -p HEAD". We can fix this by passing the symbolic name to add--interactive. Since it understands unborn branches these days, we do not even have to cover this special case ourselves; we can simply pass HEAD. The tests in t7105 now check that the right interface is used in each circumstance (and notice the regression from 166ec2e we are fixing). The test in t7106 checks that we get this right for the unborn case, too (not a regression, since it didn't work at all before, but a nice improvement). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-25add-interactive: handle unborn branch in patch modeJeff King
The list_modified function already knows how to handle an unborn branch by diffing against the empty tree. However, the diff we perform to get the actual hunks does not. Let's use the same logic for both diffs. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-24silence gcc array-bounds warningJeff King
In shorten_unambiguous_ref, we build and cache a reverse-map of the rev-parse rules like this: static char **scanf_fmts; static int nr_rules; if (!nr_rules) { for (; ref_rev_parse_rules[nr_rules]; nr_rules++) ... generate scanf_fmts ... } where ref_rev_parse_rules is terminated with a NULL pointer. Compiling with "gcc -O2 -Wall" does not cause any problems, but compiling with "-O3 -Wall" generates: $ make CFLAGS='-O3 -Wall' refs.o refs.c: In function ‘shorten_unambiguous_ref’: refs.c:3379:29: warning: array subscript is above array bounds [-Warray-bounds] for (; ref_rev_parse_rules[nr_rules]; nr_rules++) Curiously, we can silence this by explicitly nr_rules to 0 in the beginning of the loop, even though the compiler should be able to tell that we follow this code path only when nr_rules is already 0. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-24drop redundant semicolon in empty whileJeff King
The extra semi-colon is harmless, since we really do want the while loop to do nothing. But it does trigger a warning from clang. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-24checkout_entry(): clarify the use of topath[] parameterJunio C Hamano
The said function has this signature: extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath); At first glance, it might appear that the caller of checkout_entry() can specify to which path the contents are written out by the last parameter, and it is tempting to add "const" in front of its type. In reality, however, topath[] is to point at a buffer to store the temporary path generated by the callchain originating from this function, and the temporary path is always short, much shorter than the buffer prepared by its only caller in builtin/checkout-index.c. Document the code a bit to clarify so that future callers know how to use the function better. Noticed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-24entry.c: convert checkout_entry to use strbufNguyễn Thái Ngọc Duy
The old code does not do boundary check so any paths longer than PATH_MAX can cause buffer overflow. Replace it with strbuf to handle paths of arbitrary length. The OS may reject if the path is too long though. But in that case we report the cause (e.g. name too long) and usually move on to checking out the next entry. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-24http.c: Spell the null pointer as NULLRamsay Jones
Commit 1bbcc224 ("http: refactor options to http_get_*", 28-09-2013) changed the type of final 'options' argument of the http_get_file() function from an int to an 'struct http_get_options' pointer. However, it neglected to update the (single) call site. Since this call was passing '0' to that argument, it was (correctly) being interpreted as a null pointer. Change to argument to NULL. Noticed by sparse. ("Using plain integer as NULL pointer") Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-23Update draft release notes to 1.8.5Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-23Sync with 'maint'Junio C Hamano
2013-10-23Almost 1.8.4.2 ;-)Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-23Merge branch 'jc/ls-files-killed-optim' into maintJunio C Hamano
"git ls-files -k" needs to crawl only the part of the working tree that may overlap the paths in the index to find killed files, but shared code with the logic to find all the untracked files, which made it unnecessarily inefficient. * jc/ls-files-killed-optim: dir.c::test_one_path(): work around directory_exists_in_index_icase() breakage t3010: update to demonstrate "ls-files -k" optimization pitfalls ls-files -k: a directory only can be killed if the index has a non-directory dir.c: use the cache_* macro to access the current index
2013-10-23Merge branch 'jh/checkout-auto-tracking' into maintJunio C Hamano
"git branch --track" had a minor regression in v1.8.3.2 and later that made it impossible to base your local work on anything but a local branch of the upstream repository you are tracking from. * jh/checkout-auto-tracking: t3200: fix failure on case-insensitive filesystems branch.c: Relax unnecessary requirement on upstream's remote ref name t3200: Add test demonstrating minor regression in 41c21f2 Refer to branch.<name>.remote/merge when documenting --track t3200: Minor fix when preparing for tracking failure t2024: Fix &&-chaining and a couple of typos
2013-10-23Merge branch 'nd/fetch-into-shallow' into maintJunio C Hamano
When there is no sufficient overlap between old and new history during a "git fetch" into a shallow repository, objects that the sending side knows the receiving end has were unnecessarily sent. * nd/fetch-into-shallow: Add testcase for needless objects during a shallow fetch list-objects: mark more commits as edges in mark_edges_uninteresting list-objects: reduce one argument in mark_edges_uninteresting upload-pack: delegate rev walking in shallow fetch to pack-objects shallow: add setup_temporary_shallow() shallow: only add shallow graft points to new shallow file move setup_alternate_shallow and write_shallow_commits to shallow.c
2013-10-23Merge branch 'bc/gnome-keyring'Junio C Hamano
Cleanups and tweaks for credential handling to work with ancient versions of the gnome-keyring library that are still in use. * bc/gnome-keyring: contrib/git-credential-gnome-keyring.c: support really ancient gnome-keyring contrib/git-credential-gnome-keyring.c: support ancient gnome-keyring contrib/git-credential-gnome-keyring.c: report failure to store password contrib/git-credential-gnome-keyring.c: use glib messaging functions contrib/git-credential-gnome-keyring.c: use glib memory allocation functions contrib/git-credential-gnome-keyring.c: use secure memory for reading passwords contrib/git-credential-gnome-keyring.c: use secure memory functions for passwds contrib/git-credential-gnome-keyring.c: use gnome helpers in keyring_object() contrib/git-credential-gnome-keyring.c: set Gnome application name contrib/git-credential-gnome-keyring.c: ensure buffer is non-empty before accessing contrib/git-credential-gnome-keyring.c: strlen() returns size_t, not ssize_t contrib/git-credential-gnome-keyring.c: exit non-zero when called incorrectly contrib/git-credential-gnome-keyring.c: add static where applicable contrib/git-credential-gnome-keyring.c: *style* use "if ()" not "if()" etc. contrib/git-credential-gnome-keyring.c: remove unused die() function contrib/git-credential-gnome-keyring.c: remove unnecessary pre-declarations
2013-10-23Merge branch 'po/dot-url'Junio C Hamano
Explain how '.' can be used to refer to the "current repository" in the documentation. * po/dot-url: doc/cli: make "dot repository" an independent bullet point config doc: update dot-repository notes doc: command line interface (cli) dot-repository dwimmery
2013-10-23Merge branch 'jc/prompt-upstream'Junio C Hamano
An enhancement to the GIT_PS1_SHOWUPSTREAM facility. * jc/prompt-upstream: git-prompt.sh: optionally show upstream branch name
2013-10-23Merge branch 'hu/cherry-pick-previous-branch'Junio C Hamano
"git cherry-pick" without further options would segfault. Could use a follow-up to handle '-' after argv[1] better. * hu/cherry-pick-previous-branch: cherry-pick: handle "-" after parsing options
2013-10-23Merge branch 'mg/more-textconv'Junio C Hamano
Make "git grep" and "git show" pay attention to --textconv when dealing with blob objects. * mg/more-textconv: grep: honor --textconv for the case rev:path grep: allow to use textconv filters t7008: demonstrate behavior of grep with textconv cat-file: do not die on --textconv without textconv filters show: honor --textconv for blobs diff_opt: track whether flags have been set explicitly t4030: demonstrate behavior of show with textconv
2013-10-23Merge branch 'jc/pack-objects'Junio C Hamano
* jc/pack-objects: pack-objects: shrink struct object_entry
2013-10-23remote-hg: unquote C-style paths when exportingAntoine Pelisse
git-fast-import documentation says that paths can be C-style quoted. Unfortunately, the current remote-hg helper doesn't unquote quoted path and pass them as-is to Mercurial when the commit is created. This results in the following situation: - clone a mercurial repository with git - add a file with space in a directory: `>dir/foo\ bar` - commit that new file, and push the change to mercurial - the mercurial repository now has a new directory named '"dir', which contains a file named 'foo bar"' Use Python str.decode('string-escape') to unquote the string if it starts and ends with ". It has been tested with quotes, spaces, and utf-8 encoded file-names. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-23Clear fd after closing to avoid double-close errorJens Lindstrom
In send_pack(), clear the fd passed to pack_objects() by setting it to -1, since pack_objects() closes the fd (via a call to run_command()). Likewise, in get_pack(), clear the fd passed to run_command(). Not doing so risks having git_transport_push(), caller of send_pack(), closing the fd again, possibly incorrectly closing some other open file; or similarly with fetch_refs_from_pack(), indirect caller of get_pack(). Signed-off-by: Jens Lindström <jl@opera.com> Acked-by: Jeff King <peff@peff.net> Acked-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22Revert "test-lib: allow prefixing a custom string before "ok N" etc."Thomas Rast
Now that ad0e623 (test-lib: support running tests under valgrind in parallel, 2013-06-23) has been reverted, this support code has no users any more. Revert it, too. This reverts commit e939e15d241e942662b9f88f6127ab470ab0a0b9. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22Revert "test-lib: support running tests under valgrind in parallel"Thomas Rast
This reverts commit ad0e6233320b004f0d686f6887c803e508607bd2. --valgrind-parallel was broken from the start: during review I made the whole valgrind setup code conditional on not being a --valgrind-parallel worker child. But even the children crucially need $GIT_VALGRIND to be set; it should therefore have been set outside the conditional. The fix would be a two-liner, but since the introduction of the feature, almost four months have passed without anyone noticing that it is broken. So this feature is not worth the about hundred lines of test-lib.sh complexity. Revert it. Signed-off-by: Thomas Rast <tr@thomasrast.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22git-svn docs: Use tabs consistently within the ascii docStefan Beller
While I can understand 4 or 7 white spaces are fancy, we'd rather want to use tabs throughout the whole document. Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22t5570: Update for clone-progress-to-stderr branchBrian Gernhardt
git clone now reports its progress to standard error, which throws off t5570. Using test_i18ngrep instead of test_cmp allows the test to be more flexible by only looking for the expected error and ignoring any other output from the program. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22Merge branch 'jk/clone-progress-to-stderr' into jc/upload-pack-send-symrefJunio C Hamano
* jk/clone-progress-to-stderr: clone: always set transport options clone: treat "checking connectivity" like other progress clone: send diagnostic messages to stderr
2013-10-22t5570: Update for symref capabilityBrian Gernhardt
git-daemon now uses the symref capability to send the correct HEAD reference, so the test for that in t5570 now passes. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22Documentation: revamp gitk(1)Thomas Rast
The gitk manpage suffers from a bit of neglect: there have been only minor changes, and no changes to the set of options documented, since a2df1fb (Documentation: New GUI configuration and command-line options., 2008-11-13). In the meantime, the set of rev-list options has been expanded several times by options that are useful in gitk, e.g., --ancestry-path and the optional globbing for --branches, --tags and --remotes. Restructure and expand the manpage. List more options that the author perceives as useful, while remaining somewhat terse. Ideally the user should not have to look up any of the references, but we dispense with precise explanations in some places and refer to git-log(1) instead. Note that the options that have an easy GUI equivalent (e.g., --word-diff, -S, --grep) are deliberately not listed even in the cases where they simply fill in the GUI fields. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22Reword repack documentation to no longer state it's a scriptStefan Beller
This updates the documentation regarding the changes introduced by a1bbc6c01 (2013-09-15, repack: rewrite the shell script in C). Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-22Fix calling parse_pathspec with no paths nor PATHSPEC_PREFER_* flagsNguyễn Thái Ngọc Duy
When parse_pathspec() is called with no paths, the behavior could be either return no paths, or return one path that is cwd. Some commands do the former, some the latter. parse_pathspec() itself does not make either the default and requires the caller to specify either flag if it may run into this situation. I've grep'd through all parse_pathspec() call sites. Some pass neither, but those are guaranteed never pass empty path to parse_pathspec(). There are two call sites that may pass empty path and are fixed with this patch. [jc: added a test from Antoine's bug report] Reported-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-18Update draft release notes to 1.8.5Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-18Merge branch 'maint'Junio C Hamano
* maint: git-merge: document the -S option
2013-10-18Merge branch 'jc/reflog-doc'Junio C Hamano
Document rules to use GIT_REFLOG_ACTION variable in the scripted Porcelain. git-rebase--interactive locally violates them, but it is a leaf user that does not call out to or dot-source other scripts, so it does not urgently need to be fixed. * jc/reflog-doc: setup_reflog_action: document the rules for using GIT_REFLOG_ACTION
2013-10-18Merge branch 'sb/repack-in-c'Junio C Hamano
Rewrite "git repack" in C. * sb/repack-in-c: repack: improve warnings about failure of renaming and removing files repack: retain the return value of pack-objects repack: rewrite the shell script in C
2013-10-18Merge branch 'jk/clone-progress-to-stderr'Junio C Hamano
Some progress and diagnostic messages from "git clone" were incorrectly sent to the standard output stream, not to the standard error stream. * jk/clone-progress-to-stderr: clone: always set transport options clone: treat "checking connectivity" like other progress clone: send diagnostic messages to stderr
2013-10-18Merge git://github.com/git-l10n/git-poJunio C Hamano
* git://github.com/git-l10n/git-po: l10n: fr.po: 2135/2135 messages translated
2013-10-18checkout: proper error message on 'git checkout foo bar --'Matthieu Moy
The previous code was detecting the presence of "--" by looking only at argument 1. As a result, "git checkout foo bar --" was interpreted as an ambiguous file/revision list, and errored out with: error: pathspec 'foo' did not match any file(s) known to git. error: pathspec 'bar' did not match any file(s) known to git. error: pathspec '--' did not match any file(s) known to git. This patch fixes it by walking through the argument list to find the "--", and now complains about the number of references given. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-18checkout: allow dwim for branch creation for "git checkout $branch --"Matthieu Moy
The "--" notation disambiguates files and branches, but as a side-effect of the previous implementation, also disabled the branch auto-creation when $branch does not exist. A possible scenario is then: git checkout $branch => fails if $branch is both a ref and a file, and suggests -- git checkout $branch -- => refuses to create the $branch This patch allows the second form to create $branch, and since the -- is provided, it does not look for file named $branch. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-18graph: fix coloring around octopus mergesHemmo Nieminen
When drawing the graph of an octopus merge, we draw a horizontal line from parents 3 and above into the asterisk representing the commit. The sections of this line should be colored to match the graph lines coming in from above. However, if the commit is not in the left-most column we do not take into account the columns to the left of the commit when calculating these colors. Fix this by adding the appropriate offset to the column index used for calculating the color. Signed-off-by: Hemmo Nieminen <hemmo.nieminen@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-18git-merge: document the -S optionNicolas Vigier
The option to gpg sign a merge commit is available but was not documented. Use wording from the git-commit(1) manpage. Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-18gc: remove gc.pid file at end of executionJonathan Nieder
This file isn't really harmful, but isn't useful either, and can create minor annoyance for the user: * It's confusing, as the presence of a *.pid file often implies that a process is currently running. A user running "ls .git/" and finding this file may incorrectly guess that a "git gc" is currently running. * Leaving this file means that a "git gc" in an already gc-ed repo is no-longer a no-op. A user running "git gc" in a set of repositories, and then synchronizing this set (e.g. rsync -av, unison, ...) will see all the gc.pid files as changed, which creates useless noise. This patch unlinks the file after the garbage collection is done, so that gc.pid is actually present only during execution. Future versions of Git may want to use the information left in the gc.pid file (e.g. for policies like "don't attempt to run a gc if one has already been ran less than X hours ago"). If so, this patch can safely be reverted. For now, let's not bother the users. Explained-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Improved-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-18l10n: fr.po: 2135/2135 messages translatedJean-Noel Avila
Signed-off-by: Sebastien Helleu <flashcode@flashtux.org> Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2013-10-17Update draft release notes to 1.8.5Junio C Hamano