aboutsummaryrefslogtreecommitdiff
path: root/wt-status.c
Commit message (Collapse)AuthorAge
...
* | status: only touch path we may need to checkNguyễn Thái Ngọc Duy2010-01-15
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch gets rid of whole-tree cache refresh and untracked file search. Instead only specified path will be looked at. Again some numbers on gentoo-x86, ~80k files: Unmodified Git: $ time git st eclass/ nothing to commit (working directory clean) real 0m3.211s user 0m1.977s sys 0m1.135s Modified Git: $ time ~/w/git/git st eclass/ nothing to commit (working directory clean) real 0m1.587s user 0m1.426s sys 0m0.111s Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jk/1.7.0-status'Junio C Hamano2009-12-27
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jk/1.7.0-status: status/commit: do not suggest "reset HEAD <path>" while merging commit/status: "git add <path>" is not necessarily how to resolve commit/status: check $GIT_DIR/MERGE_HEAD only once t7508-status: test all modes with color t7508-status: status --porcelain ignores relative paths setting status: reduce duplicated setup code status: disable color for porcelain format status -s: obey color.status builtin-commit: refactor short-status code into wt-status.c t7508-status.sh: Add tests for status -s status -s: respect the status.relativePaths option docs: note that status configuration affects only long format commit: support alternate status formats status: add --porcelain output format status: refactor format option parsing status: refactor short-mode printing to its own function status: typo fix in usage git status: not "commit --dry-run" anymore git stat -s: short status output git stat: the beginning of "status that is not a dry-run of commit" Conflicts: t/t4034-diff-words.sh wt-status.c
| * status/commit: do not suggest "reset HEAD <path>" while mergingJunio C Hamano2009-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggesting "'reset HEAD <path>' to unstage" is dead wrong if we are about to record a merge commit. For either an unmerged path (i.e. with unresolved conflicts), or an updated path, it would result in discarding what the other branch did. Note that we do not do anything special in a case where we are amending a merge. The user is making an evil merge starting from an already committed merge, and running "reset HEAD <path>" is the right way to get rid of the local edit that has been added to the index. Once "reset --unresolve <path>" becomes available, we might want to suggest it for a merged path that has unresolve information, but until then, just remove the incorrect advice. We might also want to suggest "checkout --conflict <path>" to revert the file in the work tree to the state of failed automerge for an unmerged path, but we never did that, and this commit does not change that. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * commit/status: "git add <path>" is not necessarily how to resolveJunio C Hamano2009-12-12
| | | | | | | | | | | | | | | | When the desired resolution is to remove the path, "git rm <path>" is the command the user needs to use. Just like in "Changed but not updated" section, suggest to use "git add/rm" as appropriate. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * status: reduce duplicated setup codeJeff King2009-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have three output formats: short, porcelain, and long. The short and long formats respect user-config, and the porcelain one does not. This led to us repeating config-related setup code for the short and long formats. Since the last commit, color config is explicitly cleared when showing the porcelain format. Let's do the same with relative-path configuration, which enables us to hoist the duplicated code from the switch statement in cmd_status. As a bonus, this fixes "commit --dry-run --porcelain", which was unconditionally setting up that configuration, anyway. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * status: disable color for porcelain formatJeff King2009-12-07
| | | | | | | | | | | | | | | | | | The porcelain format is identical to the shortstatus format, except that it should not respect any user configuration, including color. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * status -s: obey color.statusMichael J Gruber2009-12-05
| | | | | | | | | | | | | | | | | | | | Make the short version of status obey the color.status boolean. We color the status letters only, because they carry the state information and are potentially colored differently, such as for a file with staged changes as well as changes in the worktree against the index. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * builtin-commit: refactor short-status code into wt-status.cMichael J Gruber2009-12-05
| | | | | | | | | | | | | | | | | | | | | | | | Currently, builtin-commit.c contains most code producing the short-status output, whereas wt-status.c contains most of the code for the long format. Refactor so that most of the long and short format producing code resides in wt-status.c and is named analogously. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git stat: the beginning of "status that is not a dry-run of commit"Junio C Hamano2009-08-22
| | | | | | | | | | | | | | | | | | | | | | Tentatively add "git stat" as a new command. This is not "preview of commit with the same arguments"; the path parameters are not paths to be added to the pristine index (aka "--only" option), but are taken as pathspecs to limit the output. Later in 1.7.0 release, it will take over "git status". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | status: make "how to stage" messages optionalJeff King2009-09-11
| | | | | | | | | | | | | | | | | | These messages are nice for new users, but experienced git users know how to manipulate the index, and these messages waste a lot of screen real estate. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | status: list unmerged files much laterJohannes Sixt2009-09-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When resolving a conflicted merge, two lists in the status output need more attention from the user than other parts. - the list of updated paths is useful to review the amount of changes the merge brings in (the user cannot do much about them other than reviewing, though); and - the list of unmerged paths needs the most attention from the user; the user needs to resolve them in order to proceed. Since the output of git status does not by default go through the pager, the early parts of the output can scroll away at the top. It is better to put the more important information near the bottom. During a merge, local changes that are not in the index are minimum, and you should keep the untracked list small in any case, so moving the unmerged list from the top of the output to immediately after the list of updated paths would give us the optimum layout. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Style fixes, add a space after if/for/while.Brian Gianforcaro2009-08-31
|/ | | | | | | | | The majority of code in core git appears to use a single space after if/for/while. This is an attempt to bring more code to this standard. These are entirely cosmetic changes. Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* wt-status: collect untracked files in a separate "collect" phaseJunio C Hamano2009-08-10
| | | | | | In a way similar to updated and locally modified files are collected. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make git_status_config() file scope static to builtin-commit.cJunio C Hamano2009-08-10
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* wt-status: move wt_status_colors[] into wt_status structureJunio C Hamano2009-08-10
| | | | | | | | The benefit of this one alone is somewhat iffy, but for completeness this moves the wt_status_colors[] color palette to the wt_status structure to complete the libification started by the previous commit. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* wt-status: move many global settings to wt_status structureJunio C Hamano2009-08-10
| | | | | | | | | | | Turn four global variables (wt_status_use_color, show_tracked_files, wt_status_relative_paths, and wt_status_submodule_summary) into fields of wt_status structure. They can also lose "wt_status_" prefix. Get rid of "untracked" field that was used only to keep track of otherwise available information redundantly. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* status: show worktree status of conflicted paths separatelyJunio C Hamano2009-08-06
| | | | | | | | | | | | | | | | | | | | When a path is unmerged in the index, we used to always say "unmerged" in the "Changed but not updated" section, even when the path was deleted in the work tree. Remove unmerged entries from the "Updated" section, and create a new section "Unmerged paths". Describe how the different stages conflict in more detail in this new section. Note that with the current 3-way merge policy (with or without recursive), certain combinations of index stages should never happen. For example, having only stage #2 means that a path that did not exist in the common ancestor was added by us while the other branch did not do anything to it, which would have autoresolved to take our addition. The code nevertheless prepares for the possibility that future merge policies may leave a path in such a state. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* wt-status.c: rework the way changes to the index and work tree are summarizedJunio C Hamano2009-08-06
| | | | | | | | | | | Introduce a new infrastructure to find and summarize changes in a single string list, and rewrite wt_status_print_{updated,changed} functions using it. The goal of this change is to give more information on conflicted paths in the status output. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add 'fill_directory()' helper function for directory traversalLinus Torvalds2009-07-09
| | | | | | | | | | | | | | | | | | | | | | Most of the users of "read_directory()" actually want a much simpler interface than the whole complex (but rather powerful) one. In fact 'git add' had already largely abstracted out the core interface issues into a private "fill_directory()" function that was largely applicable almost as-is to a number of callers. Yes, 'git add' wants to do some extra work of its own, specific to the add semantics, but we can easily split that out, and use the core as a generic function. This function does exactly that, and now that much simplified 'fill_directory()' function can be shared with a number of callers, while also ensuring that the rather more complex calling conventions of read_directory() are used by fewer call-sites. This also makes the 'common_prefix()' helper function private to dir.c, since all callers are now in that file. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix various sparse warnings in the git source codeLinus Torvalds2009-06-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few remaining ones, but this fixes the trivial ones. It boils down to two main issues that sparse complains about: - warning: Using plain integer as NULL pointer Sparse doesn't like you using '0' instead of 'NULL'. For various good reasons, not the least of which is just the visual confusion. A NULL pointer is not an integer, and that whole "0 works as NULL" is a historical accident and not very pretty. A few of these remain: zlib is a total mess, and Z_NULL is just a 0. I didn't touch those. - warning: symbol 'xyz' was not declared. Should it be static? Sparse wants to see declarations for any functions you export. A lack of a declaration tends to mean that you should either add one, or you should mark the function 'static' to show that it's in file scope. A few of these remain: I only did the ones that should obviously just be made static. That 'wt_status_submodule_summary' one is debatable. It has a few related flags (like 'wt_status_use_color') which _are_ declared, and are used by builtin-commit.c. So maybe we'd like to export it at some point, but it's not declared now, and not used outside of that file, so 'static' it is in this patch. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix a bunch of pointer declarations (codestyle)Felipe Contreras2009-05-01
| | | | | | | Essentially; s/type* /type */ as per the coding guidelines. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'mv/parseopt-ls-files'Junio C Hamano2009-03-20
|\ | | | | | | | | | | | | | | | | | | | | | | * mv/parseopt-ls-files: ls-files: fix broken --no-empty-directory t3000: use test_cmp instead of diff parse-opt: migrate builtin-ls-files. Turn the flags in struct dir_struct into a single variable Conflicts: builtin-ls-files.c t/t3000-ls-files-others.sh
| * Turn the flags in struct dir_struct into a single variableJohannes Schindelin2009-02-18
| | | | | | | | | | | | | | | | By having flags represented as bits in the new member variable 'flags', it will be easier to use parse_options when dir_struct is involved. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Clean up use of ANSI color sequencesArjen Laarhoven2009-02-13
|/ | | | | | | | Remove the literal ANSI escape sequences and replace them by readable constants. Signed-off-by: Arjen Laarhoven <arjen@yaph.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* reorder ALLOW_TEXTCONV option settingJeff King2008-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | Right now for the diff porcelain and the log family, we call: init_revisions(); setup_revisions(); DIFF_OPT_SET(ALLOW_TEXTCONV); However, that means textconv will _always_ be on, instead of being a default that can be manipulated with setup_revisions. Instead, we want: init_revisions(); DIFF_OPT_SET(ALLOW_TEXTCONV); setup_revisions(); which is what this patch does. We'll go ahead and move the callsite in wt-status, also; even though the user can't pass any options here, it is a cleanup that will help avoid any surprise later if the setup_revisions line is changed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jk/commit-v-strip'Junio C Hamano2008-11-16
|\ | | | | | | | | | | | | * jk/commit-v-strip: status: show "-v" diff even for initial commit wt-status: refactor initial commit printing define empty tree sha1 as a macro
| * status: show "-v" diff even for initial commitJeff King2008-11-12
| | | | | | | | | | | | | | | | | | Since we can use the same "diff against empty tree" trick as we do for the non-initial case, it is trivial to make this work. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * wt-status: refactor initial commit printingJeff King2008-11-12
| | | | | | | | | | | | | | | | | | | | When we showed the initial commit, we had no reference to diff against, so we went through the cache manually. Nowadays, however, we have a virtual empty tree commit, so we can simply diff against that to get the same results. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | enable textconv for diff in verbose status/commitJeff King2008-10-26
| | | | | | | | | | | | | | | | | | This diff is meant for human consumption, so it makes sense to apply text conversion here, as we would for the regular diff porcelain. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | wt-status: load diff ui configJeff King2008-10-26
|/ | | | | | | | | | | | | | | | When "git status -v" shows a diff, we did not respect the user's usual diff preferences at all. Loading just git_diff_basic_config would give us things like rename limits and diff drivers. But it makes even more sense to load git_diff_ui_config, which gives us colorization if the user has requested it. Note that we need to take special care to cancel colorization when writing to the commit template file, as described in the code comments. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jk/maint-ls-files-other' into jk/fix-ls-files-otherJunio C Hamano2008-10-17
|\ | | | | | | | | | | | | | | * jk/maint-ls-files-other: refactor handling of "other" files in ls-files and status Conflicts: read-cache.c
| * refactor handling of "other" files in ls-files and statusJeff King2008-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the "git status" display code was originally converted to C, we copied the code from ls-files to discover whether a pathname returned by read_directory was an "other", or untracked, file. Much later, 5698454e updated the code in ls-files to handle some new cases caused by gitlinks. This left the code in wt-status.c broken: it would display submodule directories as untracked directories. Nobody noticed until now, however, because unless status.showUntrackedFiles was set to "all", submodule directories were not actually reported by read_directory. So the bug was only triggered in the presence of a submodule _and_ this config option. This patch pulls the ls-files code into a new function, cache_name_is_other, and uses it in both places. This should leave the ls-files functionality the same and fix the bug in status. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerBrandon Casey2008-10-12
| | | | | | | | | | | | | | | | | | | | | | Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | wt-status: Teach how to discard changes in the working directoryAnders Melchiorsen2008-09-07
| | | | | | | | | | | | This is a question that comes up a lot in #git. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | wt-status: Split header generation into three functionsAnders Melchiorsen2008-09-07
|/ | | | | | | | | | Reorganize header generation so that all header text related to each block is in one place. This adds a function, but makes it easier to see what is generated in each case. It also allows for easy tweaking of individual headers. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jc/report-tracking'Junio C Hamano2008-07-13
|\ | | | | | | | | | | | | | | | | * jc/report-tracking: branch -r -v: do not spit out garbage stat_tracking_info(): clear object flags used during counting git-branch -v: show the remote tracking statistics git-status: show the remote tracking statistics Refactor "tracking statistics" code used by "git checkout"
| * git-status: show the remote tracking statisticsJunio C Hamano2008-07-02
| | | | | | | | | | | | | | | | | | | | This teaches "git status" to show the same remote tracking statistics "git checkout" gives at the beginning of the output. Now the necessary low-level machinery is properly factored out, we can do this quite cleanly. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Fix "config_error_nonbool" used with value instead of keyChristian Couder2008-07-05
|/ | | | | | | | | | | | | | | | The function "config_error_nonbool", that is defined in "config.c", is used to report an error when a config key in the config file should have a corresponding value but it hasn't. So the parameter to this function should be the key and not the value, because the value is undefined. And it could crash if the value is used. This patches fixes two occurences where the value was passed instead of the key. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add configuration option for default untracked files modeMarius Storm-Olsen2008-06-09
| | | | | | By default, the untracked files mode for commit/status is 'normal' Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
* Add argument 'no' commit/status option -u|--untracked-filesMarius Storm-Olsen2008-06-09
| | | | | | | This new argument teaches Git to not look for any untracked files, saving cycles on slow file systems, or large repos. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
* Add an optional <mode> argument to commit/status -u|--untracked-files optionMarius Storm-Olsen2008-06-09
| | | | | | | | | | | | This lets you specify how you want untracked files to be listed. The possible options are: normal - Show untracked files and directories all - Show all untracked files The 'all' mode is used, if the mode is not specified. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
* Merge branch 'js/config-cb'v1.5.6-rc0Junio C Hamano2008-05-25
|\ | | | | | | | | | | | | | | | | | | * js/config-cb: Provide git_config with a callback-data parameter Conflicts: builtin-add.c builtin-cat-file.c
| * Provide git_config with a callback-data parameterJohannes Schindelin2008-05-14
| | | | | | | | | | | | | | | | | | | | | | | | git_config() only had a function parameter, but no callback data parameter. This assumes that all callback functions only modify global variables. With this patch, every callback gets a void * parameter, and it is hoped that this will help the libification effort. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Updated status to show 'Not currently on any branch' in redChris Parsons2008-05-22
| | | | | | | | | | | | | | | | | | This provides additional warning to users when attempting to commit to a detached HEAD. It is configurable in color.status.nobranch. Signed-off-by: Chris Parsons <chris@edendevelopment.co.uk> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | bump rename limit defaultsJeff King2008-05-03
|/ | | | | | | | | | | | | | | | | The current rename limit default of 100 was arbitrarily chosen. Testing[1] has shown that on modern hardware, a limit of 200 adds about a second of computation time, and a limit of 500 adds about 5 seconds of computation time. This patch bumps the default limit to 200 for viewing diffs, and to 500 for performing a merge. The limit for generating git-status templates is set independently; we bump it up to 200 here, as well, to match the diff limit. [1]: See <20080211113516.GB6344@coredump.intra.peff.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-status: submodule summary supportPing Yin2008-04-12
| | | | | | | | | | | | | | | | | | | | | | This commit teaches 'git commit/status' show a new 'Modified submodules' section, which is an output from: git submodule summary --cached --for-status --summary-limit <limit> just before the 'Untracked files' section. The <limit> is given by the config variable status.submodulesummary to limit the submodule summary size. status.submodulesummary is a bool/int variable with value: - false or 0 by default to disable the summary, or - positive number to limit the summary size, or - true or negative number to unlimit the summary size. Also mention status.submodulesummary in the documentation. Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* wt-status.c: no need for dup() dance anymoreKristian Høgsberg2008-03-14
| | | | | | | Now we can generate diff to a file descriptor, we do not have to dup() the stdout around when writing the status output. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make private quote_path() in wt-status.c available as quote_path_relative()Dmitry Potapov2008-03-07
| | | | | | | | | | | | Move quote_path() from wt-status.c to quote.c and rename it as quote_path_relative(), because it is a better name for a public function. Also, instead of handcrafted quoting, quote_c_style_counted() is now used, to make its quoting more consistent with the rest of the system, also honoring core.quotepath specified in configuration. Signed-off-by: Dmitry Potapov <dpotapov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add color.ui variable which globally enables colorization if setMatthias Kestenholz2008-02-18
| | | | | Signed-off-by: Matthias Kestenholz <mk@spinlock.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint'Junio C Hamano2008-02-13
|\ | | | | | | | | | | | | | | | | | | | | | | | | * maint: config: add test cases for empty value and no value config variables. cvsimport: have default merge regex also match beginning of commit message git clone -s documentation: force a new paragraph for the NOTE status: suggest "git rm --cached" to unstage for initial commit Protect get_author_ident_from_commit() from filenames in work tree upload-pack: Initialize the exec-path. bisect: use verbatim commit subject in the bisect log git-cvsimport.txt: fix '-M' description. Revert "pack-objects: only throw away data during memory pressure"