$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/ubuntu/test/.git/
$ git config --global user.email "<email address hidden>"
$ git config --global user.name "Your Name"
$ echo contents > original-file.txt
$ git add original-file.txt
$ git commit -m "Creating the file"
[master (root-commit) 0a02f82] Creating the file
1 file changed, 1 insertion(+)
create mode 100644 original-file.txt
$ echo foo > new-file.txt
$ echo contents2 > original-file.txt
$ git stash push -u
Saved working directory and index state WIP on master: 0a02f82 Creating the file
$ echo contents3 > original-file.txt
$ git commit -am "Altering the file"
[master 4533623] Altering the file
1 file changed, 1 insertion(+), 1 deletion(-)
$ git stash pop
Auto-merging original-file.txt
CONFLICT (content): Merge conflict in original-file.txt
The stash entry is kept in case you need it again.
$ cat new-file.txt
cat: new-file.txt: No such file or directory
Upon conflict we don't get a full explanation of what is outstanding such as
"unmerged paths" and "untracked files". The untracked file of new-file.txt is
missing and has not been restored to the working directory.
I then enabled -proposed and installed git 2.34.1-1ubuntu1.10 and re-ran the
reproducer:
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/ubuntu/proposed/.git/
$ echo contents > original-file.txt
$ git add original-file.txt
$ git commit -m "Creating the file"
[master (root-commit) 0508716] Creating the file
1 file changed, 1 insertion(+)
create mode 100644 original-file.txt
$ echo foo > new-file.txt
$ echo contents2 > original-file.txt
$ git stash push -u
Saved working directory and index state WIP on master: 0508716 Creating the file
$ echo contents3 > original-file.txt
$ git commit -am "Altering the file"
[master b6d8396] Altering the file
1 file changed, 1 insertion(+), 1 deletion(-)
$ git stash pop
Auto-merging original-file.txt
CONFLICT (content): Merge conflict in original-file.txt
On branch master
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: original-file.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
new-file.txt
no changes added to commit (use "git add" and/or "git commit -a")
The stash entry is kept in case you need it again.
$ cat new-file.txt
foo
This time we get the inline "git status" when the conflict arises, and the
untracked file is restored correctly, along with its contents.
The unit test also executes correctly, if we examine the buildlog:
...
expecting success of 3903.111 'restore untracked files even when we hit conflicts':
git init restore_untracked_after_conflict &&
(
cd restore_untracked_after_conflict &&
echo hi >a &&
echo there >b &&
git add . &&
git commit -m first &&
echo hello >a &&
echo something >c &&
git stash push --include-untracked &&
echo conflict >a &&
git add a &&
git commit -m second &&
test_must_fail git stash pop &&
test_path_is_file c
)
Initialized empty Git repository in /<<PKGBUILDDIR>>/t/trash directory.t3903-stash/restore_untracked_after_conflict/.git/
[main (root-commit) 1dc9add] first
Author: A U Thor <email address hidden>
2 files changed, 2 insertions(+)
create mode 100644 a
create mode 100644 b
Saved working directory and index state WIP on main: 1dc9add first
[main 9e228ae] second
Author: A U Thor <email address hidden>
1 file changed, 1 insertion(+), 1 deletion(-)
Merging Updated upstream with Stashed changes
Merging:
virtual Updated upstream
virtual Stashed changes
found 1 common ancestor:
virtual c017b915e83a1d32cc014487285a63a4712e6201
Auto-merging a
CONFLICT (content): Merge conflict in a
On branch main
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: a
Untracked files:
(use "git add <file>..." to include in what will be committed)
c
no changes added to commit (use "git add" and/or "git commit -a")
The stash entry is kept in case you need it again.
ok 111 - restore untracked files even when we hit conflicts
...
The package in -proposed fixes the issue. Happy to mark as verified for Jammy.
Performing verification for Jammy. I installed git 2.34.1-1ubuntu1.9 from -updates:
$ sudo apt-cache policy git | grep Installed
Installed: 1:2.34.1-1ubuntu1.9
Running the reproducer:
$ git init test/.git/
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/ubuntu/
$ git config --global user.email "<email address hidden>"
$ git config --global user.name "Your Name"
$ echo contents > original-file.txt
$ git add original-file.txt
$ git commit -m "Creating the file"
[master (root-commit) 0a02f82] Creating the file
1 file changed, 1 insertion(+)
create mode 100644 original-file.txt
$ echo foo > new-file.txt
$ echo contents2 > original-file.txt
$ git stash push -u
Saved working directory and index state WIP on master: 0a02f82 Creating the file
$ echo contents3 > original-file.txt
$ git commit -am "Altering the file"
[master 4533623] Altering the file
1 file changed, 1 insertion(+), 1 deletion(-)
$ git stash pop
Auto-merging original-file.txt
CONFLICT (content): Merge conflict in original-file.txt
The stash entry is kept in case you need it again.
$ cat new-file.txt
cat: new-file.txt: No such file or directory
Upon conflict we don't get a full explanation of what is outstanding such as
"unmerged paths" and "untracked files". The untracked file of new-file.txt is
missing and has not been restored to the working directory.
I then enabled -proposed and installed git 2.34.1-1ubuntu1.10 and re-ran the
reproducer:
$ sudo apt-cache policy git | grep Installed 1-1ubuntu1. 10
Installed: 1:2.34.
$ git init proposed/ .git/
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/ubuntu/
$ echo contents > original-file.txt
$ git add original-file.txt
$ git commit -m "Creating the file"
[master (root-commit) 0508716] Creating the file
1 file changed, 1 insertion(+)
create mode 100644 original-file.txt
$ echo foo > new-file.txt
$ echo contents2 > original-file.txt
$ git stash push -u
Saved working directory and index state WIP on master: 0508716 Creating the file
$ echo contents3 > original-file.txt
$ git commit -am "Altering the file"
[master b6d8396] Altering the file
1 file changed, 1 insertion(+), 1 deletion(-)
$ git stash pop
Auto-merging original-file.txt
CONFLICT (content): Merge conflict in original-file.txt
On branch master
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: original-file.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
new-file.txt
no changes added to commit (use "git add" and/or "git commit -a")
The stash entry is kept in case you need it again.
$ cat new-file.txt
foo
This time we get the inline "git status" when the conflict arises, and the
untracked file is restored correctly, along with its contents.
The unit test also executes correctly, if we examine the buildlog:
https:/ /launchpadlibra rian.net/ 681062898/ buildlog_ ubuntu- jammy-amd64. git_1%3A2. 34.1-1ubuntu1. 10_BUILDING. txt.gz
... untracked_ after_conflict && untracked_ after_conflict &&
expecting success of 3903.111 'restore untracked files even when we hit conflicts':
git init restore_
(
cd restore_
echo hi >a &&
echo there >b &&
git add . &&
git commit -m first &&
echo hello >a &&
echo something >c &&
git stash push --include-untracked &&
echo conflict >a &&
git add a &&
git commit -m second &&
test_must_fail git stash pop &&
test_path_is_file c
)
Initialized empty Git repository in /<<PKGBUILDDIR> >/t/trash directory. t3903-stash/ restore_ untracked_ after_conflict/ .git/ 2cc014487285a63 a4712e6201
[main (root-commit) 1dc9add] first
Author: A U Thor <email address hidden>
2 files changed, 2 insertions(+)
create mode 100644 a
create mode 100644 b
Saved working directory and index state WIP on main: 1dc9add first
[main 9e228ae] second
Author: A U Thor <email address hidden>
1 file changed, 1 insertion(+), 1 deletion(-)
Merging Updated upstream with Stashed changes
Merging:
virtual Updated upstream
virtual Stashed changes
found 1 common ancestor:
virtual c017b915e83a1d3
Auto-merging a
CONFLICT (content): Merge conflict in a
On branch main
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: a
Untracked files:
(use "git add <file>..." to include in what will be committed)
c
no changes added to commit (use "git add" and/or "git commit -a")
The stash entry is kept in case you need it again.
ok 111 - restore untracked files even when we hit conflicts
...
The package in -proposed fixes the issue. Happy to mark as verified for Jammy.