summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2012-11-18Merge branch 'rs/branch-del-symref' into maintLibravatar Junio C Hamano1-26/+49
A symbolic ref refs/heads/SYM was not correctly removed with "git branch -d SYM"; the command removed the ref pointed by SYM instead. * rs/branch-del-symref: branch: show targets of deleted symrefs, not sha1s branch: skip commit checks when deleting symref branches branch: delete symref branch, not its target branch: factor out delete_branch_config() branch: factor out check_branch_commit()
2012-11-18Merge branch 'nd/grep-true-path' into maintLibravatar Junio C Hamano1-13/+18
"git grep -e pattern <tree>" asked the attribute system to read "<tree>:.gitattributes" file in the working tree, which was nonsense. * nd/grep-true-path: grep: stop looking at random places for .gitattributes
2012-10-18branch: show targets of deleted symrefs, not sha1sLibravatar René Scharfe1-8/+11
git branch reports the abbreviated hash of the head commit of a deleted branch to make it easier for a user to undo the operation. For symref branches this doesn't help. Print the symref target instead for them. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-18branch: skip commit checks when deleting symref branchesLibravatar René Scharfe1-2/+8
Before a branch is deleted, we check that it points to a valid commit. With -d we also check that the commit is a merged; this check is not done with -D. The reason for that is that commits pointed to by branches should never go missing; if they do then something broke and it's better to stop instead of adding to the mess. And a non-merged commit may contain changes that are worth preserving, so we require the stronger option -D instead of -d to get rid of them. If a branch consists of a symref, these concerns don't apply. Deleting such a branch can't make a commit become unreferenced, so we don't need to check if it is merged, or even if it is actually a valid commit. Skip them in that case. This allows us to delete dangling symref branches. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-18branch: delete symref branch, not its targetLibravatar René Scharfe1-1/+1
If a branch that is to be deleted happens to be a symref to another branch, the current code removes the targeted branch instead of the one it was called for. Change this surprising behaviour and delete the symref branch instead. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-18branch: factor out delete_branch_config()Libravatar René Scharfe1-5/+10
Provide a small helper function for deleting branch config sections. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-18branch: factor out check_branch_commit()Libravatar René Scharfe1-12/+21
Move the code to perform checks on the tip commit of a branch to its own function. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-12grep: stop looking at random places for .gitattributesLibravatar Nguyễn Thái Ngọc Duy1-13/+18
grep searches for .gitattributes using "name" field in struct grep_source but that field is not real on-disk path name. For example, "grep pattern rev" fills the field with "rev:path", and Git looks for .gitattributes in the (non-existent but exploitable) path "rev:path" instead of "path". This patch passes real paths down to grep_source_load_driver() when: - grep on work tree - grep on the index - grep a commit (or a tag if it points to a commit) so that these cases look up .gitattributes at proper paths. .gitattributes lookup is disabled in all other cases. Initial-work-by: Jeff King <peff@peff.net> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-09grep: move pattern-type bits support to top-level grep.[ch]Libravatar Junio C Hamano1-39/+1
Switching between -E/-G/-P/-F correctly needs a lot more than just flipping opt->regflags bit these days, and we have a nice helper function buried in builtin/grep.c for the sole use of "git grep". Extract it so that "log --grep" family can also use it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-09grep: move the configuration parsing logic to grep.[ch]Libravatar Junio C Hamano1-131/+0
The configuration handling is a library-ish part of this program, that is not specific to "git grep" command. It should be reusable by "log" and others. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-09builtin/grep.c: make configuration callback more reusableLibravatar Junio C Hamano1-25/+79
The grep_config() function takes one instance of grep_opt as its callback parameter, and populates it by running git_config(). This has three practical implications: - You have to have an instance of grep_opt already when you call the configuration, but that is not necessarily always true. You may be trying to initialize the grep_filter member of rev_info, but are not ready to call init_revisions() on it yet. - It is not easy to enhance grep_config() in such a way to make it cascade to other callback functions to grab other variables in one call of git_config(); grep_config() can be cascaded into from other callbacks, but it has to be at the leaf level of a cascade. - If you ever need to use more than one instance of grep_opt, you will have to open and read the configuration file(s) every time you initialize them. Rearrange the configuration mechanism and model it after how diff configuration variables are handled. An early call to git_config() reads and remembers the values taken from the configuration in the default "template", and a separate call to grep_init() uses this template to instantiate a grep_opt. The next step will be to move some of this out of this file so that the other user of the grep machinery (i.e. "log") can use it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-08Merge branch 'os/commit-submodule-ignore' into maintLibravatar Junio C Hamano1-0/+1
"git status" honored the ignore=dirty settings in .gitmodules but "git commit" didn't. * os/commit-submodule-ignore: commit: pay attention to submodule.$name.ignore in .gitmodules
2012-10-08Merge branch 'jk/receive-pack-unpack-error-to-pusher' into maintLibravatar Junio C Hamano1-4/+31
"git receive-pack" (the counterpart to "git push") did not give progress output while processing objects it received to the puser when run over the smart-http protocol. * jk/receive-pack-unpack-error-to-pusher: receive-pack: drop "n/a" on unpacker errors receive-pack: send pack-processing stderr over sideband receive-pack: redirect unpack-objects stdout to /dev/null
2012-10-08Merge branch 'rt/maint-clone-single' into maintLibravatar Junio C Hamano1-14/+51
A repository created with "git clone --single" had its fetch refspecs set up just like a clone without "--single", leading the subsequent "git fetch" to slurp all the other branches, defeating the whole point of specifying "only this branch". * rt/maint-clone-single: clone --single: limit the fetch refspec to fetched branch
2012-10-08Merge branch 'lt/mailinfo-handle-attachment-more-sanely' into maintLibravatar Junio C Hamano1-11/+0
A patch attached as application/octet-stream (e.g. not text/*) were mishandled, not correctly honoring Content-Transfer-Encoding (e.g. base64). * lt/mailinfo-handle-attachment-more-sanely: mailinfo: don't require "text" mime type for attachments
2012-10-02Merge branch 'lt/mailinfo-handle-attachment-more-sanely'Libravatar Junio C Hamano1-11/+0
A patch attached as application/octet-stream (e.g. not text/*) were mishandled, not correctly honoring Content-Transfer-Encoding (e.g. base64). * lt/mailinfo-handle-attachment-more-sanely: mailinfo: don't require "text" mime type for attachments
2012-10-02Merge branch 'tu/gc-auto-quiet'Libravatar Junio C Hamano1-3/+1
"gc --auto" notified the user that auto-packing has triggered even under the "--quiet" option. * tu/gc-auto-quiet: silence git gc --auto --quiet output
2012-10-01Merge branch 'os/commit-submodule-ignore'Libravatar Junio C Hamano1-0/+1
"git status" honored the ignore=dirty settings in .gitmodules but "git commit" didn't. * os/commit-submodule-ignore: commit: pay attention to submodule.$name.ignore in .gitmodules
2012-10-01Merge branch 'jk/receive-pack-unpack-error-to-pusher'Libravatar Junio C Hamano1-4/+31
Send errors from "unpack-objects" and "index-pack" back to the "git push" over the git and smart-http protocols, just like it is done for a push over the ssh protocol. * jk/receive-pack-unpack-error-to-pusher: receive-pack: drop "n/a" on unpacker errors receive-pack: send pack-processing stderr over sideband receive-pack: redirect unpack-objects stdout to /dev/null
2012-10-01Merge branch 'rt/maint-clone-single'Libravatar Junio C Hamano1-14/+51
Running "git fetch" in a repository made with "git clone --single" slurps all the branches, defeating the point of "--single". * rt/maint-clone-single: clone --single: limit the fetch refspec to fetched branch
2012-09-30mailinfo: don't require "text" mime type for attachmentsLibravatar Linus Torvalds1-11/+0
Currently "git am" does insane things if the mbox it is given contains attachments with a MIME type that aren't "text/*". In particular, it will still decode them, and pass them "one line at a time" to the mail body filter, but because it has determined that they aren't text (without actually looking at the contents, just at the mime type) the "line" will be the encoding line (eg 'base64') rather than a line of *content*. Which then will cause the text filtering to fail, because we won't correctly notice when the attachment text switches from the commit message to the actual patch. Resulting in a patch failure, even if patch may be a perfectly well-formed attachment, it's just that the message type may be (for example) "application/octet-stream" instead of "text/plain". Just remove all the bogus games with the message_type. The only difference that code creates is how the data is passed to the filter function (chunked per-pred-code line or per post-decode line), and that difference is *wrong*, since chunking things per pre-decode line can never be a sensible operation, and cannot possibly matter for binary data anyway. This code goes all the way back to March of 2007, in commit 87ab79923463 ("builtin-mailinfo.c infrastrcture changes"), and apparently Don used to pass random mbox contents to git. However, the pre-decode vs post-decode logic really shouldn't matter even for that case, and more importantly, "I fed git am crap" is not a valid reason to break *real* patch attachments. If somebody really cares, and determines that some attachment is binary data (by looking at the data, not the MIME-type), the whole attachment should be dismissed, rather than fed in random-sized chunks to "handle_filter()". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Don Zickus <dzickus@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-29Merge branch 'jc/maint-log-grep-all-match-1' into maintLibravatar Junio C Hamano1-0/+4
* jc/maint-log-grep-all-match-1: grep.c: make two symbols really file-scope static this time t7810-grep: test --all-match with multiple --grep and --author options t7810-grep: test interaction of multiple --grep and --author options t7810-grep: test multiple --author with --all-match t7810-grep: test multiple --grep with and without --all-match t7810-grep: bring log --grep tests in common form grep.c: mark private file-scope symbols as static log: document use of multiple commit limiting options log --grep/--author: honor --all-match honored for multiple --grep patterns grep: show --debug output only once grep: teach --debug option to dump the parse tree
2012-09-29Merge branch 'jc/maint-mailinfo-mime-attr' into maintLibravatar Junio C Hamano1-3/+2
* jc/maint-mailinfo-mime-attr: mailinfo: do not concatenate charset= attribute values from mime headers
2012-09-27silence git gc --auto --quiet outputLibravatar Tobias Ulmer1-3/+1
When --quiet is requested, gc --auto should not display messages unless there is an error. Signed-off-by: Tobias Ulmer <tobiasu@tmux.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-25Merge branch 'jc/maint-mailinfo-mime-attr'Libravatar Junio C Hamano1-3/+2
When "git am" is fed an input that has multiple "Content-type: ..." header, it did not grok charset= attribute correctly. * jc/maint-mailinfo-mime-attr: mailinfo: do not concatenate charset= attribute values from mime headers
2012-09-24Merge branch 'jc/maint-blame-no-such-path' into maintLibravatar Junio C Hamano1-16/+73
Even during a conflicted merge, "git blame $path" always meant to blame uncommitted changes to the "working tree" version; make it more useful by showing cleanly merged parts as coming from the other branch that is being merged. This incidentally fixes an unrelated problem on a case insensitive filesystem, where "git blame MAKEFILE" run in a history that has "Makefile" but not "MAKEFILE" did not say "No such file MAKEFILE in HEAD" but pretended as if "MAKEFILE" was a newly added file. * jc/maint-blame-no-such-path: blame: allow "blame file" in the middle of a conflicted merge blame $path: avoid getting fooled by case insensitive filesystems
2012-09-24Merge branch 'dj/fetch-all-tags' into maintLibravatar Junio C Hamano1-22/+29
"git fetch --all", when passed "--no-tags", did not honor the "--no-tags" option while fetching from individual remotes (the same issue existed with "--tags", but combination "--all --tags" makes much less sense than "--all --no-tags"). * dj/fetch-all-tags: fetch --all: pass --tags/--no-tags through to each remote submodule: use argv_array instead of hand-building arrays fetch: use argv_array instead of hand-building arrays argv-array: fix bogus cast when freeing array argv-array: add pop function
2012-09-24commit: pay attention to submodule.$name.ignore in .gitmodulesLibravatar Orgad Shaneh1-0/+1
"git status" does not list a submodule with uncommitted working tree files as modified when "submodule.$name.ignore" is set to "dirty" in in-tree ".gitmodules" file. Both status and commit honor the setting in $GIT_DIR/config, but "commit" does not pick it up from .gitmodules, which is inconsistent. Teach "git commit" to pay attention to the setting in .gitmodules as well. Signed-off-by: Orgad Shaneh <orgads@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-21receive-pack: drop "n/a" on unpacker errorsLibravatar Jeff King1-1/+1
The output from git push currently looks like this: $ git push dest HEAD fatal: [some message from index-pack] error: unpack failed: index-pack abnormal exit To dest ! [remote rejected] HEAD -> master (n/a (unpacker error)) That n/a is meant to be "the per-ref status is not available" but the nested parentheses just make it look ugly. Let's turn the final line into just: ! [remote rejected] HEAD -> master (unpacker error) Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-21receive-pack: send pack-processing stderr over sidebandLibravatar Jeff King1-2/+24
Receive-pack invokes either unpack-objects or index-pack to handle the incoming pack. However, we do not redirect the stderr of the sub-processes at all, so it is never seen by the client. From the initial thread adding sideband support, which is here: http://thread.gmane.org/gmane.comp.version-control.git/139471 it is clear that some messages are specifically kept off the sideband (with the assumption that they are of interest only to an administrator, not the client). The stderr of the subprocesses is mentioned in the thread, but it's unclear if they are included in that group, or were simply forgotten. However, there are a few good reasons to show them to the client: 1. In many cases, they are directly about the incoming packfile (e.g., fsck warnings with --strict, corruption in the packfile, etc). Without these messages, the client just gets "unpacker error" with no extra useful diagnosis. 2. No matter what the cause, we are probably better off showing the errors to the client. If the client and the server admin are not the same entity, it is probably much easier for the client to cut-and-paste the errors they see than for the admin to try to dig them out of a log and correlate them with a particular session. 3. Users of the ssh transport typically already see these stderr messages, as the remote's stderr is copied literally by ssh. This brings other transports (http, and push-over-git if you are crazy enough to enable it) more in line with ssh. As a bonus for ssh users, because the messages are now fed through the sideband and printed by the local git, they will have "remote:" prepended and be properly interleaved with any local output to stderr. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-21receive-pack: redirect unpack-objects stdout to /dev/nullLibravatar Jeff King1-1/+6
The unpack-objects command should not generally produce any output on stdout. However, if it's given extra input after the packfile, it will spew the remainder to stdout. When called by receive-pack, this means we will break protocol, since our stdout is connected to the remote send-pack. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-20Merge branch 'jc/mailinfo-RE' into maintLibravatar Junio C Hamano1-1/+3
* jc/mailinfo-RE: mailinfo: strip "RE: " prefix
2012-09-20Merge branch 'sn/ls-remote-get-url-doc' into maintLibravatar Junio C Hamano1-1/+1
* sn/ls-remote-get-url-doc: ls-remote: document the '--get-url' option
2012-09-20Merge branch 'nd/maint-remote-remove' into maintLibravatar Junio C Hamano1-3/+3
* nd/maint-remote-remove: remote: prefer subcommand name 'remove' to 'rm'
2012-09-20clone --single: limit the fetch refspec to fetched branchLibravatar Ralf Thielow1-14/+51
After running "git clone --single", the resulting repository has the usual default "+refs/heads/*:refs/remotes/origin/*" wildcard fetch refspec installed, which means that a subsequent "git fetch" will end up grabbing all the other branches. Update the fetch refspec to cover only the singly cloned ref instead to correct this. That means: If "--single" is used without "--branch" or "--mirror", the fetch refspec covers the branch on which remote's HEAD points to. If "--single" is used with "--branch", it'll cover only the branch specified in the "--branch" option. If "--single" is combined with "--mirror", then it'll cover all refs of the cloned repository. If "--single" is used with "--branch" that specifies a tag, then it'll cover only the ref for this tag. Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-18Merge branch 'jc/maint-log-grep-all-match'Libravatar Junio C Hamano1-0/+4
Fix a long-standing bug in "git log --grep" when multiple "--grep" are used together with "--all-match" and "--author" or "--committer". * jc/maint-log-grep-all-match: t7810-grep: test --all-match with multiple --grep and --author options t7810-grep: test interaction of multiple --grep and --author options t7810-grep: test multiple --author with --all-match t7810-grep: test multiple --grep with and without --all-match t7810-grep: bring log --grep tests in common form grep.c: mark private file-scope symbols as static log: document use of multiple commit limiting options log --grep/--author: honor --all-match honored for multiple --grep patterns grep: show --debug output only once grep: teach --debug option to dump the parse tree
2012-09-18Merge branch 'jc/make-static'Libravatar Junio C Hamano1-2/+5
Turn many file-scope private symbols to static to reduce the global namespace contamination. * jc/make-static: sequencer.c: mark a private file-scope symbol as static ident.c: mark private file-scope symbols as static trace.c: mark a private file-scope symbol as static wt-status.c: mark a private file-scope symbol as static read-cache.c: mark a private file-scope symbol as static strbuf.c: mark a private file-scope symbol as static sha1-array.c: mark a private file-scope symbol as static symlinks.c: mark private file-scope symbols as static notes.c: mark a private file-scope symbol as static rerere.c: mark private file-scope symbols as static graph.c: mark private file-scope symbols as static diff.c: mark a private file-scope symbol as static commit.c: mark a file-scope private symbol as static builtin/notes.c: mark file-scope private symbols as static
2012-09-18Merge branch 'mv/cherry-pick-s'Libravatar Junio C Hamano1-57/+24
After "git cherry-pick -s" gave control back to the user asking help to resolve conflicts, concluding "git commit" needs to be run with "-s" if the user wants to sign it off, but the command should be able to remember that. * mv/cherry-pick-s: cherry-pick: don't forget -s on failure
2012-09-18Merge branch 'nd/fetch-status-alignment'Libravatar Junio C Hamano1-8/+7
The status report from "git fetch", when messages like 'up-to-date' are translated, did not align the branch names well. * nd/fetch-status-alignment: fetch: align per-ref summary report in UTF-8 locales
2012-09-18Merge branch 'jk/config-warn-on-inaccessible-paths' into maintLibravatar Junio C Hamano1-2/+2
The attribute system may be asked for a path that itself or its leading directories no longer exists in the working tree, and it is fine if we cannot open .gitattribute file in such a case. Failure to open per-directory .gitattributes with error status other than ENOENT and ENOTDIR should be diagnosed. * jk/config-warn-on-inaccessible-paths: attr: failure to open a .gitattributes file is OK with ENOTDIR warn_on_inaccessible(): a helper to warn on inaccessible paths attr: warn on inaccessible attribute files gitignore: report access errors of exclude files config: warn on inaccessible files
2012-09-17Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: t/perf: add "trash directory" to .gitignore Add missing -z to git check-attr usage text for consistency with man page git-jump: ignore (custom) prefix in diff mode Documentation: indent-with-non-tab uses "equivalent tabs" not 8 completion: add --no-edit to git-commit
2012-09-17Merge branch 'mh/fetch-filter-refs'Libravatar Junio C Hamano1-105/+64
Code simplification and clarification. * mh/fetch-filter-refs: test-string-list.c: Fix some sparse warnings fetch-pack: eliminate spurious error messages cmd_fetch_pack(): simplify computation of return value fetch-pack: report missing refs even if no existing refs were received cmd_fetch_pack(): return early if finish_connect() fails filter_refs(): simplify logic filter_refs(): build refs list as we go filter_refs(): delete matched refs from sought list fetch_pack(): update sought->nr to reflect number of unique entries filter_refs(): do not check the same sought_pos twice Change fetch_pack() and friends to take string_list arguments fetch_pack(): reindent function decl and defn Rename static function fetch_pack() to http_fetch_pack() t5500: add tests of fetch-pack --all --depth=N $URL $REF t5500: add tests of error output for missing refs
2012-09-17Merge branch 'jc/maint-blame-no-such-path'Libravatar Junio C Hamano1-16/+73
"git blame MAKEFILE" run in a history that has "Makefile" but not "MAKEFILE" should say "No such file MAKEFILE in HEAD", but got confused on a case insensitive filesystem and failed to do so. Even during a conflicted merge, "git blame $path" always meant to blame uncommitted changes to the "working tree" version; make it more useful by showing cleanly merged parts as coming from the other branch that is being merged. * jc/maint-blame-no-such-path: blame: allow "blame file" in the middle of a conflicted merge blame $path: avoid getting fooled by case insensitive filesystems
2012-09-17mailinfo: do not concatenate charset= attribute values from mime headersLibravatar Junio C Hamano1-3/+2
"Content-type: text/plain; charset=UTF-8" header should not appear twice in the input, but it is always better to gracefully deal with such a case. The current code concatenates the value to the values we have seen previously, producing nonsense such as "utf8UTF-8". Instead of concatenating, forget the previous value and use the last value we see. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17Add missing -z to git check-attr usage text for consistency with man pageLibravatar Adam Spiers1-1/+1
Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-15builtin/notes.c: mark file-scope private symbols as staticLibravatar Junio C Hamano1-2/+5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-14Merge branch 'jc/mailinfo-RE'Libravatar Junio C Hamano1-1/+3
We strip the prefix from "Re: subject" and also from a less common "re: subject", but left even less common "RE: subject" intact. * jc/mailinfo-RE: mailinfo: strip "RE: " prefix
2012-09-14Merge branch 'mz/cherry-pick-cmdline-order' into maintLibravatar Junio C Hamano2-2/+2
* mz/cherry-pick-cmdline-order: cherry-pick/revert: respect order of revisions to pick demonstrate broken 'git cherry-pick three one two' teach log --no-walk=unsorted, which avoids sorting
2012-09-14Sync with 1.7.11.7Libravatar Junio C Hamano2-2/+17
2012-09-14Merge branch 'jk/maint-quiet-is-synonym-to-s-in-log' into maint-1.7.11Libravatar Junio C Hamano1-1/+1
* jk/maint-quiet-is-synonym-to-s-in-log: log: fix --quiet synonym for -s