summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)Author
2011-12-21Merge branch 'maint'Junio C Hamano
* maint: builtin/init-db.c: eliminate -Wformat warning on Solaris
2011-12-21builtin/init-db.c: eliminate -Wformat warning on SolarisÆvar Arnfjörð Bjarmason
On Solaris systems we'd warn about an implicit cast of mode_t when we printed things out with the %d format. We'd get this warning under GCC 4.6.0 with Solaris headers: builtin/init-db.c: In function ‘separate_git_dir’: builtin/init-db.c:354:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘mode_t’ [-Wformat] We've been doing this ever since v1.7.4.1-296-gb57fb80. Just work around this by adding an explicit cast. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-20Merge branch 'jc/pull-signed-tag'Junio C Hamano
* jc/pull-signed-tag: commit: do not lose mergetag header when not amending
2011-12-20commit: do not lose mergetag header when not amendingJunio C Hamano
The earlier ed7a42a (commit: teach --amend to carry forward extra headers, 2011-11-08) broke "git merge/pull; edit to fix conflict; git commit" workflow by forgetting that commit_tree_extended() takes the whole extra header list. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-20Merge branch 'jc/checkout-m-twoway'Junio C Hamano
* jc/checkout-m-twoway: checkout_merged(): squelch false warning from some gcc Test 'checkout -m -- path' checkout -m: no need to insist on having all 3 stages
2011-12-20Merge branch 'jk/fetch-no-tail-match-refs'Junio C Hamano
* jk/fetch-no-tail-match-refs: connect.c: drop path_match function fetch-pack: match refs exactly t5500: give fully-qualified refs to fetch-pack drop "match" parameter from get_remote_heads
2011-12-20Merge branch 'nd/resolve-ref'Junio C Hamano
* nd/resolve-ref: Rename resolve_ref() to resolve_ref_unsafe() Convert resolve_ref+xstrdup to new resolve_refdup function revert: convert resolve_ref() to read_ref_full()
2011-12-20Merge branch 'jn/maint-sequencer-fixes'Junio C Hamano
* jn/maint-sequencer-fixes: revert: stop creating and removing sequencer-old directory Revert "reset: Make reset remove the sequencer state" revert: do not remove state until sequence is finished revert: allow single-pick in the middle of cherry-pick sequence revert: pass around rev-list args in already-parsed form revert: allow cherry-pick --continue to commit before resuming revert: give --continue handling its own function
2011-12-20Merge branch 'jk/maint-mv'Junio C Hamano
* jk/maint-mv: mv: be quiet about overwriting mv: improve overwrite warning mv: make non-directory destination error more clear mv: honor --verbose flag docs: mention "-k" for both forms of "git mv"
2011-12-20Merge branch 'ci/stripspace-docs'Junio C Hamano
* ci/stripspace-docs: Update documentation for stripspace
2011-12-20Merge branch 'tr/cache-tree'Junio C Hamano
* tr/cache-tree: 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
2011-12-17Merge branch 'jc/commit-amend-no-edit'Junio C Hamano
* jc/commit-amend-no-edit: test: commit --amend should honor --no-edit commit: honour --no-edit t7501 (commit): modernize style test: remove a porcelain test that hard-codes commit names test: add missing "&&" after echo command
2011-12-17Merge branch 'jc/stream-to-pack'Junio C Hamano
* jc/stream-to-pack: bulk-checkin: replace fast-import based implementation csum-file: introduce sha1file_checkpoint finish_tmp_packfile(): a helper function create_tmp_packfile(): a helper function write_pack_header(): a helper function Conflicts: pack.h
2011-12-17Merge branch 'jk/upload-archive-use-start-command'Junio C Hamano
* jk/upload-archive-use-start-command: upload-archive: use start_command instead of fork
2011-12-15checkout_merged(): squelch false warning from some gccJunio C Hamano
gcc 4.6.2 (there may be others) does not realize that the variable "mode" can never be used uninitialized in this function and issues a false warning under -Wuninitialized option. Squelch it with an unnecessary initialization; it is not like a single assignment matters to the performance in this codepath that writes out to the filesystem with checkout_entry() anyway. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-14Merge branch 'ks/tag-cleanup'Junio C Hamano
* ks/tag-cleanup: git-tag: introduce --cleanup option Conflicts: builtin/tag.c
2011-12-14Merge branch 'bc/maint-apply-check-no-patch'Junio C Hamano
* bc/maint-apply-check-no-patch: builtin/apply.c: report error on failure to recognize input t/t4131-apply-fake-ancestor.sh: fix broken test
2011-12-14Merge branch 'nd/ignore-might-be-precious'Junio C Hamano
* nd/ignore-might-be-precious: checkout,merge: disallow overwriting ignored files with --no-overwrite-ignore
2011-12-14Merge branch 'jn/branch-move-to-self'Junio C Hamano
* jn/branch-move-to-self: Allow checkout -B <current-branch> to update the current branch branch: allow a no-op "branch -M <current-branch> HEAD"
2011-12-14Merge branch 'maint'Junio C Hamano
* maint: Update draft release notes for 1.7.8.1 Git 1.7.7.5 Git 1.7.6.5 blame: don't overflow time buffer fetch: create status table using strbuf Conflicts: RelNotes
2011-12-14Merge branch 'jc/maint-pack-object-cycle' into maintJunio C Hamano
* jc/maint-pack-object-cycle: pack-object: tolerate broken packs that have duplicated objects Conflicts: builtin/pack-objects.c
2011-12-14Merge branch 'jc/index-pack-reject-dups' into maintJunio C Hamano
* jc/index-pack-reject-dups: receive-pack, fetch-pack: reject bogus pack that records objects twice
2011-12-14Merge branch 'nd/misc-cleanups' into maintJunio C Hamano
* nd/misc-cleanups: unpack_object_header_buffer(): clear the size field upon error tree_entry_interesting: make use of local pointer "item" tree_entry_interesting(): give meaningful names to return values read_directory_recursive: reduce one indentation level get_tree_entry(): do not call find_tree_entry() on an empty tree tree-walk.c: do not leak internal structure in tree_entry_len()
2011-12-14Merge branch 'maint-1.7.7' into maintJunio C Hamano
* maint-1.7.7: Git 1.7.7.5 Git 1.7.6.5 blame: don't overflow time buffer fetch: create status table using strbuf checkout,merge: loosen overwriting untracked file check based on info/exclude cast variable in call to free() in builtin/diff.c and submodule.c apply: get rid of useless x < 0 comparison on a size_t type Conflicts: Documentation/git.txt GIT-VERSION-GEN RelNotes builtin/fetch.c
2011-12-14Merge branch 'ab/clang-lints' into maint-1.7.7Junio C Hamano
* ab/clang-lints: cast variable in call to free() in builtin/diff.c and submodule.c apply: get rid of useless x < 0 comparison on a size_t type
2011-12-14Merge branch 'nd/maint-ignore-exclude' into maint-1.7.7Junio C Hamano
* nd/maint-ignore-exclude: checkout,merge: loosen overwriting untracked file check based on info/exclude
2011-12-14Merge branch 'maint-1.7.6' into maint-1.7.7Junio C Hamano
* maint-1.7.6: Git 1.7.6.5 blame: don't overflow time buffer fetch: create status table using strbuf Conflicts: Documentation/git.txt GIT-VERSION-GEN RelNotes
2011-12-14Merge branch 'jk/maint-fetch-status-table' into maint-1.7.6Junio C Hamano
* jk/maint-fetch-status-table: fetch: create status table using strbuf
2011-12-14Merge branch 'jc/maint-name-rev-all' into maint-1.7.6Junio C Hamano
* jc/maint-name-rev-all: name-rev --all: do not even attempt to describe non-commit object
2011-12-14blame: don't overflow time bufferJeff King
When showing the raw timestamp, we format the numeric seconds-since-epoch into a buffer, followed by the timezone string. This string has come straight from the commit object. A well-formed object should have a timezone string of only a few bytes, but we could be operating on data pushed by a malicious user. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-13fetch-pack: match refs exactlyJeff King
When we are determining the list of refs to fetch via fetch-pack, we have two sets of refs to compare: those on the remote side, and a "match" list of things we want to fetch. We iterate through the remote refs alphabetically, seeing if each one is wanted by the "match" list. Since def88e9 (Commit first cut at "git-fetch-pack", 2005-07-04), we have used the "path_match" function to do a suffix match, where a remote ref is considered wanted if any of the "match" elements is a suffix of the remote refname. This enables callers of fetch-pack to specify unqualified refs and have them matched up with remote refs (e.g., ask for "A" and get remote's "refs/heads/A"). However, if you provide a fully qualified ref, then there are corner cases where we provide the wrong answer. For example, given a remote with two refs: refs/foo/refs/heads/master refs/heads/master asking for "refs/heads/master" will first match "refs/foo/refs/heads/master" by the suffix rule, and we will erroneously fetch it instead of refs/heads/master. As it turns out, all callers of fetch_pack do provide fully-qualified refs for the match list. There are two ways fetch_pack can get match lists: 1. Through the transport code (i.e., via git-fetch) 2. On the command-line of git-fetch-pack In the first case, we will always be providing the names of fully-qualified refs from "struct ref" objects. We will have pre-matched those ref objects already (since we have to handle more advanced matching, like wildcard refspecs), and are just providing a list of the refs whose objects we need. In the second case, users could in theory be providing non-qualified refs on the command-line. However, the fetch-pack documentation claims that refs should be fully qualified (and has always done so since it was written in 2005). Let's change this path_match call to simply check for string equality, matching what the callers of fetch_pack are expecting. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-13drop "match" parameter from get_remote_headsJeff King
The get_remote_heads function reads the list of remote refs during git protocol session. It dates all the way back to def88e9 (Commit first cut at "git-fetch-pack", 2005-07-04). At that time, the idea was to come up with a list of refs we were interested in, and then filter the list as we got it from the remote side. Later, 1baaae5 (Make maximal use of the remote refs, 2005-10-28) stopped filtering at the get_remote_heads layer, letting us use the non-matching refs to find common history. As a result, all callers now simply pass an empty match list (and any future callers will want to do the same). So let's drop these now-useless parameters. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-13Rename resolve_ref() to resolve_ref_unsafe()Nguyễn Thái Ngọc Duy
resolve_ref() may return a pointer to a shared buffer and can be overwritten by the next resolve_ref() calls. Callers need to pay attention, not to keep the pointer when the next call happens. Rename with "_unsafe" suffix to warn developers (or reviewers) before introducing new call sites. This patch is generated using the following command git grep -l 'resolve_ref(' -- '*.[ch]'|xargs sed -i 's/resolve_ref(/resolve_ref_unsafe(/g' Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-13Convert resolve_ref+xstrdup to new resolve_refdup functionNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-13Update documentation for stripspaceConrad Irwin
Tell the user what this command is intended for, and expand the description of what it does. Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12mv: be quiet about overwritingJeff King
When a user asks us to force a mv and overwrite the destination, we print a warning. However, since a typical use would be: $ git mv one two fatal: destination exists, source=one, destination=two $ git mv -f one two warning: overwriting 'two' this warning is just noise. We already know we're overwriting; that's why we gave -f! This patch silences the warning unless "--verbose" is given. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12mv: improve overwrite warningJeff King
When we try to "git mv" over an existing file, the error message is fairly informative: $ git mv one two fatal: destination exists, source=one, destination=two When the user forces the overwrite, we give a warning: $ git mv -f one two warning: destination exists; will overwrite! This is less informative, but still sufficient in the simple rename case, as there is only one rename happening. But when moving files from one directory to another, it becomes useless: $ mkdir three $ touch one two three/one $ git add . $ git mv one two three fatal: destination exists, source=one, destination=three/one $ git mv -f one two three warning: destination exists; will overwrite! The first message is helpful, but the second one gives us no clue about what was overwritten. Let's mention the name of the destination file: $ git mv -f one two three warning: overwriting 'three/one' Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12revert: stop creating and removing sequencer-old directoryJonathan Nieder
Now that "git reset" no longer implicitly removes .git/sequencer that the operator may or may not have wanted to keep, the logic to write a backup copy of .git/sequencer and remove it when stale is not needed any more. Simplify the sequencer API and repository layout by dropping it. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12revert: do not remove state until sequence is finishedJonathan Nieder
As v1.7.8-rc0~141^2~4 (2011-08-04) explains, git cherry-pick removes the sequencer state just before applying the final patch. In the single-pick case, that was a good thing, since --abort and --continue work fine without access to such state and removing it provides a signal that git should not complain about the need to clobber it ("a cherry-pick or revert is already in progress") in sequences like the following: git cherry-pick foo git read-tree -m -u HEAD; # forget that; let's try a different one git cherry-pick bar After the recent patch "allow single-pick in the middle of cherry-pick sequence" we don't need that hack any more. In the new regime, a traditional "git cherry-pick <commit>" command never looks at .git/sequencer, so we do not need to cripple "git cherry-pick <commit>..<commit>" for it any more. So now you can run "git cherry-pick --abort" near the end of a multi-pick sequence and it will abort the entire sequence, instead of misbehaving and aborting just the final commit. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12revert: allow single-pick in the middle of cherry-pick sequenceJonathan Nieder
After messing up a difficult conflict resolution in the middle of a cherry-pick sequence, it can be useful to be able to git checkout HEAD . && git cherry-pick that-one-commit to restart the conflict resolution. The current code however errors out saying that another cherry-pick is already in progress. Suggested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12revert: pass around rev-list args in already-parsed formJonathan Nieder
Since 7e2bfd3f (revert: allow cherry-picking more than one commit, 2010-07-02), the pick/revert machinery has kept track of the set of commits to be cherry-picked or reverted using commit_argc and commit_argv variables, storing the corresponding command-line parameters. Future callers as other commands are built in (am, rebase, sequencer) may find it easier to pass rev-list options to this machinery in already-parsed form. Teach cmd_cherry_pick and cmd_revert to parse the rev-list arguments in advance and pass the commit set to pick_revisions() as a rev_info structure. Original patch by Jonathan, tweaks and test from Ram. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Improved-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12revert: allow cherry-pick --continue to commit before resumingJonathan Nieder
When "git cherry-pick ..bar" encounters conflicts, permit the operator to use cherry-pick --continue after resolving them as a shortcut for "git commit && git cherry-pick --continue" to record the resolution and carry on with the rest of the sequence. This improves the analogy with "git rebase" (in olden days --continue was the way to preserve authorship when a rebase encountered conflicts) and fits well with a general UI goal of making "git cmd --continue" save humans the trouble of deciding what to do next. Example: after encountering a conflict from running "git cherry-pick foo bar baz": CONFLICT (content): Merge conflict in main.c error: could not apply f78a8d98c... bar! hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit' We edit main.c to resolve the conflict, mark it acceptable with "git add main.c", and can run "cherry-pick --continue" to resume the sequence. $ git cherry-pick --continue [editor opens to confirm commit message] [master 78c8a8c98] bar! 1 files changed, 1 insertions(+), 1 deletions(-) [master 87ca8798c] baz! 1 files changed, 1 insertions(+), 1 deletions(-) This is done for both codepaths to pick multiple commits and a single commit. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12revert: give --continue handling its own functionJonathan Nieder
This makes pick_revisions() a little shorter and easier to read straight through. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12mv: make non-directory destination error more clearJeff King
If you try to "git mv" multiple files onto another non-directory file, you confusingly get the "usage" message: $ touch one two three $ git add . $ git mv one two three usage: git mv [options] <source>... <destination> [...] From the user's perspective, that makes no sense. They just gave parameters that exactly match that usage! This behavior dates back to the original C version of "git mv", which had a usage message like: usage: git mv (<source> <destination> | <source>... <destination>) This was slightly less confusing, because it at least mentions that there are two ways to invoke (but it still isn't clear why what the user provided doesn't work). Instead, let's show an error message like: $ git mv one two three fatal: destination 'three' is not a directory We could leave the usage message in place, too, but it doesn't actually help here. It contains no hints that there are two forms, nor that multi-file form requires that the endpoint be a directory. So it just becomes useless noise that distracts from the real error. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12mv: honor --verbose flagJeff King
The code for a verbose flag has been here since "git mv" was converted to C many years ago, but actually getting the "-v" flag from the command line was accidentally lost in the transition. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12revert: convert resolve_ref() to read_ref_full()Nguyễn Thái Ngọc Duy
This is the follow up of c689332 (Convert many resolve_ref() calls to read_ref*() and ref_exists() - 2011-11-13). See the said commit for rationale. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10fetch: create status table using strbufJeff King
When we fetch from a remote, we print a status table like: From url * [new branch] foo -> origin/foo We create this table in a static buffer using sprintf. If the remote refnames are long, they can overflow this buffer and smash the stack. Instead, let's use a strbuf to build the string. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-09Merge branch 'nd/resolve-ref'Junio C Hamano
* nd/resolve-ref: Copy resolve_ref() return value for longer use Convert many resolve_ref() calls to read_ref*() and ref_exists() Conflicts: builtin/fmt-merge-msg.c builtin/merge.c refs.c
2011-12-09Merge branch 'jc/pull-signed-tag'Junio C Hamano
* jc/pull-signed-tag: commit-tree: teach -m/-F options to read logs from elsewhere commit-tree: update the command line parsing commit: teach --amend to carry forward extra headers merge: force edit and no-ff mode when merging a tag object commit: copy merged signed tags to headers of merge commit merge: record tag objects without peeling in MERGE_HEAD merge: make usage of commit->util more extensible fmt-merge-msg: Add contents of merged tag in the merge message fmt-merge-msg: package options into a structure fmt-merge-msg: avoid early returns refs DWIMmery: use the same rule for both "git fetch" and others fetch: allow "git fetch $there v1.0" to fetch a tag merge: notice local merging of tags and keep it unwrapped fetch: do not store peeled tag object names in FETCH_HEAD Split GPG interface into its own helper library Conflicts: builtin/fmt-merge-msg.c builtin/merge.c
2011-12-09Merge branch 'jc/request-pull-show-head-4'Junio C Hamano
* jc/request-pull-show-head-4: request-pull: use the annotated tag contents fmt-merge-msg.c: Fix an "dubious one-bit signed bitfield" sparse error environment.c: Fix an sparse "symbol not declared" warning builtin/log.c: Fix an "Using plain integer as NULL pointer" warning fmt-merge-msg: use branch.$name.description request-pull: use the branch description request-pull: state what commit to expect request-pull: modernize style branch: teach --edit-description option format-patch: use branch description in cover letter branch: add read_branch_desc() helper function Conflicts: builtin/branch.c