Commit Graph

22 Commits

Author SHA1 Message Date
Junio C Hamano
7637868362 wt-status: collect untracked files in a separate "collect" phase
In a way similar to updated and locally modified files are collected.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-10 12:56:43 -07:00
Junio C Hamano
f766b36783 Make git_status_config() file scope static to builtin-commit.c
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-10 12:56:36 -07:00
Junio C Hamano
23900a9646 wt-status: move wt_status_colors[] into wt_status structure
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>
2009-08-10 12:54:07 -07:00
Junio C Hamano
d249b09889 wt-status: move many global settings to wt_status structure
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>
2009-08-10 12:50:30 -07:00
Junio C Hamano
4d4d5726ae status: show worktree status of conflicted paths separately
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>
2009-08-06 21:16:01 -07:00
Junio C Hamano
50b7e70f33 wt-status.c: rework the way changes to the index and work tree are summarized
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>
2009-08-06 08:36:53 -07:00
Marius Storm-Olsen
6c2ce048bb Add argument 'no' commit/status option -u|--untracked-files
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>
2008-06-09 15:48:19 -07:00
Marius Storm-Olsen
4bfee30a98 Add an optional <mode> argument to commit/status -u|--untracked-files option
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>
2008-06-09 15:47:36 -07:00
Junio C Hamano
9bd81e4249 Merge branch 'js/config-cb'
* js/config-cb:
  Provide git_config with a callback-data parameter

Conflicts:

	builtin-add.c
	builtin-cat-file.c
2008-05-25 14:25:02 -07:00
Chris Parsons
950ce2e22d Updated status to show 'Not currently on any branch' in red
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>
2008-05-22 23:51:22 -07:00
Johannes Schindelin
ef90d6d420 Provide git_config with a callback-data parameter
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>
2008-05-14 12:34:44 -07:00
Johannes Sixt
32efcd91c6 wt-status.h: declare global variables as extern
There are linkers out there that complain if a global non-static variable
is defined multiple times.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 10:04:46 -07:00
Junio C Hamano
37d07f8f98 git-commit: squelch needless message during an empty merge
When recording a merge that conflicted and ends up in no changes after
manual resolution, commit callchain looked like this:

	cmd_commit() ->
            prepare_log_message() ->
                run_status() ->
		    wt_status_print()

This invocation of run_status() is asked to find out if there is a
committable change, but it unconditionally gave instructions such as
"use git-add" at the same time.  When in merge, we do allow an empty
change to be recorded, so after showing this message the code still went
ahead and made a commit.

This introduces "nowarn" parameter to run_status() to avoid these
useless messages.  If we are not allowed to create an empty commit, we
already call run_status() again in the original codepath, and the
message will be shown from that call anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-12 20:50:33 -08:00
Jeff King
46f721c8fe add status.relativePaths config variable
The output of git-status was recently changed to output relative
paths. Setting this variable to false restores the old behavior for
any old-timers that prefer it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:33:24 -08:00
Junio C Hamano
bc5d248a9f builtin-commit: do not color status output shown in the message template
Noticed by Ping Yin on the list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:04 -08:00
Johannes Schindelin
367c98866c git status: show relative paths when run in a subdirectory
To show the relative paths, the function formerly called quote_crlf()
(now called quote_path()) takes the prefix as an additional argument.

While at it, the static buffers were replaced by strbufs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Kristian Høgsberg
0f729f2134 Enable wt-status to run against non-standard index file.
We still default to get_index_file(), but this can be overridden
by setting wt_status.index_file after calling wt_status_prepare().

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-19 12:52:19 -07:00
Kristian Høgsberg
f26a001226 Enable wt-status output to a given FILE pointer.
Still defaults to stdout, but you can now override wt_status.fp after
calling wt_status_prepare().

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-19 12:52:19 -07:00
Jürgen Rühle
2a3a3c247e Provide better feedback for the untracked only case in status output
Since 98bf8a47c2 status would claim that
git-commit could be useful even if there are no changes except untracked files.

Since wt-status is already computing all the information needed go the whole
way and actually track the (non-)emptiness of all three sections separately,
unify the code, and provide useful messages for each individual case.

Thanks to Junio and Michael Loeffler for suggestions.

Signed-off-by: Jürgen Rühle <j-r@online.de>
2007-01-10 14:29:21 -08:00
Jürgen Rühle
6e458bf63f Improve "nothing to commit" part of status output
Previously git-status in a clean working directory would advice the user to use
git add. This isn't very helpful when there is nothing to add in the working
directory, therefore note a clean working directory while displaying the other
sections and print the appropriate message for each case.

Signed-off-by: Jürgen Rühle <j-r@online.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-02 23:43:21 -08:00
Johannes Schindelin
2074cb0af3 Teach runstatus about --untracked
Actually, teach runstatus what to do if it is not passed; it should not list
the contents of completely untracked directories, but only the name of that
directory (plus a trailing '/').

[jc: with comments by Jeff King to match hide-empty-directories
 behaviour of the original.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 23:20:17 -07:00
Jeff King
c91f0d92ef git-commit.sh: convert run_status to a C builtin
This creates a new git-runstatus which should do roughly the same thing
as the run_status function from git-commit.sh. Except for color support,
the main focus has been to keep the output identical, so that it can be
verified as correct and then used as a C platform for other improvements to
the status printing code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-08 16:46:35 -07:00