From: Junio C Hamano Date: Mon, 28 Dec 2009 07:01:32 +0000 (-0800) Subject: Merge branch 'jk/1.7.0-status' X-Git-Tag: v1.7.0-rc0~137 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c2ff10c98e22ae64d553273e6d67bb123a1c916f;p=git.git Merge branch 'jk/1.7.0-status' * jk/1.7.0-status: status/commit: do not suggest "reset HEAD " while merging commit/status: "git add " 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 --- c2ff10c98e22ae64d553273e6d67bb123a1c916f diff --cc Documentation/git-commit.txt index d227cec9b,c45fbe4f9..c97c151ae --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@@ -69,11 -69,26 +69,25 @@@ OPTION Like '-C', but with '-c' the editor is invoked, so that the user can further edit the commit message. ---dry-run:: - Do not actually make a commit, but show the list of paths - with updates in the index, paths with changes in the work tree, - and paths that are untracked, similar to the one that is given - in the commit log editor. +--reset-author:: + When used with -C/-c/--amend options, declare that the + authorship of the resulting commit now belongs of the committer. + This also renews the author timestamp. + --short:: + When doing a dry-run, give the output in the short-format. See + linkgit:git-status[1] for details. Implies `--dry-run`. + + --porcelain:: + When doing a dry-run, give the output in a porcelain-ready + format. See linkgit:git-status[1] for details. Implies + `--dry-run`. + + -z:: + When showing `short` or `porcelain` status output, terminate + entries in the status output with NUL, instead of LF. If no + format is given, implies the `--porcelain` output format. + -F :: --file=:: Take the commit message from the given file. Use '-' to diff --cc t/t4034-diff-words.sh index 1c21276c5,17621dd5a..2e2e103b3 --- a/t/t4034-diff-words.sh +++ b/t/t4034-diff-words.sh @@@ -49,9 -38,9 +39,9 @@@ cat > expect <<\EO index 330b04f..5ed8eff 100644 --- a/pre +++ b/post - @@ -1,3 +1,7 @@ + @@ -1,3 +1,7 @@ h(4)h(4),hh[44] - + a = b + c aa = a @@@ -65,34 -54,14 +55,34 @@@ test_expect_success 'word diff with run ' +cat > expect <<\EOF +diff --git a/pre b/post +index 330b04f..5ed8eff 100644 +--- a/pre ++++ b/post - @@ -1 +1 @@ ++@@ -1 +1 @@ +h(4)h(4),hh[44] - @@ -3,0 +4,4 @@ a = b + c ++@@ -3,0 +4,4 @@ a = b + c + +aa = a + +aeff = aeff * ( aaa ) +EOF + +test_expect_success 'word diff without context' ' + + word_diff --color-words --unified=0 + +' + cat > expect <<\EOF diff --git a/pre b/post index 330b04f..5ed8eff 100644 --- a/pre +++ b/post - @@ -1,3 +1,7 @@ + @@ -1,3 +1,7 @@ h(4),hh[44] - + a = b + c aa = a @@@ -126,9 -95,9 +116,9 @@@ cat > expect <<\EO index 330b04f..5ed8eff 100644 --- a/pre +++ b/post - @@ -1,3 +1,7 @@ + @@ -1,3 +1,7 @@ h(4),hh[44] - + a = b + c aa = a @@@ -168,9 -137,9 +158,9 @@@ cat > expect <<\EO index 330b04f..5ed8eff 100644 --- a/pre +++ b/post - @@ -1,3 +1,7 @@ + @@ -1,3 +1,7 @@ h(4),hh[44] - + a = b + c aa = a diff --cc t/test-lib.sh index 2d523fe0f,d63ad2d87..142f36f2e --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -207,10 -204,21 +207,21 @@@ trap 'die' EXI test_set_editor () { FAKE_EDITOR="$1" export FAKE_EDITOR - VISUAL='"$FAKE_EDITOR"' - export VISUAL + EDITOR='"$FAKE_EDITOR"' + export EDITOR } + test_decode_color () { + sed -e 's/.\[1m//g' \ + -e 's/.\[31m//g' \ + -e 's/.\[32m//g' \ + -e 's/.\[33m//g' \ + -e 's/.\[34m//g' \ + -e 's/.\[35m//g' \ + -e 's/.\[36m//g' \ + -e 's/.\[m//g' + } + test_tick () { if test -z "${test_tick+set}" then diff --cc wt-status.c index 38eb24536,c4589055b..5d5698801 --- a/wt-status.c +++ b/wt-status.c @@@ -47,10 -47,11 +47,13 @@@ void wt_status_prepare(struct wt_statu static void wt_status_print_unmerged_header(struct wt_status *s) { const char *c = color(WT_STATUS_HEADER, s); + color_fprintf_ln(s->fp, c, "# Unmerged paths:"); + if (!advice_status_hints) + return; - if (!s->is_initial) + if (s->in_merge) + ; + else if (!s->is_initial) color_fprintf_ln(s->fp, c, "# (use \"git reset %s ...\" to unstage)", s->reference); else color_fprintf_ln(s->fp, c, "# (use \"git rm --cached ...\" to unstage)"); @@@ -61,14 -62,14 +64,16 @@@ static void wt_status_print_cached_header(struct wt_status *s) { const char *c = color(WT_STATUS_HEADER, s); + color_fprintf_ln(s->fp, c, "# Changes to be committed:"); + if (!advice_status_hints) + return; - if (!s->is_initial) { + if (s->in_merge) + ; /* NEEDSWORK: use "git reset --unresolve"??? */ + else if (!s->is_initial) color_fprintf_ln(s->fp, c, "# (use \"git reset %s ...\" to unstage)", s->reference); - } else { + else color_fprintf_ln(s->fp, c, "# (use \"git rm --cached ...\" to unstage)"); - } color_fprintf_ln(s->fp, c, "#"); } @@@ -76,9 -77,8 +81,10 @@@ static void wt_status_print_dirty_heade int has_deleted) { const char *c = color(WT_STATUS_HEADER, s); + color_fprintf_ln(s->fp, c, "# Changed but not updated:"); + if (!advice_status_hints) + return; if (!has_deleted) color_fprintf_ln(s->fp, c, "# (use \"git add ...\" to update what will be committed)"); else