Skip to content

RFC Add backup log

Nguyễn Thái Ngọc Duy git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest24 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/24doc: introduce new "backup log" conceptDocumentation/config/core.txt Documentation/git-backup-log.txt+112 -00 replies
2/24backup-log: add "update" subcommand.gitignore Makefile backup-log.c +7 more+167 -10 replies
3/24read-cache.c: new flag for add_index_entry() to write to backup logcache.h read-cache.c+49 -20 replies
4/24add: support backup logbuiltin/add.c t/t2080-backup-log.sh+16 -00 replies
5/24update-index: support backup log with --keep-backupDocumentation/git-update-index.txt builtin/update-index.c t/t2080-backup-log.sh+21 -00 replies
6/24commit: support backup logbuiltin/commit.c t/t2080-backup-log.sh+35 -50 replies
7/24apply: support backup log with --keep-backupDocumentation/git-apply.txt apply.c apply.h +1 more+65 -20 replies
8/24add--interactive: support backup loggit-add--interactive.perl+7 -70 replies
9/24backup-log.c: add API for walking backup logbackup-log.c backup-log.h+193 -10 replies
10/24backup-log: add cat commandbuiltin/backup-log.c t/t2080-backup-log.sh+100 -00 replies
11/24backup-log: add diff commandbuiltin/backup-log.c t/t2080-backup-log.sh+125 -00 replies
12/24backup-log: add log commandbuiltin/backup-log.c t/t2080-backup-log.sh+124 -00 replies
13/24backup-log: add prune commandbackup-log.c backup-log.h builtin/backup-log.c+91 -00 replies
14/24gc: prune backup logsbackup-log.c backup-log.h builtin/gc.c+37 -00 replies
15/24backup-log: keep all blob references aroundbackup-log.c backup-log.h builtin/pack-objects.c +3 more+82 -10 replies
16/24sha1-file.c: let index_path() accept NULL istatesha1-file.c+5 -30 replies
17/24config --edit: support backup logbuiltin/config.c t/t2080-backup-log.sh+40 -10 replies
18/24refs: keep backup of deleted reflogrefs/files-backend.c t/t2080-backup-log.sh+44 -00 replies
19/24unpack-trees.c: keep backup of ignored files being overwrittenbuiltin/checkout.c merge.c t/t2080-backup-log.sh +2 more+92 -130 replies
20/24reset --hard: keep backup of overwritten filesbuiltin/reset.c merge-recursive.c t/t2080-backup-log.sh +2 more+74 -170 replies
21/24checkout -f: keep backup of overwritten filesbuiltin/checkout.c+2 -00 replies
22/24am: keep backup of overwritten files on --skip or --abortbuiltin/am.c+3 -00 replies
23/24rebase: keep backup of overwritten files on --skip or --abortbuiltin/rebase.c+5 -10 replies
24/24FIXMEDocumentation/git-backup-log.txt+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 00/24] Add backup log

"Backup log" is similar to reflog. But instead of keeping track of ref changes, it keeps track of file content changes. These could be from the index (e.g. "git add" replacing something in the index), worktree ("git reset --hard" deleting everything) or in gitdir ("git config --edit", or deleted reflog).

Backup log, when enabled, keeps the backup versions so you can undo if needed. Head for 01/24 to have a better picture what it does, when backups are made... This series adds a new plumbing command 'git backup-log' to manage these backups.

A couple things left to do:

- high level UI design, including maybe extended SHA-1 syntax
- whether "git checkout <paths>" should keep backups. I think doing it unconditionally may be too much, but maybe keep backups of files with "precious" attribute on
- a UI to edit $GIT_DIR/info/excludes and gitattributes so we can make backups of them
- whether we should keep command causing the changes in the backup log (e.g. this change is made by git-add, that one git-rebase...). Reflog has this. I did not add it because it complicates the parsing a bit and not sure if it's worth it.

Nguyễn Thái Ngọc Duy (24):
doc: introduce new "backup log" concept
backup-log: add "update" subcommand
read-cache.c: new flag for add_index_entry() to write to backup log
add: support backup log
update-index: support backup log with --keep-backup
commit: support backup log
apply: support backup log with --keep-backup
add--interactive: support backup log
backup-log.c: add API for walking backup log
backup-log: add cat command
backup-log: add diff command
backup-log: add log command
backup-log: add prune command
gc: prune backup logs
backup-log: keep all blob references around
sha1-file.c: let index_path() accept NULL istate
config --edit: support backup log
refs: keep backup of deleted reflog
unpack-trees.c: keep backup of ignored files being overwritten reset --hard: keep backup of overwritten files
checkout -f: keep backup of overwritten files
am: keep backup of overwritten files on --skip or --abort
rebase: keep backup of overwritten files on --skip or --abort FIXME

 .gitignore                         |   1 +
 Documentation/config/core.txt      |   5 +
 Documentation/git-apply.txt        |   3 +
 Documentation/git-backup-log.txt   | 109 ++++++++
 Documentation/git-update-index.txt |   3 +
 Makefile                           |   2 +
 apply.c                            |  38 ++-
 apply.h                            |   1 +
 backup-log.c                       | 388 +++++++++++++++++++++++++++++
 backup-log.h                       |  38 +++
 builtin.h                          |   1 +
 builtin/add.c                      |   5 +
 builtin/am.c                       |   3 +
 builtin/backup-log.c               | 371 +++++++++++++++++++++++++++
 builtin/checkout.c                 |   4 +
 builtin/commit.c                   |  16 +-
 builtin/config.c                   |  27 +-
 builtin/gc.c                       |   3 +
 builtin/pack-objects.c             |   9 +-
 builtin/rebase.c                   |   6 +-
 builtin/repack.c                   |   1 +
 builtin/reset.c                    |   2 +
 builtin/update-index.c             |   7 +
 cache.h                            |   2 +
 command-list.txt                   |   1 +
 git-add--interactive.perl          |  14 +-
 git.c                              |   1 +
 merge-recursive.c                  |   2 +-
 merge.c                            |   2 +
 parse-options.c                    |   2 +-
 reachable.c                        |   3 +
 read-cache.c                       |  49 +++-
 refs/files-backend.c               |  32 +++
 revision.c                         |   3 +
 sha1-file.c                        |   8 +-
 t/t2080-backup-log.sh              | 228 +++++++++++++++++
 unpack-trees.c                     | 143 +++++++++--
 unpack-trees.h                     |   6 +-
 38 files changed, 1488 insertions(+), 51 deletions(-)
 create mode 100644 Documentation/git-backup-log.txt
 create mode 100644 backup-log.c
 create mode 100644 backup-log.h
 create mode 100644 builtin/backup-log.c
 create mode 100755 t/t2080-backup-log.sh
Signature · 1 line
2.20.0.rc2.486.g9832c05c3d