From 2c63d6eb46da4ef0abc9c040c927818e437d2fcc Mon Sep 17 00:00:00 2001 From: John Keeping Date: Thu, 12 Sep 2013 20:25:01 +0100 Subject: reset: handle submodule with trailing slash When using tab-completion, a directory path will often end with a trailing slash which currently confuses "git reset" when dealing with submodules. Now that we have parse_pathspec we can easily handle this by simply adding the PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP flag. To do this, we need to move the read_cache() call before the parse_pathspec() call. All of the existing paths through cmd_reset() that do not die early already call read_cache() at some point, so there is no performance impact to doing this in the common case. Signed-off-by: John Keeping Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 't/t7400-submodule-basic.sh') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 4192fe0ec6..c268d3c9a2 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -481,7 +481,7 @@ test_expect_success 'do not add files from a submodule' ' ' -test_expect_success 'gracefully add submodule with a trailing slash' ' +test_expect_success 'gracefully add/reset submodule with a trailing slash' ' git reset --hard && git commit -m "commit subproject" init && @@ -495,7 +495,9 @@ test_expect_success 'gracefully add submodule with a trailing slash' ' git add init/ && test_must_fail git diff --exit-code --cached init && test $commit = $(git ls-files --stage | - sed -n "s/^160000 \([^ ]*\).*/\1/p") + sed -n "s/^160000 \([^ ]*\).*/\1/p") && + git reset init/ && + git diff --exit-code --cached init ' -- cgit v1.2.3
AgeCommit message (Expand)AuthorFilesLines
2023-04-27cdx: fix build failure due to sysfs 'bus_type' argument needing to be constLinus Torvalds1-1/+1
2023-04-27ring-buffer: Sync IRQ works before buffer destructionJohannes Berg1-0/+4
2023-04-27mailmap: add entries for Paul MackerrasPaul Mackerras1-0/+2
2023-04-27libgcc: add forward declarations for generic library routinesGeert Uytterhoeven1-0/+7
2023-04-27mm,unmap: avoid flushing TLB in batch if PTE is inaccessibleHuang Ying1-4/+8
2023-04-27shmem: restrict noswap option to initial user namespaceChristian Brauner1-0/+4
2023-04-27mm/khugepaged: fix conflicting mods to collapse_file()Hugh Dickins1-22/+1
2023-04-27mm/mremap: fix vm_pgoff in vma_merge() case 3Vlastimil Babka1-1/+1
2023-04-27xfs: fix livelock in delayed allocation at ENOSPCDave Chinner1-1/+0
2023-04-26timekeeping: Fix references to nonexistent ktime_get_fast_ns()Geert Uytterhoeven1-2/+2
2023-04-26RISC-V: hwprobe: Explicity check for -1 in vdso initAndrew Jones1-1/+1
2023-04-26RISC-V: hwprobe: There can only be one firstAndrew Jones1-1/+3
2023-04-26riscv: Allow to downgrade paging mode from the command lineAlexandre Ghiti10-9/+154
2023-04-26dt-bindings: riscv: add sv57 mmu-typeConor Dooley1-0/+1
2023-04-26tracing: Add missing spaces in trace_print_hex_seq()Ken Lin1-1/+4
2023-04-26ring-buffer: Ensure proper resetting of atomic variables in ring_buffer_reset...Tze-nan Wu1-3/+13
2023-04-26net: phy: hide the PHYLIB_LEDS knobPaolo Abeni1-3/+1
2023-04-26powerpc/64s: Disable pcrel code model on ClangNicholas Piggin1-1/+6
2023-04-26powerpc: Fix merge conflict between pcrel and copy_thread changesNicholas Piggin1-1/+1
2023-04-25RISC-V: hwprobe: Remove __init on probe_vendor_features()Evan Green3-6/+6
2023-04-25recordmcount: Fix memory leaks in the uwrite functionHao Zeng1-1/+5
2023-04-25tracing/user_events: Limit max fault-in attemptsBeau Belgrave1-14/+35
2023-04-25tracing/user_events: Prevent same address and bit per processBeau Belgrave2-1/+49
2023-04-25tracing/user_events: Ensure bit is cleared on unregisterBeau Belgrave2-3/+40
2023-04-25tracing/user_events: Ensure write index cannot be negativeBeau Belgrave2-0/+8
2023-04-25seq_buf: Add seq_buf_do_printk() helperSergey Senozhatsky2-0/+34
2023-04-25tracing: Fix print_fields() for __dyn_loc/__rel_locBeau Belgrave1-4/+6
2023-04-25tracing/user_events: Set event filter_type from typeBeau Belgrave1-0/+3
2023-04-25ring-buffer: Clearly check null ptr returned by rb_set_head_page()Zheng Yejian1-2/+3
2023-04-25rtla/timerlat: Fix "Previous IRQ" auto analysis' lineDaniel Bristot de Oliveira1-1/+1
2023-04-25rtla/timerlat: Add auto-analysis only optionDaniel Bristot de Oliveira2-5/+51
2023-04-25rv: Remove redundant assignment to variable retvalColin Ian King1-2/+0
2023-04-25rv: Fix addition on an uninitialized variable 'run'Colin Ian King1-1/+1