summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2010-10-08Fix {update,checkout}-index usage stringsLibravatar Štěpán Němec2-2/+2
The `<file>' argument is optional in both cases (the man pages are already correct). Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08Put a space between `<' and argument in pack-objects usage stringLibravatar Štěpán Němec1-1/+1
This makes it cosistent with other places (including the git-pack-objects(1) manpage itself) and avoids possible confusion (I, for one, mistook `<object-list' for a `<object-list>' typo at first when preparing this series). Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08Use parentheses and `...' where appropriateLibravatar Štěpán Němec8-8/+8
Remove some stray usage of other bracket types and asterisks for the same purpose. Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08Use angles for placeholders consistentlyLibravatar Štěpán Němec6-12/+12
Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06do not depend on signed integer overflowLibravatar Erik Faye-Lund3-3/+3
Signed integer overflow is not defined in C, so do not depend on it. This fixes a problem with GCC 4.4.0 and -O3 where the optimizer would consider "consumed_bytes > consumed_bytes + bytes" as a constant expression, and never execute the die()-call. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06init: plug tiny one-time memory leakLibravatar Jonathan Nieder1-13/+19
The buffer used to construct paths like ".git/objects/info" and ".git/objects/pack" is allocated on the heap and never freed. So free it. While at it, factor out the relevant code into its own function and rename the sha1_dir variable to object_directory (to match the change in everyday usage after the renaming of SHA1_FILE_DIRECTORY in v0.99~603^2~7, 2005). Noticed by valgrind while setting up tests (in test-lib). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-30Fix typo in pack-objects' usageLibravatar Johannes Schindelin1-1/+1
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27Improvements to `git checkout -h`Libravatar Daniel Knittl-Frank1-6/+6
be a little more verbose about what each option does Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-15Merge branch 'dr/maint-ls-tree-prefix-recursion-fix'Libravatar Junio C Hamano1-0/+2
* dr/maint-ls-tree-prefix-recursion-fix: ls-tree $di $dir: do not mistakenly recurse into directories
2010-09-12ls-tree $di $dir: do not mistakenly recurse into directoriesLibravatar Junio C Hamano1-0/+2
When applying two pathspecs, one of which is named as a prefix to the other, we mistakenly recursed into the shorter one. Noticed and fixed by David Reis. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09builtin/fetch.c: comment that branch->remote_name is usable when has_mergeLibravatar Brandon Casey1-0/+3
Save future readers the trouble of tracing code to determine that the two uses of branch->remote_name are safe when has_merge is set, by adding a comment explaining that it is so. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-08Merge branch 'jh/error-removing-missing-note'Libravatar Junio C Hamano1-4/+10
* jh/error-removing-missing-note: notes: Don't create (empty) commit when removing non-existing notes
2010-09-08Merge branch 'bc/maint-fetch-url-only'Libravatar Junio C Hamano1-1/+3
* bc/maint-fetch-url-only: builtin/fetch.c: ignore merge config when not fetching from branch's remote t/t5510: demonstrate failure to fetch when current branch has merge ref
2010-09-08Merge branch 'en/d-f-conflict-fix'Libravatar Junio C Hamano1-1/+9
* en/d-f-conflict-fix: fast-export: ensure that a renamed file is printed after all references
2010-09-08fast-export: ensure that a renamed file is printed after all referencesLibravatar Johannes Sixt1-1/+9
t9350 sets up a commit where a file is both copied and renamed. The output of fast-export for this commit should look like this: author ... committer ... from :19 C "file2" "file4" R "file2" "file5" The order of the two modification lines is derived from the result that the diff machinery produces. 060df62 (fast-export: Fix output order of D/F changes) inserted a qsort call that modifies the order of the diff result. Unfortunately, qsort need not be stable. Therefore, it is possible that the 'R' line appears before the 'C' line and the resulting fast-import stream is incorrect. Fix it by forcing that the rename entry is printed after all other modification lines with the same file name. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-06revert: Fix trivial comment style issueLibravatar Elijah Newren1-1/+0
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-06Merge branch 'jh/clean-exclude'Libravatar Junio C Hamano1-1/+1
* jh/clean-exclude: builtin/clean.c: Use STRING_LIST_INIT_NODUP.
2010-09-06builtin/clean.c: Use STRING_LIST_INIT_NODUP.Libravatar Thiago Farina1-1/+1
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-04Merge branch 'jl/submodule-ignore-diff'Libravatar Junio C Hamano1-4/+17
* jl/submodule-ignore-diff: checkout: Use submodule.*.ignore settings from .git/config and .gitmodules checkout: Add test for diff.ignoreSubmodules checkout: respect diff.ignoreSubmodules setting Conflicts: builtin/checkout.c
2010-09-03Merge branch 'dg/local-mod-error-messages'Libravatar Junio C Hamano2-4/+2
* dg/local-mod-error-messages: t7609-merge-co-error-msgs: test non-fast forward case too. Move "show_all_errors = 1" to setup_unpack_trees_porcelain() setup_unpack_trees_porcelain: take the whole options struct as parameter Move set_porcelain_error_msgs to unpack-trees.c and rename it Conflicts: merge-recursive.c
2010-09-03Merge branch 'nd/clone-depth-zero'Libravatar Junio C Hamano1-2/+5
* nd/clone-depth-zero: clone: warn users --depth is ignored in local clones
2010-09-03Merge branch 'jn/apply-filename-with-sp'Libravatar Junio C Hamano1-38/+211
* jn/apply-filename-with-sp: apply: handle traditional patches with space in filename tests: exercise "git apply" with weird filenames apply: split quoted filename handling into new function
2010-09-03Merge branch 'jn/merge-custom-no-trivial'Libravatar Junio C Hamano1-0/+1
* jn/merge-custom-no-trivial: t7606: Avoid using head as a file name merge: let custom strategies intervene in trivial merges t7606 (merge-theirs): modernize style
2010-09-03Merge branch 'jn/update-contrib-example-merge'Libravatar Junio C Hamano3-6/+58
* jn/update-contrib-example-merge: (24 commits) merge script: learn --[no-]rerere-autoupdate merge script: notice @{-1} shorthand merge script: handle --no-ff --no-commit correctly merge script: --ff-only to disallow true merge merge script: handle many-way octopus merge script: handle -m --log correctly merge script: forbid merge -s index merge script: allow custom strategies merge script: merge -X<option> merge script: improve log message subject merge script: refuse to merge during merge merge script: tweak unmerged files message to match builtin merge script: --squash, --ff from unborn branch are errors fmt-merge-msg -m to override merge title merge-base --independent to print reduced parent list in a merge merge-base --octopus to mimic show-branch --merge-base Documentation: add a SEE ALSO section for merge-base t6200 (fmt-merge-msg): style nitpicks t6010 (merge-base): modernize style t7600 (merge): test merge from branch yet to be born ...
2010-09-03Merge branch 'jn/merge-renormalize'Libravatar Junio C Hamano5-26/+64
* jn/merge-renormalize: merge-recursive --renormalize rerere: never renormalize rerere: migrate to parse-options API t4200 (rerere): modernize style ll-merge: let caller decide whether to renormalize ll-merge: make flag easier to populate Documentation/technical: document ll_merge merge-trees: let caller decide whether to renormalize merge-trees: push choice to renormalize away from low level t6038 (merge.renormalize): check that it can be turned off t6038 (merge.renormalize): try checkout -m and cherry-pick t6038 (merge.renormalize): style nitpicks Don't expand CRLFs when normalizing text during merge Try normalizing files to avoid delete/modify conflicts when merging Avoid conflicts when merging branches with mixed normalization Conflicts: builtin/rerere.c t/t4200-rerere.sh
2010-09-03Sync with 1.7.2.3Libravatar Junio C Hamano1-1/+4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-03builtin/merge_recursive.c: Add an usage string and make use of it.Libravatar Thiago Farina1-1/+4
This improves the usage output by adding builtin_merge_recursive_usage string that follows the same pattern used by the other builtin commands. The previous output for git merger-recursive was: usage: merge-recursive <base>... -- <head> <remote> ... Now the output is: usage: git merge-recursive <base>... -- <head> <remote> ... Since cmd_merge_recursive is used to handle four different commands we need the %s in the usage string, so the following example: $ git merge-subtree -h Will output: usage: git merge-subtree <base>... -- <head> <remote> ... Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-03Move "show_all_errors = 1" to setup_unpack_trees_porcelain()Libravatar Matthieu Moy2-2/+0
Not only this makes the code clearer since setting up the porcelain error message is meant to work with show_all_errors, but this fixes a call to setup_unpack_trees_porcelain() in git_merge_trees() which did not set show_all_errors. add_rejected_path() used to double-check whether it was running in plumbing mode. This check was ineffective since it was setting show_all_errors too late for traverse_trees() to see it, and is made useless by this patch. Remove it. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-03setup_unpack_trees_porcelain: take the whole options struct as parameterLibravatar Matthieu Moy2-2/+2
This is a preparation patch to let setup_unpack_trees_porcelain set show_all_errors itself. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-03Move set_porcelain_error_msgs to unpack-trees.c and rename itLibravatar Matthieu Moy2-2/+2
The function is currently dealing only with error messages, but the intent of calling it is really to notify the unpack-tree mechanics that it is running in porcelain mode. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-01Merge branch 'sg/rerere-gc-old-still-used' into maintLibravatar Junio C Hamano1-5/+16
* sg/rerere-gc-old-still-used: rerere: fix overeager gc mingw_utime(): handle NULL times parameter
2010-09-01Merge branch 'dj/fetch-tagopt' into maintLibravatar Junio C Hamano1-4/+6
* dj/fetch-tagopt: fetch: allow command line --tags to override config
2010-08-31Merge branch 'jn/cherry-revert-message-clean-up'Libravatar Junio C Hamano1-69/+70
* jn/cherry-revert-message-clean-up: tests: fix syntax error in "Use advise() for hints" test cherry-pick/revert: Use advise() for hints cherry-pick/revert: Use error() for failure message Introduce advise() to print hints Eliminate “Finished cherry-pick/revert” message t3508: add check_head_differs_from() helper function and use it revert: improve success message by adding abbreviated commit sha1 revert: don't print "Finished one cherry-pick." if commit failed revert: refactor commit code into a new run_git_commit() function revert: report success when using option --strategy
2010-08-31Merge branch 'ab/maint-reset-mixed-w-pathspec-advice'Libravatar Junio C Hamano1-1/+1
* ab/maint-reset-mixed-w-pathspec-advice: reset: suggest what to do upon "git reset --mixed <paths>"
2010-08-31Merge branch 'dj/fetch-tagopt'Libravatar Junio C Hamano1-4/+6
* dj/fetch-tagopt: fetch: allow command line --tags to override config
2010-08-31Merge branch 'en/d-f-conflict-fix'Libravatar Junio C Hamano1-0/+29
* en/d-f-conflict-fix: merge-recursive: Avoid excessive output for and reprocessing of renames merge-recursive: Fix multiple file rename across D/F conflict t6031: Add a testcase covering multiple renames across a D/F conflict merge-recursive: Fix typo Mark tests that use symlinks as needing SYMLINKS prerequisite t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test fast-import: Improve robustness when D->F changes provided in wrong order fast-export: Fix output order of D/F changes merge_recursive: Fix renames across paths below D/F conflicts merge-recursive: Fix D/F conflicts Add a rename + D/F conflict testcase Add additional testcases for D/F conflicts Conflicts: merge-recursive.c
2010-08-31Merge branch 'jn/paginate-fix'Libravatar Junio C Hamano9-31/+13
* jn/paginate-fix: t7006 (pager): add missing TTY prerequisites merge-file: run setup_git_directory_gently() sooner var: run setup_git_directory_gently() sooner ls-remote: run setup_git_directory_gently() sooner index-pack: run setup_git_directory_gently() sooner config: run setup_git_directory_gently() sooner bundle: run setup_git_directory_gently() sooner apply: run setup_git_directory_gently() sooner grep: run setup_git_directory_gently() sooner shortlog: run setup_git_directory_gently() sooner git wrapper: allow setup_git_directory_gently() be called earlier setup: remember whether repository was found git wrapper: introduce startup_info struct Conflicts: builtin/index-pack.c
2010-08-31Merge branch 'jn/maint-setup-fix'Libravatar Junio C Hamano1-19/+5
* jn/maint-setup-fix: setup: split off a function to handle ordinary .git directories Revert "rehabilitate 'git index-pack' inside the object store" setup: do not forget working dir from subdir of gitdir t4111 (apply): refresh index before applying patches to it setup: split off get_device_or_die helper setup: split off a function to handle hitting ceiling in repo search setup: split off code to handle stumbling upon a repository setup: split off a function to checks working dir for .git file setup: split off $GIT_DIR-set case from setup_git_directory_gently tests: try git apply from subdir of toplevel t1501 (rev-parse): clarify Conflicts: builtin/index-pack.c
2010-08-31Merge branch 'en/fast-export-fix'Libravatar Junio C Hamano1-1/+10
* en/fast-export-fix: fast-export: Add a --full-tree option fast-export: Fix dropping of files with --import-marks and path limiting
2010-08-31Merge branch 'sg/rerere-gc-old-still-used'Libravatar Junio C Hamano1-5/+16
* sg/rerere-gc-old-still-used: rerere: fix overeager gc mingw_utime(): handle NULL times parameter
2010-08-31notes: Don't create (empty) commit when removing non-existing notesLibravatar Johan Herland1-4/+10
Extend remove_note() in the notes API to return whether or not a note was actually removed. Use this in 'git notes remove' to skip the creation of a notes commit when no notes were actually removed. Also add a test illustrating the change in behavior. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-30checkout: Use submodule.*.ignore settings from .git/config and .gitmodulesLibravatar Jens Lehmann1-0/+5
For "git status" and the diff family the submodule.*.ignore settings from .git/config and .gitmodules can be used to override the default set via diff.ignoreSubmodules on a per-submodule basis. Let's do this consistently and teach checkout to use these settings too. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-29object.h: Add OBJECT_ARRAY_INIT macro and make use of it.Libravatar Thiago Farina3-3/+3
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-26Merge branch 'maint'Libravatar Junio C Hamano2-7/+3
* maint: for-each-ref: fix objectname:short bug tree-walk: Correct bitrotted comment about tree_entry() Fix 'git log' early pager startup error case
2010-08-26for-each-ref: fix objectname:short bugLibravatar Jay Soffian1-1/+2
When objectname:short was introduced, it forgot to copy the result of find_unique_abbrev. Because the result of find_unique_abbrev is a pointer to static buffer, this resulted in the same value being substituted in for each ref. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-25builtin/fetch.c: ignore merge config when not fetching from branch's remoteLibravatar Brandon Casey1-1/+3
When 'git fetch' is supplied a single argument, it tries to match it against a configured remote and then fetch the refs specified by the named remote's fetchspec. Additionally, or alternatively, if the current branch has a merge ref configured, and if the name of the remote supplied to fetch matches the one in the branch's configuration, then git also adds the merge ref to the list of refs to update. If the argument to fetch does not specify a named remote, or if the name supplied does not match the remote configured for the current branch, then the current branch's merge configuration should not be considered. git currently mishandles the case when the argument to fetch specifies a GIT URL(i.e. not a named remote) and the current branch has a configured merge ref. In this case, fetch should ignore the branch's merge ref and attempt to fetch from the remote repository's HEAD branch. But, since fetch only checks _whether_ the current branch has a merge ref configured, and does _not_ check whether the branch's configured remote matches the command line argument (until later), it will mistakenly enter the wrong branch of an 'if' statement and will not fall back to fetch the HEAD branch. The fetch ends up doing nothing and returns with a successful zero status. Fix this by comparing the remote repository's name to the branch's remote name, in addition to whether it has a configured merge ref, sooner, so that fetch can correctly decide whether the branch's configuration is interesting or not, and fall back to fetching from the remote's HEAD branch when appropriate. This fixes the test in t5510. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-25checkout: respect diff.ignoreSubmodules settingLibravatar Johannes Schindelin1-4/+12
When 'git checkout' reports uncommitted changes, it also does so for submodules. The default mode is now to look really hard into submodules, not only for different commits, but also for modified files. Since this can be pretty expensive when there are a lot (and large) submodules, there is the diff.ignoreSubmodules option. Let's respect that setting when 'git checkout' reports the uncommitted changes, since it does nothing else than a 'git diff --name-status'. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-25Fix 'git log' early pager startup error caseLibravatar Linus Torvalds1-6/+1
We start the pager too early for several git commands, which results in the errors sometimes going to the pager rather than show up as errors. This is often hidden by the fact that we pass in '-X' to less by default, which causes 'less' to exit for small output, but if you do export LESS=-S you can then clearly see the problem by doing git log --prretty which shows the error message ("fatal: unrecognized argument: --prretty") being sent to the pager. This happens for pretty much all git commands that use USE_PAGER, and then check arguments separately. But "git diff" does it too early too (even though it does an explicit setup_pager() call) This only fixes it for the trivial "git log" family case. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-24clone: warn users --depth is ignored in local clonesLibravatar Nguyễn Thái Ngọc Duy1-2/+5
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-22Merge branch 'maint'Libravatar Junio C Hamano1-2/+2
* maint: Typos in code comments, an error message, documentation