Skip to content

Advice on checkout dirty files

Arsh Srivastava via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5diff: handle ANSI escape codes in prefix when calculating diffstat widthdiff.c+4 -80 replies
2/5t4052: test for diffstat width when prefix contains ANSI escape codest/t4052-stat-output.sh+32 -00 replies
3/5repo: remove unnecessary variable shadowbuiltin/repo.c+0 -10 replies
4/5The 13th batchDocumentation/RelNotes/2.54.0.adoc+14 -00 replies
5/5advice: add stashBeforeCheckout advice for dirty branch switchesDocumentation/config/advice.adoc advice.c advice.h+34 -00 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchJustin Tobler
1/5
2/5
3/5A-b
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] Advice on checkout dirty files

This is my submission for microproject [GSOC]

This patch adds a new advice type ADVICE_STASH_BEFORE_CHECKOUT to help users when they attempt to switch branches with local modifications that would be overwritten by the operation.

The new advice follows the same patterns established by existing advice functions such as advise_on_updating_sparse_paths(). When triggered, it lists the affected files and suggests using git stash push/pop to save and restore local changes.

The advice can be silenced with:

git config set advice.stashBeforeCheckout false

Changes:

Quoted 4 lines

advice.h: add ADVICE_STASH_BEFORE_CHECKOUT enum value advice.c: add "stashBeforeCheckout" to advice_setting[] and implement advise_on_checkout_dirty_files() function Documentation/config/advice.adoc: document the new advice key

Arsh Srivastava (1):
advice: add stashBeforeCheckout advice for dirty branch switches

Junio C Hamano (1):
The 13th batch

K Jayatheerth (1):
repo: remove unnecessary variable shadow

LorenzoPegorari (2):
diff: handle ANSI escape codes in prefix when calculating diffstat
width
t4052: test for diffstat width when prefix contains ANSI escape codes

 Documentation/RelNotes/2.54.0.adoc | 14 +++++++++++++
 Documentation/config/advice.adoc   |  5 +++++
 advice.c                           | 27 +++++++++++++++++++++++++
 advice.h                           |  2 ++
 builtin/repo.c                     |  1 -
 diff.c                             | 12 ++++-------
 t/t4052-stat-output.sh             | 32 ++++++++++++++++++++++++++++++
 7 files changed, 84 insertions(+), 9 deletions(-)

base-commit: 3fe08b8fd1f7731edabeab8138547ec88d6407de
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2233%2FArsh123344423%2Fadvice_on_checkout_dirty_files-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2233/Arsh123344423/advice_on_checkout_dirty_files-v1
Pull-Request: https://github.com/git/git/pull/2233

Signature · 1 line
gitgitgadget