summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2011-03-16Merge branch 'jh/push-default-upstream-configname' into maintLibravatar Junio C Hamano1-5/+5
* jh/push-default-upstream-configname: push.default: Rename 'tracking' to 'upstream'
2011-03-16Merge branch 'mg/placeholders-are-lowercase' into maintLibravatar Junio C Hamano8-25/+25
* mg/placeholders-are-lowercase: Make <identifier> lowercase in Documentation Make <identifier> lowercase as per CodingGuidelines Make <identifier> lowercase as per CodingGuidelines Make <identifier> lowercase as per CodingGuidelines CodingGuidelines: downcase placeholders in usage messages
2011-03-16Merge branch 'mg/patch-id' into maintLibravatar Junio C Hamano1-0/+2
* mg/patch-id: git-patch-id: do not trip over "no newline" markers git-patch-id: test for "no newline" markers
2011-03-16Merge branch 'js/maint-merge-use-prepare-commit-msg-hook' into maintLibravatar Junio C Hamano1-8/+29
* js/maint-merge-use-prepare-commit-msg-hook: merge: honor prepare-commit-msg hook
2011-03-16cherry: split off function to print output linesLibravatar Jonathan Nieder1-16/+18
Readers uninterested in the details of "git cherry"'s output format can see print_commit('-', commit, verbose, abbrev); and ignore the details. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16branch: split off function that writes tracking info and commit subjectLibravatar Jonathan Nieder1-21/+27
Introduce a add_verbose_info function that takes care of adding - an abbreviated object name; - a summary of the form [ahead x, behind y] of the relationship to the corresponding upstream branch; - a one line commit subject for the tip commit of a branch, for use in "git branch -v" output. No functional change intended. This just unindents the code a little and makes it easier to skip on first reading. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16standardize brace placement in struct definitionsLibravatar Jonathan Nieder4-10/+5
In a struct definitions, unlike functions, the prevailing style is for the opening brace to go on the same line as the struct name, like so: struct foo { int bar; char *baz; }; Indeed, grepping for 'struct [a-z_]* {$' yields about 5 times as many matches as 'struct [a-z_]*$'. Linus sayeth: Heretic people all over the world have claimed that this inconsistency is ... well ... inconsistent, but all right-thinking people know that (a) K&R are _right_ and (b) K&R are right. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-03init: remove unnecessary checkLibravatar Nguyễn Thái Ngọc Duy1-7/+5
git_dir must always be non-NULL so "if (git_dir)" is unnecessary. Before this code, if git_dir == NULL, it will default to DEFAULT_GIT_DIR_ENVIRONMENT. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-27branch_merged: fix grammar in warningLibravatar Eric Hanchrow1-1/+1
Signed-off-by: Eric Hanchrow <eric.hanchrow@gmail.com> Helped-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-17git-patch-id: do not trip over "no newline" markersLibravatar Michael J Gruber1-0/+2
Currently, patch-id trips over our very own diff extension for marking the absence of newline at EOF. Fix it. (Ignore it, it's whitespace.) Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-16push.default: Rename 'tracking' to 'upstream'Libravatar Johan Herland1-5/+5
Users are sometimes confused with two different types of "tracking" behavior in Git: "remote-tracking" branches (e.g. refs/remotes/*/*) versus the merge/rebase relationship between a local branch and its @{upstream} (controlled by branch.foo.remote and branch.foo.merge config settings). When the push.default is set to 'tracking', it specifies that a branch should be pushed to its @{upstream} branch. In other words, setting push.default to 'tracking' applies only to the latter of the above two types of "tracking" behavior. In order to make this more understandable to the user, we rename the push.default == 'tracking' option to push.default == 'upstream'. push.default == 'tracking' is left as a deprecated synonym for 'upstream'. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15merge: honor prepare-commit-msg hookLibravatar Jay Soffian1-8/+29
When a merge is stopped due to conflicts or --no-commit, the subsequent commit calls the prepare-commit-msg hook. However, it is not called after a clean merge. Fix this inconsistency by invoking the hook after clean merges as well. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15Make <identifier> lowercase as per CodingGuidelinesLibravatar Michael J Gruber8-25/+25
*.c part for matches with '"[A-Z]+"'. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15commit,status: describe -u likewiseLibravatar Michael J Gruber1-1/+1
They differ by one character only. Being exactly equal should help translations. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15add: describe --patch like checkout, resetLibravatar Michael J Gruber1-1/+1
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15commit,merge,tag: describe -m likewiseLibravatar Michael J Gruber3-5/+5
This also removes the superfluous "specify" and rewords the misleading "if any" which sounds as if omitting "-m" would omit the merge commit message. (It means "if a merge commit is created at all".) Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15clone,init: describe --template using the same wordingLibravatar Michael J Gruber2-3/+3
This also corrects a wrong description for clone. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15commit,status: describe --porcelain just like pushLibravatar Michael J Gruber1-2/+2
Push has the clearer description, so take that one for all. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15commit,tag: use same wording for -FLibravatar Michael J Gruber2-2/+2
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-14correct type of EMPTY_TREE_SHA1_BINLibravatar Jonathan Nieder1-1/+1
Functions such as hashcmp that expect a binary SHA-1 value take parameters of type "unsigned char *" to avoid accepting a textual SHA-1 passed by mistake. Unfortunately, this means passing the string literal EMPTY_TREE_SHA1_BIN requires an ugly cast. Tweak the definition of EMPTY_TREE_SHA1_BIN to produce a value of more convenient type. In the future the definition might change to extern const unsigned char empty_tree_sha1_bin[20]; #define EMPTY_TREE_SHA1_BIN empty_tree_sha1_bin Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11Merge branch 'jc/fsck-fixes' into maintLibravatar Junio C Hamano1-9/+22
* jc/fsck-fixes: fsck: do not give up too early in fsck_dir() fsck: drop unused parameter from traverse_one_object()
2011-02-11clone: fixup recurse_submodules optionLibravatar Chris Packham1-1/+1
The recurse_submodules option was added in ccdd3da6 to bring 'git clone' into line with 'git fetch' and future commands. The correct option should have been "recurse-submodules". Signed-off-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-07diff: support --cached on unborn branchesLibravatar Nguyễn Thái Ngọc Duy1-2/+5
"git diff --cached" (without revision) used to mean "git diff --cached HEAD" (i.e. the user was too lazy to type HEAD). This "correctly" failed when there was no commit yet. But was that correctness useful? This patch changes the definition of what particular command means. It is a request to show what _would_ be committed without further "git add". The internal implementation is the same "git diff --cached HEAD" when HEAD exists, but when there is no commit yet, it compares the index with an empty tree object to achieve the desired result. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-27fsck: do not give up too early in fsck_dir()Libravatar Junio C Hamano1-6/+12
When there is a random garbage file whose name happens to be 38-byte long in a .git/objects/??/ directory, the loop terminated prematurely without marking all the other files that it hasn't checked in the readdir() loop. Treat such a file just like any other garbage file, and do not break out of the readdir() loop. While at it, replace repeated sprintf() calls to a single one outside the loop. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-27fsck: drop unused parameter from traverse_one_object()Libravatar Junio C Hamano1-3/+10
Also add comments to seemingly unsafe pointer dereferences, that are all safe. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-18remote-ext: do not segfault for blank linesLibravatar Jonathan Nieder1-4/+4
Instead of stripping space characters past the beginning of the line and overflowing a buffer, stop at the beginning of the line (mimicking the corresponding fix in remote-fd). The argument to isspace does not need to be cast explicitly because git isspace takes care of that already. Noticed-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-12Merge branch 'maint'Libravatar Junio C Hamano1-2/+2
* maint: commit: suggest --amend --reset-author to fix commiter identity
2011-01-12commit: suggest --amend --reset-author to fix commiter identityLibravatar Matthieu Moy1-2/+2
Since the message advises to fix the configuration first, the advantage of using this command is that it is cut-and-paste ready, while using --author='...' requires the user to type his name and email again. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-28Merge branch 'nd/setup'Libravatar Junio C Hamano1-2/+11
* nd/setup: (47 commits) setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd git.txt: correct where --work-tree path is relative to Revert "Documentation: always respect core.worktree if set" t0001: test git init when run via an alias Remove all logic from get_git_work_tree() setup: rework setup_explicit_git_dir() setup: clean up setup_discovered_git_dir() t1020-subdirectory: test alias expansion in a subdirectory setup: clean up setup_bare_git_dir() setup: limit get_git_work_tree()'s to explicit setup case only Use git_config_early() instead of git_config() during repo setup Add git_config_early() git-rev-parse.txt: clarify --git-dir t1510: setup case #31 t1510: setup case #30 t1510: setup case #29 t1510: setup case #28 t1510: setup case #27 t1510: setup case #26 t1510: setup case #25 ...
2010-12-22Merge branch 'jk/commit-die-on-bogus-ident'Libravatar Junio C Hamano1-22/+32
* jk/commit-die-on-bogus-ident: commit: die before asking to edit the log message ident: die on bogus date format Conflicts: builtin/commit.c
2010-12-22Merge branch 'tf/commit-list-prefix'Libravatar Junio C Hamano3-8/+8
* tf/commit-list-prefix: commit: Add commit_list prefix in two function names. Conflicts: sha1_name.c
2010-12-22Remove all logic from get_git_work_tree()Libravatar Nguyễn Thái Ngọc Duy1-3/+11
This logic is now only used by cmd_init_db(). setup_* functions do not rely on it any more. Move all the logic to cmd_init_db() and turn get_git_work_tree() into a simple function. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22setup: limit get_git_work_tree()'s to explicit setup case onlyLibravatar Nguyễn Thái Ngọc Duy1-0/+1
get_git_work_tree() takes input as core.worktree, core.bare, GIT_WORK_TREE and decides correct worktree setting. Unfortunately it does not do its job well. core.worktree and GIT_WORK_TREE should only be taken into account, if GIT_DIR is set (which is handled by setup_explicit_git_dir). For other setup cases, only core.bare matters. Add a temporary variable setup_explicit to adjust get_git_work_tree() behavior as such. This variable will be gone once setup_* rework is done. Also remove is_bare_repository_cfg check in set_git_work_tree() to ease the rework. We are going to check for core.bare and core.worktree early before setting worktree. For example, if core.bare is true, no need to set worktree. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-20commit: die before asking to edit the log messageLibravatar Junio C Hamano1-22/+32
When determine_author_info() returns to the calling prepare_to_commit(), we already know the pieces of information necessary to determine what author ident will be used in the final message, but deferred making a call to fmt_ident() before the final commit_tree(). Most importantly, we would open the editor to ask the user to compose the log message before it. As one important side effect of fmt_ident() is to error out when the given information is malformed, this resulted in us spawning the editor first and then refusing to commit due to error, even though we had enough information to detect the error before starting the editor, which was annoying. Move the fmt_ident() call to the end of determine_author_info() where we have final determination of author info to rectify this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.Libravatar Thiago Farina1-10/+2
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.Libravatar Thiago Farina1-6/+1
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-16Merge branch 'jl/fetch-submodule-recursive'Libravatar Junio C Hamano1-14/+50
* jl/fetch-submodule-recursive: fetch_populated_submodules(): document dynamic allocation Submodules: Add the "fetchRecurseSubmodules" config option Add the 'fetch.recurseSubmodules' config setting fetch/pull: Add the --recurse-submodules option Conflicts: builtin/fetch.c
2010-12-16Merge branch 'aa/status-hilite-branch'Libravatar Junio C Hamano1-0/+2
* aa/status-hilite-branch: default color.status.branch to "same as header" status: show branchname with a configurable color
2010-12-16Merge branch 'ak/describe-exact'Libravatar Junio C Hamano1-25/+60
* ak/describe-exact: describe: Delay looking up commits until searching for an inexact match describe: Store commit_names in a hash table by commit SHA1 describe: Do not use a flex array in struct commit_name describe: Use for_each_rawref
2010-12-12Merge branch 'jn/parse-options-extra'Libravatar Junio C Hamano3-154/+248
* jn/parse-options-extra: update-index: migrate to parse-options API setup: save prefix (original cwd relative to toplevel) in startup_info parse-options: make resuming easier after PARSE_OPT_STOP_AT_NON_OPTION parse-options: allow git commands to invent new option types parse-options: never suppress arghelp if LITERAL_ARGHELP is set parse-options: do not infer PARSE_OPT_NOARG from option type parse-options: sanity check PARSE_OPT_NOARG flag parse-options: move NODASH sanity checks to parse_options_check parse-options: clearer reporting of API misuse parse-options: Don't call parse_options_check() so much
2010-12-12Merge branch 'tc/format-patch-p'Libravatar Junio C Hamano1-0/+2
* tc/format-patch-p: format-patch: page output with --stdout
2010-12-12Merge branch 'jn/git-cmd-h-bypass-setup'Libravatar Junio C Hamano7-0/+24
* jn/git-cmd-h-bypass-setup: update-index -h: show usage even with corrupt index merge -h: show usage even with corrupt index ls-files -h: show usage even with corrupt index gc -h: show usage even with broken configuration commit/status -h: show usage even with broken configuration checkout-index -h: show usage even in an invalid repository branch -h: show usage even in an invalid repository Conflicts: builtin/merge.c
2010-12-10Merge branch 'mg/maint-tag-rfc1991' into maintLibravatar Junio C Hamano2-20/+6
* mg/maint-tag-rfc1991: tag: recognize rfc1991 signatures tag: factor out sig detection for tag display tag: factor out sig detection for body edits verify-tag: factor out signature detection t/t7004-tag: test handling of rfc1991 signatures
2010-12-10thread-utils.h: simplify the inclusionLibravatar Junio C Hamano2-8/+0
All files that include this header file use the same four line incantation: #ifndef NO_PTHREADS #include <pthread.h> #include "thread-utils.h" #endif Move the responsibility for that gymnastics to the header file from the files that include it. This approach makes it easier to later declare new services that are related to threading in thread-utils.h and have them available to all the threading code. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09describe: Delay looking up commits until searching for an inexact matchLibravatar Anders Kaseorg1-15/+22
Now that struct commit.util is not used until after we've checked that the argument doesn't exactly match a tag, we can wait until then to look up the commits for each tag. This avoids a lot of I/O on --exact-match queries in repositories with many tags. For example, 'git describe --exact-match HEAD' becomes about 12 times faster on a cold cache (3.2s instead of 39s) in a linux-2.6 repository with 2000 packed tags. That is a huge win for the interactivity of the __git_ps1 shell prompt helper when on a detached HEAD. Signed-off-by: Anders Kaseorg <andersk@ksplice.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09describe: Store commit_names in a hash table by commit SHA1Libravatar Anders Kaseorg1-5/+33
describe is currently forced to look up the commit at each tag in order to store the struct commit_name pointers in struct commit.util. For --exact-match queries, those lookups are wasteful. In preparation for removing them, put the commit_names into a hash table, indexed by commit SHA1, that can be used to quickly check for exact matches. Signed-off-by: Anders Kaseorg <andersk@ksplice.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09describe: Do not use a flex array in struct commit_nameLibravatar Anders Kaseorg1-6/+6
Now add_to_known_names overwrites commit_names in place when multiple tags point to the same commit. This will make it easier to store commit_names in a hash table. Signed-off-by: Anders Kaseorg <andersk@ksplice.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09describe: Use for_each_rawrefLibravatar Anders Kaseorg1-1/+1
Don't waste time checking for dangling refs; they wouldn't affect the output of 'git describe' anyway. Although this does not gain much performance by itself, it does in conjunction with the next commits. Signed-off-by: Anders Kaseorg <andersk@ksplice.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09Merge branch 'jn/cherry-pick-refresh-index' into maintLibravatar Junio C Hamano1-2/+16
* jn/cherry-pick-refresh-index: cherry-pick/revert: transparently refresh index
2010-12-09Merge branch 'fc/apply-p2-get-header-name' into maintLibravatar Junio C Hamano1-14/+14
* fc/apply-p2-get-header-name: test: git-apply -p2 rename/chmod only Fix git-apply with -p greater than 1