-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The interactive staging, where you can stage by chunks/lines does not appear to work.
To Reproduce
Steps to reproduce the behavior:
- Create an empty repository
git init
. - Create a file containing two lines.
line one
line two
- Commit the file.
- Edit the file.
line one and something
line two
line three
- Select the file and press enter to go the staging view.
- Select the first chunk
line one and something
. - Stage the chunk
Screenshots
Screen.Recording.2025-02-04.at.6.36.57.pm.mov
Version info:
~/g/lazygit-interactive-staging-repro (master)> lazygit --version
commit=, build date=, build source=homebrew, version=0.45.2, os=darwin, arch=arm64, git version=2.48.1
~/g/lazygit-interactive-staging-repro (master)> git --version
git version 2.48.1
Additional context
OS: MacOS
Terminal Emulator: Ghostty
Shell: fish
I have used git add -p
to stage the first chunk.
~/g/lazygit-interactive-staging-repro (master)> git diff
diff --git a/test.txt b/test.txt
index e5c5c55..9b53c18 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,3 @@
-line one
+line one and something
line two
+line three
~/g/lazygit-interactive-staging-repro (master)> git add -p test.txt
diff --git a/test.txt b/test.txt
index e5c5c55..9b53c18 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,3 @@
-line one
+line one and something
line two
+line three
(1/1) Stage this hunk [y,n,q,a,d,s,e,p,?]? e
~/g/lazygit-interactive-staging-repro (master)> git diff --cached
diff --git a/test.txt b/test.txt
index e5c5c55..92186d0 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,2 @@
-line one
+line one and something
line two
I then used git diff --cached > p.patch
to make patch that should be similar to what I imagine lazygit is using.
~/g/lazygit-interactive-staging-repro (master)> git diff --cached > p.patch
~/g/lazygit-interactive-staging-repro (master)> cat p.patch
diff --git a/test.txt b/test.txt
index e5c5c55..92186d0 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,2 @@
-line one
+line one and something
line two
I then reset the staging area with git restore --staged test.txt
.
~/g/lazygit-interactive-staging-repro (master)> git restore --staged test.txt
~/g/lazygit-interactive-staging-repro (master)> git diff
diff --git a/test.txt b/test.txt
index e5c5c55..9b53c18 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,3 @@
-line one
+line one and something
line two
+line three
Finally I used git apply --cached p.patch
and the patch was applied succesfully.
~/g/lazygit-interactive-staging-repro (master)> git apply --cached p.patch
~/g/lazygit-interactive-staging-repro (master)> git diff
diff --git a/test.txt b/test.txt
index 92186d0..9b53c18 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,3 @@
line one and something
line two
+line three
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working