Initial commit inside existing repository commits too many files

Open Beginner friendly
#841 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript, vscode

Research direction

Start by locating the extension command that creates a standalone Lean project and the code that runs its initial Git commit. Check how the commit selects files when the project is created inside an existing repository. Done means the initial commit includes only files created for the new project, or the command refuses to commit when the repository already contains other files; add or update a focused test for that behavior.

Written by the indexing model from the issue text.

Description

bug
Prerequisites
  • Check that your issue is not already filed:
    https://github.com/leanprover/vscode-lean4/issues
  • Check that the issue is in the VS Code extension and not in Lean itself.
    Report issues in Lean itself (for example, a wrong error message or a crash of the Lean server) at
    https://github.com/leanprover/lean4/issues
  • Reduce the issue to a minimal, self-contained, reproducible test case.
    If possible, avoid dependencies on Mathlib or Batteries.
  • Test your test case with the latest version of the extension.
  • If the issue is a security vulnerability, do not report it here.
    Write to [email protected] for responsible disclosure.
Description

When creating a lean project using the extensions tool to do so and in an existing git repository, it will blanket commit all uncommitted files in the repository.
For me this resulted in a bunch of temporary files that I do not want committed being committed.

Context

I have a folder structure like so:

.
├── Day1
│   ├── Day1.md
│   └── Scratch Project.sb3
├── Day2
│   ├── Day2.md
│   └── day2.sh
├── Day3
│   ├── Day3.md
│   ├── .idea *
│   ├── index.js
│   ├── input.txt *
│   └── package.json
├── Day4
│   ├── Day4-display.png
│   ├── Day4.md
│   └── Day4.xlsx
├── .git
└── README.md

I used the extension's tool to create a project called Day5 in that folder, and it committed the files marked with a *, which aren't even in the folder the extension put files in and were not in the git index (they were merely unadded, and not ignored).

Steps to Reproduce
  1. Create a folder and initialize a git repository in it. mkdir Test && cd Test && git init
  2. Create a file in that folder that should not be commited echo "Hello" > file.txt
  3. Use the extension to create a project in a new folder in that folder using the ∀ button in the top right -> New Project -> Create Standalone Project
  4. See the extension committed the file.txt that it has no business touching. git log --stat

Expected behavior: The extension to only commit the files it created, or the extension to refuse to commit to a repository that is not empty.

Actual behavior: The extension committed any file that wasn't bolted down by a .gitignore

The extension also created a .github folder inside the Day5 folder, which will not function when pushed to github as those need to be in the root of the repository. This is a separate issue though, however points to the extensions handling of git repositories potentially needing improvement.

Versions

vscode-lean4: v0.0.244
lean: irrelevant
Linux, EndeavourOS

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Dominant language
TypeScript
Stars
327
Forks
109
Avg merge
2d 10h
Merged PRs (30d)
12

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from leanprover/vscode-lean4

All issues in leanprover/vscode-lean4

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.