Commit Diff


commit - 063253307314ac1b90e8cd14b32cd11f93d31177
commit + 43896ae629e895c4f9fda63d34496408db649225
blob - 4c2a71542b7b46f96a3aa97b095afdcdb61be55f
blob + acd2e30627d8bd30e774b7821cde664cd2092c4d
--- lib/worktree.c
+++ lib/worktree.c
@@ -5919,7 +5919,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 - c46aff5002a8e5c93a065ef3fc1e94a0c88f89ed
blob + bd9a3682082a9cea59639f31caa0666db9c823f0
--- regress/cmdline/commit.sh
+++ regress/cmdline/commit.sh
@@ -1623,8 +1623,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"
 }
 
 
@@ -1656,3 +1717,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