def test_intent_to_add(in_git_dir, patch_dir): """Regression test for #881""" _write(b'hello\nworld\n') cmd_output('git', 'add', '--intent-to-add', 'foo') assert git.intent_to_add_files() == ['foo'] with staged_files_only(patch_dir): assert_no_diff() assert git.intent_to_add_files() == ['foo']
def test_status_output_with_rename(in_git_dir): in_git_dir.join('a').write('1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n') cmd_output('git', 'add', 'a') git_commit() cmd_output('git', 'mv', 'a', 'b') in_git_dir.join('c').ensure() cmd_output('git', 'add', '--intent-to-add', 'c') assert git.intent_to_add_files() == ['c']
def _intent_to_add_cleared() -> Generator[None, None, None]: intent_to_add = git.intent_to_add_files() if intent_to_add: logger.warning("Unstaged intent-to-add files detected.") xargs(("git", "rm", "--cached", "--"), intent_to_add) try: yield finally: xargs(("git", "add", "--intent-to-add", "--"), intent_to_add) else: yield
def _intent_to_add_cleared() -> Generator[None, None, None]: intent_to_add = git.intent_to_add_files() if intent_to_add: logger.warning('Unstaged intent-to-add files detected.') xargs(('git', 'rm', '--cached', '--'), intent_to_add) try: yield finally: xargs(('git', 'add', '--intent-to-add', '--'), intent_to_add) else: yield
def _intent_to_add_cleared(): intent_to_add = git.intent_to_add_files() if intent_to_add: logger.warning('Unstaged intent-to-add files detected.') xargs(('git', 'rm', '--cached', '--'), intent_to_add) try: yield finally: xargs(('git', 'add', '--intent-to-add', '--'), intent_to_add) else: yield
def test_intent_to_add(in_git_dir): in_git_dir.join('a').ensure() cmd_output('git', 'add', '--intent-to-add', 'a') assert git.intent_to_add_files() == ['a']