From: Junio C Hamano Date: Mon, 26 Jun 2017 21:09:29 +0000 (-0700) Subject: Merge branch 'lb/status-stash-count' X-Git-Tag: v2.14.0-rc0~54 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/849b44cdf193908dfe1cadc731fb23019b53a211?ds=inline;hp=-c Merge branch 'lb/status-stash-count' "git status" learned to optionally give how many stash entries the user has in its output. * lb/status-stash-count: glossary: define 'stash entry' status: add optional stash count information stash: update documentation to use 'stash entry' --- 849b44cdf193908dfe1cadc731fb23019b53a211 diff --combined Documentation/config.txt index 781ce3e855,e83b0f6415..2845e8d5c4 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@@ -348,9 -348,6 +348,9 @@@ advice.*: rmHints:: In case of failure in the output of linkgit:git-rm[1], show directions on how to proceed from the current state. + addEmbeddedRepo:: + Advice on what to do when you've accidentally added one + git repo inside of another. -- core.fileMode:: @@@ -2623,7 -2620,7 +2623,7 @@@ rebase.autoSquash: If set to true enable `--autosquash` option by default. rebase.autoStash:: - When set to true, automatically create a temporary stash + When set to true, automatically create a temporary stash entry before the operation begins, and apply it after the operation ends. This means that you can run rebase on a dirty worktree. However, use with care: the final stash application after a @@@ -2995,6 -2992,11 +2995,11 @@@ status.displayCommentPrefix: behavior of linkgit:git-status[1] in Git 1.8.4 and previous. Defaults to false. + status.showStash:: + If set to true, linkgit:git-status[1] will display the number of + entries currently stashed away. + Defaults to false. + status.showUntrackedFiles:: By default, linkgit:git-status[1] and linkgit:git-commit[1] show files which are not currently tracked by Git. Directories which @@@ -3032,12 -3034,12 +3037,12 @@@ status.submoduleSummary: stash.showPatch:: If this is set to true, the `git stash show` command without an - option will show the stash in patch form. Defaults to false. + option will show the stash entry in patch form. Defaults to false. See description of 'show' command in linkgit:git-stash[1]. stash.showStat:: If this is set to true, the `git stash show` command without an - option will show diffstat of the stash. Defaults to true. + option will show diffstat of the stash entry. Defaults to true. See description of 'show' command in linkgit:git-stash[1]. submodule..url:: diff --combined builtin/commit.c index 021070e693,c089fb87e3..00a01f07c3 --- a/builtin/commit.c +++ b/builtin/commit.c @@@ -6,7 -6,6 +6,7 @@@ */ #include "cache.h" +#include "config.h" #include "lockfile.h" #include "cache-tree.h" #include "color.h" @@@ -254,8 -253,7 +254,8 @@@ static int list_paths(struct string_lis if (with_tree) { char *max_prefix = common_prefix(pattern); - overlay_tree_on_cache(with_tree, max_prefix ? max_prefix : prefix); + overlay_tree_on_index(&the_index, with_tree, + max_prefix ? max_prefix : prefix); free(max_prefix); } @@@ -1297,6 -1295,10 +1297,10 @@@ static int git_status_config(const cha status_deferred_config.show_branch = git_config_bool(k, v); return 0; } + if (!strcmp(k, "status.showstash")) { + s->show_stash = git_config_bool(k, v); + return 0; + } if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) { s->use_color = git_config_colorbool(k, v); return 0; @@@ -1345,6 -1347,8 +1349,8 @@@ int cmd_status(int argc, const char **a N_("show status concisely"), STATUS_FORMAT_SHORT), OPT_BOOL('b', "branch", &s.show_branch, N_("show branch information")), + OPT_BOOL(0, "show-stash", &s.show_stash, + N_("show stash information")), { OPTION_CALLBACK, 0, "porcelain", &status_format, N_("version"), N_("machine-readable output"), PARSE_OPT_OPTARG, opt_parse_porcelain }, @@@ -1808,7 -1812,7 +1814,7 @@@ int cmd_commit(int argc, const char **a cfg = init_copy_notes_for_rewrite("amend"); if (cfg) { /* we are amending, so current_head is not NULL */ - copy_note_for_rewrite(cfg, current_head->object.oid.hash, oid.hash); + copy_note_for_rewrite(cfg, ¤t_head->object.oid, &oid); finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'"); } run_rewrite_hook(¤t_head->object.oid, &oid); diff --combined git-stash.sh index e7b85932d6,68be4146bd..9b6c2da7b4 --- a/git-stash.sh +++ b/git-stash.sh @@@ -19,7 -19,6 +19,7 @@@ OPTIONS_SPEC START_DIR=$(pwd) . git-sh-setup require_work_tree +prefix=$(git rev-parse --show-prefix) || exit 1 cd_to_toplevel TMP="$GIT_DIR/.git-stash.$$" @@@ -274,8 -273,6 +274,8 @@@ push_stash () shift done + eval "set $(git rev-parse --sq --prefix "$prefix" -- "$@")" + if test -n "$patch_mode" && test -n "$untracked" then die "$(gettext "Can't use --patch and --include-untracked or --all at the same time")" @@@ -484,7 -481,7 +484,7 @@@ parse_flags_and_rev( case $# in 0) - have_stash || die "$(gettext "No stash found.")" + have_stash || die "$(gettext "No stash entries found.")" set -- ${ref_stash}@{0} ;; 1) @@@ -576,7 -573,7 +576,7 @@@ apply_stash () GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" && GIT_INDEX_FILE="$TMPindex" git checkout-index --all && rm -f "$TMPindex" || - die "$(gettext "Could not restore untracked files from stash")" + die "$(gettext "Could not restore untracked files from stash entry")" fi eval " @@@ -630,7 -627,7 +630,7 @@@ pop_stash() drop_stash "$@" else status=$? - say "$(gettext "The stash is kept in case you need it again.")" + say "$(gettext "The stash entry is kept in case you need it again.")" exit $status fi }