Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e9493c5
Documentation/git-reflog: convert to use synopsis type
pks-t Aug 6, 2025
649c7bb
builtin/reflog: improve grouping of subcommands
pks-t Aug 6, 2025
1ffd2d4
refs: export `ref_transaction_update_reflog()`
pks-t Aug 6, 2025
7aa619c
builtin/reflog: implement subcommand to write new entries
pks-t Aug 6, 2025
9fdbba8
ident: fix type of string length parameter
pks-t Aug 6, 2025
ec922e0
refs: fix identity for migrated reflogs
pks-t Aug 6, 2025
211fa8b
refs/files: detect race when generating reflog entry for HEAD
pks-t Aug 6, 2025
046c673
refs: stop unsetting REF_HAVE_OLD for log-only updates
pks-t Aug 6, 2025
465eff8
refs: fix invalid old object IDs when migrating reflogs
pks-t Aug 6, 2025
4d491ad
rebase -i: permit 'drop' of a merge commit
j6t Aug 6, 2025
c5a2c76
merge-ort: update comments to modern testfile location
newren Aug 6, 2025
edbe2ab
merge-ort: drop unnecessary temporary in check_for_directory_rename()
newren Aug 6, 2025
034b2fd
t6423: document two bugs with rename-to-self testcases
newren Aug 6, 2025
db5015a
t6423: fix missed staging of file in testcases 12i,12j,12k
newren Aug 6, 2025
d3de978
merge-ort: clarify the interning of strings in opt->priv->path
newren Aug 6, 2025
885ffe5
merge-ort: fix incorrect file handling
newren Aug 6, 2025
f6ecb60
merge-ort: fix directory rename on top of source of other rename/delete
newren Aug 6, 2025
b55e6d3
diff: ensure consistent diff behavior with ignore options
brandb97 Aug 8, 2025
31e5d03
t5516: remove surrounding empty lines in test bodies
Denton-L Aug 8, 2025
b33c590
remote.c: remove BUG in show_push_unqualified_ref_name_error()
Denton-L Aug 8, 2025
dfbfc22
remote.c: convert if-else ladder to switch
Denton-L Aug 8, 2025
e1d3d61
diff: --no-index should ignore the worktree
gitster Aug 10, 2025
ab60c69
line-log: fix assertion error
szeder Aug 18, 2025
e310699
line-log: show all line ranges touched by the same diff range
szeder Aug 18, 2025
febb9d8
path-walk: fix setup of pending objects
derrickstolee Aug 25, 2025
93afe9b
path-walk: create initializer for path lists
derrickstolee Aug 25, 2025
8f32a5a
fetch-pack: re-scan when double-checking graph objects
peff Aug 24, 2025
c9388d9
midx-write: only load initialized packs
derrickstolee Sep 5, 2025
3a45c7b
midx-write: put failing response value back
derrickstolee Sep 5, 2025
9c2262d
midx-write: use cleanup when incremental midx fails
derrickstolee Sep 5, 2025
68383ac
midx-write: use uint32_t for preferred_pack_idx
derrickstolee Sep 5, 2025
1f2bc6b
midx-write: reenable signed comparison errors
derrickstolee Sep 5, 2025
c25651a
midx-write: simplify error cases
derrickstolee Sep 5, 2025
7a57fb1
t5530: modernize tests
pks-t Sep 5, 2025
88a2dc6
upload-pack: don't ACK non-commits repeatedly in protocol v2
pks-t Sep 5, 2025
89b4183
stash: pass --no-color to diff plumbing child processes
peff Sep 8, 2025
8c78b5c
add-interactive: respect color.diff for diff coloring
peff Sep 8, 2025
776d6fb
add-interactive: manually fall back color config to color.ui
peff Sep 8, 2025
1092cd6
contrib/diff-highlight: mention interactive.diffFilter
peff Sep 8, 2025
064468e
sparse-checkout: remove use of the_repository
derrickstolee Sep 12, 2025
2520efd
sparse-checkout: add basics of 'clean' command
derrickstolee Sep 12, 2025
a8077c1
sparse-checkout: match some 'clean' behavior
derrickstolee Sep 12, 2025
1588e83
dir: add generic "walk all files" helper
derrickstolee Sep 12, 2025
5b5a7f5
sparse-checkout: add --verbose option to 'clean'
derrickstolee Sep 12, 2025
66c11bd
sparse-index: point users to new 'clean' action
derrickstolee Sep 12, 2025
592d2a9
t: expand tests around sparse merges and clean
derrickstolee Sep 12, 2025
3c07063
refs/files: catch conflicts on case-insensitive file-systems
KarthikNayak Sep 17, 2025
9b62a67
refs/files: use correct error type when lock exists
KarthikNayak Sep 17, 2025
770f389
refs/files: handle F/D conflicts in case-insensitive FS
KarthikNayak Sep 17, 2025
948b2ab
refs/files: handle D/F conflicts during locking
KarthikNayak Sep 17, 2025
5b44c3b
rebase -i: respect commit.cleanup when picking fixups
phillipwood Sep 18, 2025
82a0a73
sequencer: remove VERBATIM_MSG flag
phillipwood Sep 18, 2025
9c20a5b
Merge branch 'js/rebase-i-allow-drop-on-a-merge'
gitster Aug 21, 2025
40f6c69
contrib/subtree: fix split with squashed subtrees
Sep 10, 2025
511b697
Merge branch 'ps/reflog-migrate-fixes'
gitster Aug 21, 2025
948452f
Merge branch 'dl/push-missing-object-error'
dscho Sep 25, 2025
8caa690
Merge branch 'en/ort-rename-fixes'
gitster Aug 21, 2025
da2c94c
Merge branch 'jc/diff-no-index-in-subdir'
gitster Aug 22, 2025
62df672
Merge branch 'ly/diff-name-only-with-diff-from-content'
gitster Aug 22, 2025
2ede838
Merge branch 'jk/fetch-check-graph-objects-fix'
gitster Aug 28, 2025
77fa268
Merge branch 'ds/path-walk-repack-fix'
gitster Sep 8, 2025
8032b78
Merge branch 'ds/midx-write-fixes'
gitster Sep 15, 2025
fb583dc
Merge branch 'ps/upload-pack-oom-protection'
gitster Sep 15, 2025
8592f15
Merge branch 'sg/line-log-boundary-fixes'
gitster Sep 18, 2025
96c9a71
Merge branch 'kn/refs-files-case-insensitive' into jch
gitster Sep 23, 2025
1d6c60e
Merge branch 'ds/sparse-checkout-clean' into jch
gitster Sep 23, 2025
31804ed
Merge branch 'jk/add-i-color'
gitster Sep 23, 2025
3bd53ca
Merge branch 'pw/rebase-i-cleanup-fix' into jch
gitster Sep 23, 2025
a2ea7bc
Merge branch 'cs/subtree-squash-split-fix'
gitster Sep 23, 2025
18c819b
diff --no-index: fix logic for paths ending in '/'
jacob-keller Sep 24, 2025
ade1f1c
diff --no-index: fix logic for paths ending in '/'
gitster Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 52 additions & 44 deletions Documentation/git-reflog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ git-reflog - Manage reflog information

SYNOPSIS
--------
[verse]
'git reflog' [show] [<log-options>] [<ref>]
'git reflog list'
'git reflog expire' [--expire=<time>] [--expire-unreachable=<time>]
[synopsis]
git reflog [show] [<log-options>] [<ref>]
git reflog list
git reflog exists <ref>
git reflog write <ref> <old-oid> <new-oid> <message>
git reflog delete [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
git reflog drop [--all [--single-worktree] | <refs>...]
git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
'git reflog delete' [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
'git reflog drop' [--all [--single-worktree] | <refs>...]
'git reflog exists' <ref>

DESCRIPTION
-----------
Expand All @@ -43,11 +44,15 @@ actions, and in addition the `HEAD` reflog records branch switching.

The "list" subcommand lists all refs which have a corresponding reflog.

The "expire" subcommand prunes older reflog entries. Entries older
than `expire` time, or entries older than `expire-unreachable` time
and not reachable from the current tip, are removed from the reflog.
This is typically not used directly by end users -- instead, see
linkgit:git-gc[1].
The "exists" subcommand checks whether a ref has a reflog. It exits
with zero status if the reflog exists, and non-zero status if it does
not.

The "write" subcommand writes a single entry to the reflog of a given
reference. This new entry is appended to the reflog and will thus become
the most recent entry. The reference name must be fully qualified. Both the old
and new object IDs must not be abbreviated and must point to existing objects.
The reflog message gets normalized.

The "delete" subcommand deletes single entries from the reflog, but
not the reflog itself. Its argument must be an _exact_ entry (e.g. "`git
Expand All @@ -58,9 +63,11 @@ The "drop" subcommand completely removes the reflog for the specified
references. This is in contrast to "expire" and "delete", both of which
can be used to delete reflog entries, but not the reflog itself.

The "exists" subcommand checks whether a ref has a reflog. It exits
with zero status if the reflog exists, and non-zero status if it does
not.
The "expire" subcommand prunes older reflog entries. Entries older
than `expire` time, or entries older than `expire-unreachable` time
and not reachable from the current tip, are removed from the reflog.
This is typically not used directly by end users -- instead, see
linkgit:git-gc[1].

OPTIONS
-------
Expand All @@ -71,26 +78,45 @@ Options for `show`
`git reflog show` accepts any of the options accepted by `git log`.


Options for `delete`
~~~~~~~~~~~~~~~~~~~~

`git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`,
`--dry-run`, and `--verbose`, with the same meanings as when they are
used with `expire`.

Options for `drop`
~~~~~~~~~~~~~~~~~~

`--all`::
Drop the reflogs of all references from all worktrees.

`--single-worktree`::
By default when `--all` is specified, reflogs from all working
trees are dropped. This option limits the processing to reflogs
from the current working tree only.


Options for `expire`
~~~~~~~~~~~~~~~~~~~~

--all::
`--all`::
Process the reflogs of all references.

--single-worktree::
`--single-worktree`::
By default when `--all` is specified, reflogs from all working
trees are processed. This option limits the processing to reflogs
from the current working tree only.

--expire=<time>::
`--expire=<time>`::
Prune entries older than the specified time. If this option is
not specified, the expiration time is taken from the
configuration setting `gc.reflogExpire`, which in turn
defaults to 90 days. `--expire=all` prunes entries regardless
of their age; `--expire=never` turns off pruning of reachable
entries (but see `--expire-unreachable`).

--expire-unreachable=<time>::
`--expire-unreachable=<time>`::
Prune entries older than `<time>` that are not reachable from
the current tip of the branch. If this option is not
specified, the expiration time is taken from the configuration
Expand All @@ -100,17 +126,17 @@ Options for `expire`
turns off early pruning of unreachable entries (but see
`--expire`).

--updateref::
`--updateref`::
Update the reference to the value of the top reflog entry (i.e.
<ref>@\{0\}) if the previous top entry was pruned. (This
option is ignored for symbolic references.)

--rewrite::
`--rewrite`::
If a reflog entry's predecessor is pruned, adjust its "old"
SHA-1 to be equal to the "new" SHA-1 field of the entry that
now precedes it.

--stale-fix::
`--stale-fix`::
Prune any reflog entries that point to "broken commits". A
broken commit is a commit that is not reachable from any of
the reference tips and that refers, directly or indirectly, to
Expand All @@ -121,33 +147,15 @@ has the same cost as 'git prune'. It is primarily intended to fix
corruption caused by garbage collecting using older versions of Git,
which didn't protect objects referred to by reflogs.

-n::
--dry-run::
`-n`::
`--dry-run`::
Do not actually prune any entries; just show what would have
been pruned.

--verbose::
`--verbose`::
Print extra information on screen.


Options for `delete`
~~~~~~~~~~~~~~~~~~~~

`git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`,
`--dry-run`, and `--verbose`, with the same meanings as when they are
used with `expire`.

Options for `drop`
~~~~~~~~~~~~~~~~~~

--all::
Drop the reflogs of all references from all worktrees.

--single-worktree::
By default when `--all` is specified, reflogs from all working
trees are dropped. This option limits the processing to reflogs
from the current working tree only.

GIT
---
Part of the linkgit:git[1] suite
33 changes: 32 additions & 1 deletion Documentation/git-sparse-checkout.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-sparse-checkout - Reduce your working tree to a subset of tracked files
SYNOPSIS
--------
[verse]
'git sparse-checkout' (init | list | set | add | reapply | disable | check-rules) [<options>]
'git sparse-checkout' (init | list | set | add | reapply | disable | check-rules | clean) [<options>]


DESCRIPTION
Expand Down Expand Up @@ -111,6 +111,37 @@ flags, with the same meaning as the flags from the `set` command, in order
to change which sparsity mode you are using without needing to also respecify
all sparsity paths.

'clean'::
Opportunistically remove files outside of the sparse-checkout
definition. This command requires cone mode to use recursive
directory matches to determine which files should be removed. A
file is considered for removal if it is contained within a tracked
directory that is outside of the sparse-checkout definition.
+
Some special cases, such as merge conflicts or modified files outside of
the sparse-checkout definition could lead to keeping files that would
otherwise be removed. Resolve conflicts, stage modifications, and use
`git sparse-checkout reapply` in conjunction with `git sparse-checkout
clean` to resolve these cases.
+
This command can be used to be sure the sparse index works efficiently,
though it does not require enabling the sparse index feature via the
`index.sparse=true` configuration.
+
To prevent accidental deletion of worktree files, the `clean` subcommand
will not delete any files without the `-f` or `--force` option, unless
the `clean.requireForce` config option is set to `false`.
+
The `--dry-run` option will list the directories that would be removed
without deleting them. Running in this mode can be helpful to predict the
behavior of the clean comand or to determine which kinds of files are left
in the sparse directories.
+
The `--verbose` option will list every file within the directories that
are considered for removal. This option is helpful to determine if those
files are actually important or perhaps to explain why the directory is
still present despite the current sparse-checkout.

'disable'::
Disable the `core.sparseCheckout` config setting, and restore the
working directory to include all files.
Expand Down
88 changes: 55 additions & 33 deletions add-interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
#include "prompt.h"
#include "tree.h"

static void init_color(struct repository *r, struct add_i_state *s,
static void init_color(struct repository *r, int use_color,
const char *section_and_slot, char *dst,
const char *default_color)
{
char *key = xstrfmt("color.%s", section_and_slot);
const char *value;

if (!s->use_color)
if (!use_color)
dst[0] = '\0';
else if (repo_config_get_value(r, key, &value) ||
color_parse(value, dst))
Expand All @@ -36,42 +36,63 @@ static void init_color(struct repository *r, struct add_i_state *s,
free(key);
}

void init_add_i_state(struct add_i_state *s, struct repository *r,
struct add_p_opt *add_p_opt)
static int check_color_config(struct repository *r, const char *var)
{
const char *value;
int ret;

if (repo_config_get_value(r, var, &value))
ret = -1;
else
ret = git_config_colorbool(var, value);

/*
* Do not rely on want_color() to fall back to color.ui for us. It uses
* the value parsed by git_color_config(), which may not have been
* called by the main command.
*/
if (ret < 0 && !repo_config_get_value(r, "color.ui", &value))
ret = git_config_colorbool("color.ui", value);

return want_color(ret);
}

void init_add_i_state(struct add_i_state *s, struct repository *r,
struct add_p_opt *add_p_opt)
{
s->r = r;
s->context = -1;
s->interhunkcontext = -1;

if (repo_config_get_value(r, "color.interactive", &value))
s->use_color = -1;
else
s->use_color =
git_config_colorbool("color.interactive", value);
s->use_color = want_color(s->use_color);

init_color(r, s, "interactive.header", s->header_color, GIT_COLOR_BOLD);
init_color(r, s, "interactive.help", s->help_color, GIT_COLOR_BOLD_RED);
init_color(r, s, "interactive.prompt", s->prompt_color,
GIT_COLOR_BOLD_BLUE);
init_color(r, s, "interactive.error", s->error_color,
GIT_COLOR_BOLD_RED);

init_color(r, s, "diff.frag", s->fraginfo_color,
diff_get_color(s->use_color, DIFF_FRAGINFO));
init_color(r, s, "diff.context", s->context_color, "fall back");
s->use_color_interactive = check_color_config(r, "color.interactive");

init_color(r, s->use_color_interactive, "interactive.header",
s->header_color, GIT_COLOR_BOLD);
init_color(r, s->use_color_interactive, "interactive.help",
s->help_color, GIT_COLOR_BOLD_RED);
init_color(r, s->use_color_interactive, "interactive.prompt",
s->prompt_color, GIT_COLOR_BOLD_BLUE);
init_color(r, s->use_color_interactive, "interactive.error",
s->error_color, GIT_COLOR_BOLD_RED);
strlcpy(s->reset_color_interactive,
s->use_color_interactive ? GIT_COLOR_RESET : "", COLOR_MAXLEN);

s->use_color_diff = check_color_config(r, "color.diff");

init_color(r, s->use_color_diff, "diff.frag", s->fraginfo_color,
diff_get_color(s->use_color_diff, DIFF_FRAGINFO));
init_color(r, s->use_color_diff, "diff.context", s->context_color,
"fall back");
if (!strcmp(s->context_color, "fall back"))
init_color(r, s, "diff.plain", s->context_color,
diff_get_color(s->use_color, DIFF_CONTEXT));
init_color(r, s, "diff.old", s->file_old_color,
diff_get_color(s->use_color, DIFF_FILE_OLD));
init_color(r, s, "diff.new", s->file_new_color,
diff_get_color(s->use_color, DIFF_FILE_NEW));

strlcpy(s->reset_color,
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
init_color(r, s->use_color_diff, "diff.plain",
s->context_color,
diff_get_color(s->use_color_diff, DIFF_CONTEXT));
init_color(r, s->use_color_diff, "diff.old", s->file_old_color,
diff_get_color(s->use_color_diff, DIFF_FILE_OLD));
init_color(r, s->use_color_diff, "diff.new", s->file_new_color,
diff_get_color(s->use_color_diff, DIFF_FILE_NEW));
strlcpy(s->reset_color_diff,
s->use_color_diff ? GIT_COLOR_RESET : "", COLOR_MAXLEN);

FREE_AND_NULL(s->interactive_diff_filter);
repo_config_get_string(r, "interactive.difffilter",
Expand Down Expand Up @@ -109,7 +130,8 @@ void clear_add_i_state(struct add_i_state *s)
FREE_AND_NULL(s->interactive_diff_filter);
FREE_AND_NULL(s->interactive_diff_algorithm);
memset(s, 0, sizeof(*s));
s->use_color = -1;
s->use_color_interactive = -1;
s->use_color_diff = -1;
}

/*
Expand Down Expand Up @@ -1188,9 +1210,9 @@ int run_add_i(struct repository *r, const struct pathspec *ps,
* When color was asked for, use the prompt color for
* highlighting, otherwise use square brackets.
*/
if (s.use_color) {
if (s.use_color_interactive) {
data.color = s.prompt_color;
data.reset = s.reset_color;
data.reset = s.reset_color_interactive;
}
print_file_item_data.color = data.color;
print_file_item_data.reset = data.reset;
Expand Down
7 changes: 5 additions & 2 deletions add-interactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ struct add_p_opt {

struct add_i_state {
struct repository *r;
int use_color;
int use_color_interactive;
int use_color_diff;
char header_color[COLOR_MAXLEN];
char help_color[COLOR_MAXLEN];
char prompt_color[COLOR_MAXLEN];
char error_color[COLOR_MAXLEN];
char reset_color[COLOR_MAXLEN];
char reset_color_interactive[COLOR_MAXLEN];

char fraginfo_color[COLOR_MAXLEN];
char context_color[COLOR_MAXLEN];
char file_old_color[COLOR_MAXLEN];
char file_new_color[COLOR_MAXLEN];
char reset_color_diff[COLOR_MAXLEN];

int use_single_key;
char *interactive_diff_filter, *interactive_diff_algorithm;
Expand Down
Loading
Loading