You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add --git option for explicit git mv control (#226)
Issue #84 requested evaluation of git mv benefits and adding it as an
option. GitStorageManager (using LibGit2Sharp's `Commands.Move`) already
existed but was only available via auto-detection. This adds explicit
control via `--git` flag.
## Changes
- **New `--git` flag on `update` command**: Forces use of
GitStorageManager, errors if not in a git repository
- **New constructor**: `ListingManager(DirectoryInfo, bool useGit)` for
explicit storage manager selection
- **Fixed git detection**: Changed from `Repository.IsValid()` to
`Repository.Discover()` to properly detect repos from subdirectories
- **Maintained backward compatibility**: Default constructor
auto-detects, preferring GitStorageManager when available
## Behavior
```bash
# Force git mv (errors if not in repo)
ListingManager update Chapter03 --git
# Auto-detect (existing behavior, now works from subdirs)
ListingManager update Chapter03
```
| Scenario | Result |
|----------|--------|
| `--git` in git repo | Uses GitStorageManager |
| `--git` outside git repo | Error with clear message |
| No `--git` in git repo | Auto-detects, uses GitStorageManager |
| No `--git` outside git repo | Auto-detects, uses OSStorageManager |
## Why git mv matters
Preserves file rename history for `git log --follow`, blame, and code
review.
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Move files using git mv</issue_title>
> <issue_description>Evaluate if git mv provides a significant
difference in the way moved files are treated by git, and consider
adding it as an option. I.E: --git
>
> This was started in
#84 .
There may not be, but see if enhancements can be
made</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes#4
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/IntelliTect/EssentialCSharp.ListingManager/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+51-18Lines changed: 51 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,37 +11,70 @@ Run `dotnet tool update -g IntelliTect.EssentialCSharp.ListingManager`. This wil
11
11
12
12
# Usage
13
13
14
-
Any command can be run with these optional parameters.
14
+
Run `ListingManager` from the command line.
15
15
16
-
-`verbose` -> provides more detail into what the command is doing
16
+
For available commands run `ListingManager -h`. This will display all the commands available to you.
17
17
18
-
`ListingUpdating` can be run with the following additional optional parameters.
18
+
## Update Command
19
19
20
-
-`preview` -> leave files in place but still print actions that would take place to console
21
-
-`by-folder` -> changes a listing's chapter based on the chapter number in the chapter's path
22
-
-`chapter-only` -> changes only the chapter of the listing, leaving the listing number unchanged. Use with `byfolder`
20
+
The `update` command updates namespaces and filenames for all listings and accompanying tests within a chapter.
23
21
24
-
Run `ListingManager` from the command line.
22
+
### Basic Usage
25
23
26
-
For available commands run `ListingManager -h`. This will display all the commands available to you.
24
+
```bash
25
+
ListingManager update <directoryIn>
26
+
```
27
+
28
+
### Optional Parameters
29
+
30
+
-`--verbose` -> Displays more detailed messages in the log
31
+
-`--preview` -> Displays the changes that will be made without actually making them
32
+
-`--by-folder` -> Updates namespaces and filenames for all listings and accompanying tests within a folder
33
+
-`--single-dir` -> All listings are in a single directory and not separated into chapter and chapter test directories
34
+
-`--all-chapters` -> The passed in path is the parent directory to many chapter directories rather than a single chapter directory
35
+
-`--git` -> Use git mv for moving files instead of OS file operations. Requires the directory to be in a git repository. This preserves git history for renamed files.
0 commit comments