Tags: gitgitgadget/git
Tags
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:
> 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
Signed-off-by: Arsh Srivastava arshsrivastava00@gmail.com
Arsh Srivastava (2):
advice: add stashBeforeCheckout advice for dirty branch switches
advice: add stashBeforeCheckout advice for dirty branch switches
[GSOC]
Documentation/config/advice.adoc | 5 +++++
advice.c | 20 ++++++++++++++++++++
advice.h | 2 ++
3 files changed, 27 insertions(+)
base-commit: d181b93
Submitted-As: https://lore.kernel.org/git/pull.2233.v3.git.git.1773149337.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2233.git.git.1773132678.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2233.v2.git.git.1773140364525.gitgitgadget@gmail.com
advice: add stashBeforeCheckout advice for dirty branch switches From: Arsh Srivastava <arshsrivastava00@gmail.com> Add a new advice type ADVICE_STASH_BEFORE_CHECKOUT to guide users when they attempt to switch branches with local modifications that would be overwritten by the operation. This includes: > New ADVICE_STASH_BEFORE_CHECKOUT enum value in advice.h > Corresponding "stashBeforeCheckout" entry in advice_setting[] > New advise_on_checkout_dirty_files() function that lists the affected files and suggests using git stash push/pop > Documentation entry in Documentation/config/advice.txt The advice follows existing patterns established by advise_on_updating_sparse_paths() and can be silenced with: git config set advice.stashBeforeCheckout false Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com> Submitted-As: https://lore.kernel.org/git/pull.2233.v2.git.git.1773140364525.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2233.git.git.1773132678.gitgitgadget@gmail.com
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:
> 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
Signed-off-by: Arsh Srivastava arshsrivastava00@gmail.com
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: 3fe08b8
Submitted-As: https://lore.kernel.org/git/pull.2233.git.git.1773132678.gitgitgadget@gmail.com
t7605: use test_path_is_file instead of test -f From: Mansi <mansimaanu8627@gmail.com> Replace old-style 'test -f' path checks with the modern test_path_is_file helper in the merge_c1_to_c2_cmds block. The helper provides clearer failure messages and is the established convention in Git's test suite. These instances were found using: grep -rn "test -[efd]" t/ --include="*.sh" Signed-off-by: Mansi <mansimaanu8627@gmail.com> Submitted-As: https://lore.kernel.org/git/pull.2067.git.1773120813628.gitgitgadget@gmail.com
t1900: add tests for git repo structure subcommand From: Mansi Singh <mansimaanu8627@gmail.com> The t1900 test file covers git repo info thoroughly but has no tests for the git repo structure subcommand. Add basic tests to verify that: - git repo structure succeeds and produces no stderr output - git repo structure --format=keyvalue outputs expected keys - git repo structure --format=nul succeeds - git repo structure rejects an unknown format Signed-off-by: Mansi Singh <mansimaanu8627@gmail.com> Submitted-As: https://lore.kernel.org/git/pull.2066.git.1773112159662.gitgitgadget@gmail.com
repo: remove redundant variable shadow in stats_table_print_structure The variable i is declared in the outer scope of stats_table_print_structure() and then re-declared inside the loop, shadowing the outer one unnecessarily. Remove the redundant inner declaration to clean up the scope. Signed-off-by: Mansi Singh mansimaanu8627@gmail.com Mansi (1): t7605: use test_path_is_file instead of test -f Mansi Singh (1): repo: remove redundant variable shadow in stats_table_print_structure builtin/repo.c | 1 - t/t7605-merge-resolve.sh | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) base-commit: 7c02d39 Submitted-As: https://lore.kernel.org/git/pull.2062.git.1773109018.gitgitgadget@gmail.com
doc: make it easier to find custom command information From: Omri Sarig <omri.sarig13@gmail.com> Git supports creating additional commands through aliases, and through placement of executables with a "git-" prefix in the PATH. This information was not easy enough to find - users will look for this information around the command description, but the documentation exists in other locations. Update the "GIT COMMANDS" section to reference the relevant sections, making it easier for to find this information. Signed-off-by: Omri Sarig <omri.sarig13@gmail.com> Submitted-As: https://lore.kernel.org/git/pull.2225.git.git.1772903281929.gitgitgadget@gmail.com
line-log: route -L output through the standard diff pipeline git log -L has bypassed the standard diff pipeline since its introduction, using dump_diff_hacky() to hand-roll diff output. A NEEDSWORK comment has acknowledged this from the start. This series removes dump_diff_hacky() and routes -L output through builtin_diff() / fn_out_consume(), so that diff formatting options like --word-diff, --color-moved, -w, and pickaxe options (-S, -G) work with -L. This replaces my earlier series "line-log: fix -L with pickaxe options" [1]. Patch 1 is the crash fix from that series (unchanged). Patch 2/2 from that series (rejecting -S/-G) is dropped because this series makes those options work instead of rejecting them. [1] https://lore.kernel.org/git/pull.2061.git.1772651484.gitgitgadget@gmail.com/ Patch 1 fixes a crash when combining -L with pickaxe options and a rename. Patch 2 is the core change: callback wrappers filter xdiff's output to tracked line ranges, and line ranges are carried on diff_filepair so each file's ranges travel with its filepair through the pipeline. diffcore_std() runs at output time, so pickaxe, --orderfile, and --diff-filter also work. Patch 3 adds tests covering the newly-working options. Patch 4 updates documentation. User-visible output change: -L output now includes index lines, new file mode headers, and funcname context in @@ headers that were previously missing. Tools parsing -L output may need to handle these additional lines. Known limitations not addressed in this series: * line_log_print() still calls show_log() and diff_flush() directly, bypassing log_tree_diff_flush(). The early return in log_tree_commit() (and its associated NEEDSWORK about no_free not being restored) is pre-existing. Restructuring -L to flow through log_tree_diff_flush() is a larger change that would affect separator and header logic; it is left for a follow-up. * Non-patch diff formats (--raw, --numstat, --stat, etc.) remain unimplemented for -L. Michael Montalbo (4): line-log: fix crash when combined with pickaxe options line-log: route -L output through the standard diff pipeline t4211: add tests for -L with standard diff options doc: note that -L supports patch formatting and pickaxe options Michael Montalbo (4): line-log: fix crash when combined with pickaxe options line-log: route -L output through the standard diff pipeline t4211: add tests for -L with standard diff options doc: note that -L supports patch formatting and pickaxe options Documentation/line-range-options.adoc | 4 + diff.c | 279 +++++++++++++- diffcore.h | 16 + line-log.c | 196 ++-------- line-log.h | 14 +- revision.c | 2 + t/t4211-line-log.sh | 342 +++++++++++++++++- t/t4211/sha1/expect.beginning-of-file | 4 + t/t4211/sha1/expect.end-of-file | 11 +- t/t4211/sha1/expect.move-support-f | 5 + t/t4211/sha1/expect.multiple | 10 +- t/t4211/sha1/expect.multiple-overlapping | 7 + t/t4211/sha1/expect.multiple-superset | 7 + t/t4211/sha1/expect.no-assertion-error | 12 +- t/t4211/sha1/expect.parallel-change-f-to-main | 7 + t/t4211/sha1/expect.simple-f | 4 + t/t4211/sha1/expect.simple-f-to-main | 5 + t/t4211/sha1/expect.simple-main | 11 +- t/t4211/sha1/expect.simple-main-to-end | 11 +- t/t4211/sha1/expect.two-ranges | 10 +- t/t4211/sha1/expect.vanishes-early | 10 +- t/t4211/sha256/expect.beginning-of-file | 4 + t/t4211/sha256/expect.end-of-file | 11 +- t/t4211/sha256/expect.move-support-f | 5 + t/t4211/sha256/expect.multiple | 10 +- t/t4211/sha256/expect.multiple-overlapping | 7 + t/t4211/sha256/expect.multiple-superset | 7 + t/t4211/sha256/expect.no-assertion-error | 12 +- .../sha256/expect.parallel-change-f-to-main | 7 + t/t4211/sha256/expect.simple-f | 4 + t/t4211/sha256/expect.simple-f-to-main | 5 + t/t4211/sha256/expect.simple-main | 11 +- t/t4211/sha256/expect.simple-main-to-end | 11 +- t/t4211/sha256/expect.two-ranges | 10 +- t/t4211/sha256/expect.vanishes-early | 10 +- 35 files changed, 864 insertions(+), 217 deletions(-) base-commit: 7b2bccb Submitted-As: https://lore.kernel.org/git/pull.2065.git.1772845338.gitgitgadget@gmail.com
clone: add clone.<url>.defaultObjectFilter config
From: Alan Braithwaite <alan@braithwaite.dev>
Add a new configuration option that lets users specify a default
partial clone filter, optionally scoped by URL pattern. When
cloning a repository whose URL matches a configured pattern,
git-clone automatically applies the filter, equivalent to passing
--filter on the command line.
[clone]
defaultObjectFilter = blob:limit=1m
[clone "https://github.com/"]
defaultObjectFilter = blob:limit=5m
[clone "https://internal.corp.com/large-project/"]
defaultObjectFilter = blob:none
The bare clone.defaultObjectFilter applies to all clones. The
URL-qualified form clone.<url>.defaultObjectFilter restricts the
setting to matching URLs. URL matching uses the existing
urlmatch_config_entry() infrastructure, following the same rules as
http.<url>.* — a domain, namespace, or specific project can be
matched, and the most specific match wins.
The config only affects the initial clone. Once the clone completes,
the filter is recorded in remote.<name>.partialCloneFilter, so
subsequent fetches inherit it automatically. An explicit --filter
on the command line takes precedence, and --no-filter defeats the
configured default entirely.
Signed-off-by: Alan Braithwaite <alan@braithwaite.dev>
Submitted-As: https://lore.kernel.org/git/pull.2058.v5.git.1772847236966.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2058.git.1772383499900.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2058.v2.git.1772672251281.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2058.v3.git.1772780113400.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2058.v4.git.1772833649843.gitgitgadget@gmail.com
branch: add prefixes to new branch names This PR adds a way to add prefixes to a new branch being created. The goal is mostly to ease the developer process of creating new branches by adding shortcuts that can be set either with a command-line option or with configuration parameter. This is useful especially when you have to do similar backports on multiple branches, removing a bit of the need for finding names or typing the names over and over again. Changes since v1: * Added a '--no-prefix' option to git branch Changes since v2: * Changed the PR structure, with 3 patches: * first patch adds the '--name-prefix' option * second adds the 'branch.namePrefix' configuration parameter * third adds the '--no-name-prefix' option * Those patches only target 'git branch' now VALERI Yoann (3): branch: add '--name-prefix' option branch: add 'branch.namePrefix' config param branch: add '--no-name-prefix' option Documentation/config/branch.adoc | 5 +++++ Documentation/git-branch.adoc | 11 ++++++++++- branch.c | 21 ++++++++++++++++++++ branch.h | 12 +++++++++++ builtin/branch.c | 25 +++++++++++++++-------- t/t3200-branch.sh | 34 ++++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 9 deletions(-) base-commit: 2cc7191 Submitted-As: https://lore.kernel.org/git/pull.2202.v3.git.git.1772802872.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2202.git.git.1771574833967.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2202.v2.git.git.1772207333.gitgitgadget@gmail.com
PreviousNext