Skip to content

reset improvements

Martin von Zweigbergk git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest19 patches 2 repliesIn review
  2. v119 patches 25 repliesSuperseded

Changes in v2 from the cover letter

- Spelling fixes.

- Explained how "git reset -- $pathspec" in bare repo is broken.

- Provided motivation for replacement of switch by if-else

- Fixed argv/argc handling by removing use of argc.

- Replaced "don't refresh index on --quiet" patch by one that just inlines update_index_refresh()

- Incorporated fixes from Junio's repo

- Provided some motivation for "replace switch by if-else" amd moved the patch later in the series.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19reset $pathspec: no need to discard indexbuiltin/reset.c+1 -150 replies
2/19reset $pathspec: exit with code 0 if successfulbuiltin/reset.c t/t2013-checkout-submodule.sh t/t7102-reset.sh+16 -120 replies
3/19reset.c: pass pathspec around instead of (prefix, argv) pairbuiltin/reset.c+10 -170 replies
4/19reset: don't allow "git reset -- $pathspec" in bare repobuiltin/reset.c+4 -20 replies
5/19reset.c: extract function for parsing argumentsbuiltin/reset.c+38 -320 replies
6/19reset.c: remove unnecessary variable 'i'builtin/reset.c+16 -171 reply
7/19reset.c: extract function for updating {ORIG_,}HEADbuiltin/reset.c+23 -160 replies
8/19reset.c: share call to die_if_unmerged_cache()builtin/reset.c+6 -80 replies
9/19reset --keep: only write index file oncebuiltin/reset.c+10 -110 replies
10/19reset: avoid redundant error messagebuiltin/reset.c+3 -50 replies
11/19reset.c: replace switch by if-elsebuiltin/reset.c+3 -100 replies
12/19reset.c: move update_index_refresh() call out of read_from_tree()builtin/reset.c+9 -90 replies
13/19reset.c: move lock, write and commit out of update_index_refresh()builtin/reset.c+18 -160 replies
14/19reset [--mixed]: only write index file oncebuiltin/reset.c+5 -90 replies
15/19reset.c: finish entire cmd_reset() whether or not pathspec is givenbuiltin/reset.c+18 -240 replies
16/19reset.c: inline update_index_refresh()builtin/reset.c+5 -90 replies
17/19reset $sha1 $pathspec: require $sha1 only to be treeishbuiltin/reset.c t/t7102-reset.sh+35 -210 replies
17/19fixup! reset $sha1 $pathspec: require $sha1 only to be treeishDocumentation/git-reset.txt builtin/reset.c+11 -111 reply
18/19reset: allow reset on unborn branchbuiltin/reset.c t/t7106-reset-unborn-branch.sh+62 -60 replies
19/19reset [--mixed]: use diff-based reset whether or not pathspec was givenbuiltin/reset.c+1 -10 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 00/19] reset improvements

Changes since v1:

- Spelling fixes.

- Explained how "git reset -- $pathspec" in bare repo is broken.

- Provided motivation for replacement of switch by if-else

- Fixed argv/argc handling by removing use of argc.

- Replaced "don't refresh index on --quiet" patch by one that just inlines update_index_refresh()

- Incorporated fixes from Junio's repo

- Provided some motivation for "replace switch by if-else" amd moved the patch later in the series.

Thanks for reviewing!

Martin von Zweigbergk (19):
reset $pathspec: no need to discard index
reset $pathspec: exit with code 0 if successful
reset.c: pass pathspec around instead of (prefix, argv) pair
reset: don't allow "git reset -- $pathspec" in bare repo reset.c: extract function for parsing arguments
reset.c: remove unnecessary variable 'i'
reset.c: extract function for updating {ORIG_,}HEAD reset.c: share call to die_if_unmerged_cache()
reset --keep: only write index file once
reset: avoid redundant error message
reset.c: replace switch by if-else
reset.c: move update_index_refresh() call out of read_from_tree() reset.c: move lock, write and commit out of update_index_refresh() reset [--mixed]: only write index file once
reset.c: finish entire cmd_reset() whether or not pathspec is given reset.c: inline update_index_refresh()
reset $sha1 $pathspec: require $sha1 only to be treeish
reset: allow reset on unborn branch
reset [--mixed]: use diff-based reset whether or not pathspec was
given

 builtin/reset.c                | 283 +++++++++++++++++++----------------------
 t/t2013-checkout-submodule.sh  |   2 +-
 t/t7102-reset.sh               |  26 +++-
 t/t7106-reset-unborn-branch.sh |  52 ++++++++
 4 files changed, 203 insertions(+), 160 deletions(-)
 create mode 100755 t/t7106-reset-unborn-branch.sh
Signature · 1 line
1.8.1.1.454.gce43f05