commit 4ba2e95571e317867b5ed45cb6c8580a33627500 from: Stefan Hagen date: Fri Sep 02 15:38:54 2022 UTC got: don't search through ignored paths and files on commit commit - e5e662e42c45f0d30f5f97fb0e2ad5f3c4f8b488 commit + 4ba2e95571e317867b5ed45cb6c8580a33627500 blob - f82a9689259ee66048cc0d9c503e6eb31568215b blob + 30e991da06f030404cbce64de63293d385ff1ac8 --- lib/worktree.c +++ lib/worktree.c @@ -5921,7 +5921,7 @@ got_worktree_commit(struct got_object_id **new_commit_ cc_arg.allow_bad_symlinks = allow_bad_symlinks; TAILQ_FOREACH(pe, paths, entry) { err = worktree_status(worktree, pe->path, fileindex, repo, - collect_commitables, &cc_arg, NULL, NULL, 1, 0); + collect_commitables, &cc_arg, NULL, NULL, 0, 0); if (err) goto done; } blob - 98c2c07a14f46473a38a3a8a4e3118a018b05d80 blob + 8cf81360cd1e5b35e87f5e5784c0b83a6aa7356b --- regress/cmdline/commit.sh +++ regress/cmdline/commit.sh @@ -1615,8 +1615,69 @@ test_commit_large_file() { diff -u $testroot/new $testroot/wt/new fi test_done "$testroot" "$ret" + + +} + +test_commit_gitignore() { + local testroot=`test_init commit_gitignores` + + got checkout $testroot/repo $testroot/wt > /dev/null + ret=$? + if [ $ret -ne 0 ]; then + test_done "$testroot" "$ret" + return 1 + fi + + mkdir -p $testroot/wt/tree1/foo + mkdir -p $testroot/wt/tree2/foo + echo "tree1/**" > $testroot/wt/.gitignore + echo "tree2/**" >> $testroot/wt/.gitignore + echo -n > $testroot/wt/tree1/bar + echo -n > $testroot/wt/tree1/foo/baz + echo -n > $testroot/wt/tree2/bar + echo -n > $testroot/wt/tree2/foo/baz + echo -n > $testroot/wt/epsilon/zeta1 + echo -n > $testroot/wt/epsilon/zeta2 + + (cd $testroot/wt && got add -I -R tree1 > /dev/null) + (cd $testroot/wt && got add -I tree2/foo/baz > /dev/null) + (cd $testroot/wt && got commit -m "gitignore add" > /dev/null) + (cd $testroot/wt && got log -P -l 1 | egrep '^ .' > $testroot/stdout) + + echo ' gitignore add' > $testroot/stdout.expected + echo ' A tree1/bar' >> $testroot/stdout.expected + echo ' A tree1/foo/baz' >> $testroot/stdout.expected + echo ' A tree2/foo/baz' >> $testroot/stdout.expected + cmp -s $testroot/stdout.expected $testroot/stdout + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + echo touch > $testroot/wt/tree1/bar + echo touch > $testroot/wt/tree1/foo/baz + echo touch > $testroot/wt/epsilon/zeta1 + + (cd $testroot/wt && got commit -m "gitignore change" > /dev/null) + (cd $testroot/wt && got log -P -l 1 | egrep '^ .' > $testroot/stdout) + + echo ' gitignore change' > $testroot/stdout.expected + echo ' M tree1/bar' >> $testroot/stdout.expected + echo ' M tree1/foo/baz' >> $testroot/stdout.expected + + cmp -s $testroot/stdout.expected $testroot/stdout + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + test_done "$testroot" "$ret" } @@ -1648,3 +1709,4 @@ run_test test_commit_symlink run_test test_commit_fix_bad_symlink run_test test_commit_prepared_logmsg run_test test_commit_large_file +run_test test_commit_gitignore