summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)Author
2012-04-30Merge branch 'nh/empty-rebase'Junio C Hamano
"git rebase" learned to optionally keep commits that do not introduce any change in the original history. By Neil Horman * nh/empty-rebase: git-rebase: add keep_empty flag git-cherry-pick: Add test to validate new options git-cherry-pick: Add keep-redundant-commits option git-cherry-pick: add allow-empty option
2012-04-30Merge branch 'jk/repack-no-explode-objects-from-old-pack'Junio C Hamano
Avoid writing out unreachable objects as loose objects when repacking, if such loose objects will immediately pruned due to its age anyway. By Jeff King * jk/repack-no-explode-objects-from-old-pack: gc: use argv-array for sub-commands argv-array: add a new "pushl" method argv-array: refactor empty_argv initialization gc: do not explode objects which will be immediately pruned
2012-04-27Merge branch 'jc/merge-reduce-parents-early'Junio C Hamano
Octopus merge strategy did not reduce heads that are recorded in the final commit correctly. By Junio C Hamano (4) and Michał Kiedrowicz (1) * jc/merge-reduce-parents-early: fmt-merge-msg: discard needless merge parents builtin/merge.c: reduce parents early builtin/merge.c: collect other parents early builtin/merge.c: remove "remoteheads" global variable merge tests: octopus with redundant parents
2012-04-27Merge branch 'cb/cherry-pick-rev-path-confusion'Junio C Hamano
The command line parser choked "git cherry-pick $name" when $name can be both revision name and a pathname, even though $name can never be a path in the context of the command. The issue the patch addresses is real, but the way it is implemented felt unnecessarily invasive a bit. It may be cleaner for this caller to add the "--" to the end of the argv_array it passes to setup_revisions(). By Clemens Buchacher * cb/cherry-pick-rev-path-confusion: cherry-pick: do not expect file arguments
2012-04-26Merge branch 'mb/fetch-call-a-non-branch-a-ref'Junio C Hamano
The report from "git fetch" said "new branch" even for a non branch ref. By Marc Branchaud * mb/fetch-call-a-non-branch-a-ref: fetch: describe new refs based on where it came from fetch: Give remote_ref to update_local_ref() as well
2012-04-24git-cherry-pick: Add keep-redundant-commits optionNeil Horman
The git-cherry-pick --allow-empty command by default only preserves empty commits that were originally empty, i.e only those commits for which <commit>^{tree} and <commit>^^{tree} are equal. By default commits which are non-empty, but were made empty by the inclusion of a prior commit on the current history are filtered out. This option allows us to override that behavior and include redundant commits as empty commits in the change history. Note that this patch changes the default behavior of git cherry-pick slightly. Prior to this patch all commits in a cherry-pick sequence were applied and git commit was run. The implication here was that, if a commit was redundant, and the commit did not trigger the fast forward logic, the git commit operation, and therefore the git cherry-pick operation would fail, displaying the cherry pick advice (i.e. run git commit --allow-empty). With this patch however, such redundant commits are automatically skipped without stopping, unless --keep-redundant-commits is specified, in which case, they are automatically applied as empty commits. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-24Merge branch 'cc/fix-missing-va-end-in-revert'Junio C Hamano
By Christian Couder * cc/fix-missing-va-end-in-revert: revert: add missing va_end
2012-04-24Merge branch 'it/fetch-pack-many-refs'Junio C Hamano
When "git fetch" encounters repositories with too many references, the command line of "fetch-pack" that is run by a helper e.g. remote-curl, may fail to hold all of them. Now such an internal invocation can feed the references through the standard input of "fetch-pack". By Ivan Todoroski * it/fetch-pack-many-refs: remote-curl: main test case for the OS command line overflow fetch-pack: test cases for the new --stdin option remote-curl: send the refs to fetch-pack on stdin fetch-pack: new --stdin option to read refs from stdin
2012-04-24Merge branch 'hv/submodule-recurse-push'Junio C Hamano
"git push --recurse-submodules" learns to optionally look into the histories of submodules bound to the superproject and push them out. By Heiko Voigt * hv/submodule-recurse-push: push: teach --recurse-submodules the on-demand option Refactor submodule push check to use string list instead of integer Teach revision walking machinery to walk multiple times sequencially
2012-04-23Merge branch 'jl/maint-submodule-recurse-fetch'Junio C Hamano
"git fetch" that recurses into submodules on demand did not check if it needs to go into submodules when non branches (most notably, tags) are fetched. By Jens Lehmann * jl/maint-submodule-recurse-fetch: submodules: recursive fetch also checks new tags for submodule commits
2012-04-23Merge branch 'jc/maint-blame-minimal'Junio C Hamano
"git blame" started missing quite a few changes from the origin since we stopped using the diff minimalization by default in v1.7.2 era. * jc/maint-blame-minimal: blame: accept --need-minimal
2012-04-23Merge branch 'jh/apply-free-patch'Junio C Hamano
Valgrind reports quite a lot of discarded memory inside apply. Fix them, audit and document the buffer ownership rules. By Junio C Hamano (8) and Jared Hance (1) * jh/apply-free-patch: apply: document buffer ownership rules across functions apply: tighten constness of line buffer apply: drop unused macro apply: free unused fragments for submodule patch apply: free patch->result apply: release memory for fn_table apply: free patch->{def,old,new}_name fields apply: rename free_patch() to free_patch_list() apply: do not leak patches and fragments
2012-04-23Merge branch 'rl/show-empty-prefix'Junio C Hamano
"git rev-parse --show-prefix" emitted nothing when run at the top-level of the working tree, while "git rev-parse --show-cdup" gave an empty line. Make them consistent. By Ross Lagerwall * rl/show-empty-prefix: rev-parse --show-prefix: add in trailing newline
2012-04-23Merge branch 'ms/remote-usage-string'Junio C Hamano
Adds some subcommands that were not listed in "git remote --help" usage strings. As an independent follow-up, we may want to rethink how the overall usage string and subcommand usage strings are maintained. By Michael Schubert * ms/remote-usage-string: remote: update builtin usage
2012-04-22revert: add missing va_endChristian Couder
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-20Merge branch 'ct/advise-push-default'Junio C Hamano
Break down the cases in which "git push" fails due to non-ff into three categories, and give separate advise messages for each case. By Christopher Tiwald (2) and Jeff King (1) * ct/advise-push-default: Fix httpd tests that broke when non-ff push advice changed clean up struct ref's nonfastforward field push: Provide situational hints for non-fast-forward errors
2012-04-20Merge branch 'jc/push-upstream-sanity'Junio C Hamano
Fix broken 'push to upstream' implementation. "git push $there" without refspec, when the current branch is set to push to a remote different from $there, used to push to $there using the upstream information to a remote unreleated to $there. * jc/push-upstream-sanity: push: error out when the "upstream" semantics does not make sense
2012-04-20Merge branch 'jc/fmt-merge-msg-people'Junio C Hamano
The "fmt-merge-msg" command learns to list the primary contributors involved in the side topic you are merging. * jc/fmt-merge-msg-people: fmt-merge-msg: show those involved in a merged series
2012-04-19fmt-merge-msg: discard needless merge parentsJunio C Hamano
This is used by "git pull" to construct a merge message from list of remote refs. When pulling redundant set of refs, however, it did not filter them even though the merge itself discards them as unnecessary. Teach the command to do the same for consistency. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-18gc: use argv-array for sub-commandsJeff King
git-gc executes many sub-commands. The argument list for some of these is constant, but for others we add more arguments at runtime. The latter is implemented by allocating a constant extra number of NULLs, and either using a custom append function, or just referencing unused slots by number. As of commit 7e52f56, which added two new arguments, it is possible to exceed the constant number of slots for "repack" by running "git gc --aggressive", causing "git gc" to die. This patch converts all of the static argv lists to use argv-array. In addition to fixing the overflow caused by 7e52f56, it has a few advantages: 1. We can drop the custom append function (which, incidentally, had an off-by-one error exacerbating the static limit). 2. We can drop the ugly magic numbers used when adding arguments to "prune". 3. Adding further arguments will be easier; you can just add new "push" calls without worrying about increasing any static limits. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-18builtin/merge.c: reduce parents earlyJunio C Hamano
Instead of waiting until we record the parents of resulting merge, reduce redundant parents (including our HEAD) immediately after reading them. The change to t7602 illustrates the essence of the effect of this change. The octopus merge strategy used to be fed with redundant commits only to discard them as "up-to-date", but we no longer feed such redundant commits to it and the affected test degenerates to a regular two-head merge. And obviously the known-to-be-broken test in t6028 is now fixed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-18builtin/merge.c: collect other parents earlyJunio C Hamano
Move the code around to populate remoteheads list early in the process before any decision regarding twohead vs octopus and fast-forwardness is made. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-18builtin/merge.c: remove "remoteheads" global variableJunio C Hamano
Instead pass it around starting from the toplevel cmd_merge() as an explicit parameter. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-17fetch: describe new refs based on where it came fromMarc Branchaud
update_local_ref() used to say "[new branch]" when we stored a new ref outside refs/tags/ hierarchy, but the message is more about what we fetched, so use the refname at the origin to make that decision. Also, only call a new ref a "branch" if it's under refs/heads/. Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-17fetch: Give remote_ref to update_local_ref() as wellMarc Branchaud
This way, the function can look at the remote side to adjust the informational message it gives. Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-16Merge branch 'jc/commit-unedited-template'Junio C Hamano
When "git commit --template F" errors out because the user did not touch the message, it claimed that it aborts due to "empty message", which was utterly wrong. By Junio C Hamano (4) and Adam Monsen (1) * jc/commit-unedited-template: Documentation/git-commit: rephrase the "initial-ness" of templates git-commit.txt: clarify -t requires editing message commit: rephrase the error when user did not touch templated log message commit: do not trigger bogus "has templated message edited" check t7501: test the right kind of breakage
2012-04-16Merge branch 'jk/branch-quiet'Junio C Hamano
Even with "-q"uiet option, "checkout" used to report setting up tracking. Also "branch" learns "-q"uiet option to squelch informational message. By Jeff King * jk/branch-quiet: teach "git branch" a --quiet option checkout: suppress tracking message with "-q"
2012-04-16Merge branch 'jk/diff-no-rename-empty'Junio C Hamano
Forbids rename detection logic from matching two empty files as renames during merge-recursive to prevent mismerges. By Jeff King * jk/diff-no-rename-empty: merge-recursive: don't detect renames of empty files teach diffcore-rename to optionally ignore empty content make is_empty_blob_sha1 available everywhere drop casts from users EMPTY_TREE_SHA1_BIN
2012-04-16Merge branch 'jc/commit-hook-authorship'Junio C Hamano
"git commit --author=$name" did not tell the name that was being recorded in the resulting commit to hooks, even though it does do so when the end user overrode the authorship via the "GIT_AUTHOR_NAME" environment variable. * jc/commit-hook-authorship: commit: pass author/committer info to hooks t7503: does pre-commit-hook learn authorship? ident.c: add split_ident_line() to parse formatted ident line
2012-04-16Merge branch 'nd/stream-more'Junio C Hamano
Use API to read blob data in smaller chunks in more places to reduce the memory footprint. By Nguyễn Thái Ngọc Duy (6) and Junio C Hamano (1) * nd/stream-more: update-server-info: respect core.bigfilethreshold fsck: use streaming API for writing lost-found blobs show: use streaming API for showing blobs parse_object: avoid putting whole blob in core cat-file: use streaming API to print blobs Add more large blob test cases streaming: make streaming-write-entry to be more reusable
2012-04-15cherry-pick: do not expect file argumentsClemens Buchacher
If a commit-ish passed to cherry-pick or revert happens to have a file of the same name, git complains that the argument is ambiguous and advises to use '--'. To make things worse, the '--' argument is removed by parse_options, und so passing '--' has no effect. Instead, always interpret cherry-pick/revert arguments as revisions. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-14submodules: recursive fetch also checks new tags for submodule commitsJens Lehmann
Since 88a21979c (fetch/pull: recurse into submodules when necessary) all fetched commits are examined if they contain submodule changes (unless configuration or command line options inhibit that). If a newly recorded submodule commit is not present in the submodule, a fetch is run inside it to download that commit. Checking new refs was done in an else branch where it wasn't executed for tags. This normally isn't a problem because tags are only fetched with the branches they live on, then checking the new commits in the fetched branches for submodule commits will also process all tags. But when a specific tag is fetched (or the refspec contains refs/tags/) commits only reachable by tags won't be searched for submodule commits, which is a bug. Fix that by moving the code outside the if/else construct to handle new tags just like any other ref. The performance impact of adding tags that most of the time lie on a branch which is checked anyway for new submodule commit should be minimal, as since 6859de4 (fetch: avoid quadratic loop checking for updated submodules) all ref-tips are collected first and then fed to a single rev-list. Spotted-by: Jeff King <peff@peff.net> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11apply: document buffer ownership rules across functionsJunio C Hamano
In general, the private functions in this file were not very much documented; even though what each of them do is reasonably self explanatory, the ownership rules for various buffers and data structures were not very obvious. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11apply: tighten constness of line bufferJunio C Hamano
These point into a single line in the patch text we read from the input, and they are not used to modify it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11apply: drop unused macroJunio C Hamano
CHUNKSIZE is no longer used. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11git-cherry-pick: add allow-empty optionNeil Horman
git cherry-pick fails when picking a non-ff commit that is empty. The advice given with the failure is that a git-commit --allow-empty should be issued to explicitly add the empty commit during the cherry pick. This option allows a user to specify before hand that they want to keep the empty commit. This eliminates the need to issue both a cherry pick and a commit operation. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11blame: accept --need-minimalJunio C Hamano
Between v1.7.1 and v1.7.2, 582aa00bdffb switched the default "diff" invocation not to use XDF_NEED_MINIMAL, but this breaks "git blame" rather badly. Allow the command line option to ask for an extra careful matching. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11gc: do not explode objects which will be immediately prunedJeff King
When we pack everything into one big pack with "git repack -Ad", any unreferenced objects in to-be-deleted packs are exploded into loose objects, with the intent that they will be examined and possibly cleaned up by the next run of "git prune". Since the exploded objects will receive the mtime of the pack from which they come, if the source pack is old, those loose objects will end up pruned immediately. In that case, it is much more efficient to skip the exploding step entirely for these objects. This patch teaches pack-objects to receive the expiration information and avoid writing these objects out. It also teaches "git gc" to pass the value of gc.pruneexpire to repack (which in turn learns to pass it along to pack-objects) so that this optimization happens automatically during "git gc" and "git gc --auto". Signed-off-by: Jeff King <peff@peff.net> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-10rev-parse --show-prefix: add in trailing newlineRoss Lagerwall
Print out a trailing newline when --show-prefix is run with cwd at the top level of the tree which results in an empty prefix. Behavior is now like --show-cdup. Fixes an expected failure in t1501. Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-09remote: update builtin usageMichael Schubert
Add missing options "--tags|--no-tags" and "--push". Signed-off-by: Michael Schubert <mschub@elegosoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-09Merge branch 'tr/cache-tree' into maint-1.7.8Junio C Hamano
* tr/cache-tree: t0090: be prepared that 'wc -l' writes leading blanks reset: update cache-tree data when appropriate commit: write cache-tree data when writing index anyway Refactor cache_tree_update idiom from commit Test the current state of the cache-tree optimization Add test-scrap-cache-tree
2012-04-05push: error out when the "upstream" semantics does not make senseJunio C Hamano
The user can say "git push" without specifying any refspec. When using the "upstream" semantics via the push.default configuration, the user wants to update the "upstream" branch of the current branch, which is the branch at a remote repository the current branch is set to integrate with, with this command. However, there are cases that such a "git push" that uses the "upstream" semantics does not make sense: - The current branch does not have branch.$name.remote configured. By definition, "git push" that does not name where to push to will not know where to push to. The user may explicitly say "git push $there", but again, by definition, no branch at repository $there is set to integrate with the current branch in this case and we wouldn't know which remote branch to update. - The current branch does have branch.$name.remote configured, but it does not specify branch.$name.merge that names what branch at the remote this branch integrates with. "git push" knows where to push in this case (or the user may explicitly say "git push $remote" to tell us where to push), but we do not know which remote branch to update. - The current branch does have its remote and upstream branch configured, but the user said "git push $there", where $there is not the remote named by "branch.$name.remote". By definition, no branch at repository $there is set to integrate with the current branch in this case, and this push is not meant to update any branch at the remote repository $there. The first two cases were already checked correctly, but the third case was not checked and we ended up updating the branch named branch.$name.merge at repository $there, which was totally bogus. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-02fetch-pack: new --stdin option to read refs from stdinIvan Todoroski
If a remote repo has too many tags (or branches), cloning it over the smart HTTP transport can fail because remote-curl.c puts all the refs from the remote repo on the fetch-pack command line. This can make the command line longer than the global OS command line limit, causing fetch-pack to fail. This is especially a problem on Windows where the command line limit is orders of magnitude shorter than Linux. There are already real repos out there that msysGit cannot clone over smart HTTP due to this problem. Here is an easy way to trigger this problem: git init too-many-refs cd too-many-refs echo bla > bla.txt git add . git commit -m test sha=$(git rev-parse HEAD) tag=$(perl -e 'print "bla" x 30') for i in `seq 50000`; do echo $sha refs/tags/$tag-$i >> .git/packed-refs done Then share this repo over the smart HTTP protocol and try cloning it: $ git clone http://localhost/.../too-many-refs/.git Cloning into 'too-many-refs'... fatal: cannot exec 'fetch-pack': Argument list too long 50k tags is obviously an absurd number, but it is required to demonstrate the problem on Linux because it has a much more generous command line limit. On Windows the clone fails with as little as 500 tags in the above loop, which is getting uncomfortably close to the number of tags you might see in real long lived repos. This is not just theoretical, msysGit is already failing to clone our company repo due to this. It's a large repo converted from CVS, nearly 10 years of history. Four possible solutions were discussed on the Git mailing list (in no particular order): 1) Call fetch-pack multiple times with smaller batches of refs. This was dismissed as inefficient and inelegant. 2) Add option --refs-fd=$n to pass a an fd from where to read the refs. This was rejected because inheriting descriptors other than stdin/stdout/stderr through exec() is apparently problematic on Windows, plus it would require changes to the run-command API to open extra pipes. 3) Add option --refs-from=$tmpfile to pass the refs using a temp file. This was not favored because of the temp file requirement. 4) Add option --stdin to pass the refs on stdin, one per line. In the end this option was chosen as the most efficient and most desirable from scripting perspective. There was however a small complication when using stdin to pass refs to fetch-pack. The --stateless-rpc option to fetch-pack also uses stdin for communication with the remote server. If we are going to sneak refs on stdin line by line, it would have to be done very carefully in the presence of --stateless-rpc, because when reading refs line by line we might read ahead too much data into our buffer and eat some of the remote protocol data which is also coming on stdin. One way to solve this would be to refactor get_remote_heads() in fetch-pack.c to accept a residual buffer from our stdin line parsing above, but this function is used in several places so other callers would be burdened by this residual buffer interface even when most of them don't need it. In the end we settled on the following solution: If --stdin is specified without --stateless-rpc, fetch-pack would read the refs from stdin one per line, in a script friendly format. However if --stdin is specified together with --stateless-rpc, fetch-pack would read the refs from stdin in packetized format (pkt-line) with a flush packet terminating the list of refs. This way we can read the exact number of bytes that we need from stdin, and then get_remote_heads() can continue reading from the same fd without losing a single byte of remote protocol data. This way the --stdin option only loses generality and scriptability when used together with --stateless-rpc, which is not easily scriptable anyway because it also uses pkt-line when talking to the remote server. Signed-off-by: Ivan Todoroski <grnch@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-02Sync with 1.7.9.6Junio C Hamano
2012-04-02Merge branch 'jc/maint-merge-autoedit' into maintJunio C Hamano
* jc/maint-merge-autoedit: merge: backport GIT_MERGE_AUTOEDIT support
2012-03-30commit: rephrase the error when user did not touch templated log messageJunio C Hamano
When the user exited editor without editing the commit log template given by "git commit -t <template>", the commit was aborted (correct) with an error message that said "due to empty commit message" (incorrect). This was because the original template support was done by piggybacking on the check to detect an empty log message. Split the codepaths into two independent checks to clarify the error. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-30commit: do not trigger bogus "has templated message edited" checkJunio C Hamano
When "-t template" and "-F msg" options are both given (or worse yet, there is "commit.template" configuration but a message is given in some other way), the documentation says that template is ignored. However, the "has the user edited the message?" check still used the contents of the template file as the basis of the emptyness check. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-30push: teach --recurse-submodules the on-demand optionHeiko Voigt
When using this option git will search for all submodules that have changed in the revisions to be send. It will then try to push the currently checked out branch of each submodule. This helps when a user has finished working on a change which involves submodules and just wants to push everything in one go. Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com> Mentored-by: Jens Lehmann <Jens.Lehmann@web.de> Mentored-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-29apply: free unused fragments for submodule patchJunio C Hamano
We simply discarded the fragments that we are not going to use upon seeing a patch to update the submodule commit bound at path that we have not checked out. Free these fragments, not to leak them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-28config: remove useless assignmentRené Scharfe
v1.7.9-8-g270a344 (config: stop using config_exclusive_filename) replaced config_exclusive_filename with given_config_file. In one case this resulted in a self-assignment, which is reported by clang as a warning. Remove the useless code. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>