Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reftable in jgit doesn't respect changes outside of jgit #102

Open
zotttelbart opened this issue Oct 20, 2024 · 0 comments
Open

reftable in jgit doesn't respect changes outside of jgit #102

zotttelbart opened this issue Oct 20, 2024 · 0 comments

Comments

@zotttelbart
Copy link

Version

7.0.0

Operating System

Windows

Bug description

Changes on reftable outside of jgit (example gitbash) are not visible for jgit

Actual behavior

` Git git = Git.init().setDirectory(new File("c:\temp\jgit")).call();

	git.remoteAdd().setUri(new URIish("https://github.com/eclipse-jgit/jgit.git")).setName("origin").call();
	git.fetch().setRemote("origin").setProgressMonitor(new TextProgressMonitor()).call();
	git.checkout().setName("master").setStartPoint("origin/master").setCreateBranch(true).call();
	((FileRepository) git.getRepository()).convertRefStorage("reftable", true, false);
	

	git.tag().setName("foo").call();
	System.out.println(git.getRepository().findRef("foo"));

	System.out.println("Now change the Tag via git bash (git tag --force foo v7.0.0.202408201547-m3)");
	System.out.println("and press enter. You will see, the tag in jgit doesn't change");
	Scanner scanner = new Scanner(System.in);
	scanner.next();
	
	System.out.println(git.getRepository().exactRef("refs/tags/foo"));
	
	git.close();

`

outputs:

`Ref[refs/tags/foo=ef0923a81c00465034705a24a30b4c8d6878729f(3)]
Now change the Tag via git bash (git tag --force foo v7.0.0.202408201547-m3)
and press enter. You will see, the tag in jgit doesn't change

Ref[refs/tags/foo=ef0923a81c00465034705a24a30b4c8d6878729f(3)]
`

For jgit, the ref didn't change

output from gitbash

`$ git tag --force foo v7.0.0.202408201547-m3
Unlink of file 'C:/temp/jgit/.git/reftable/000000000003-000000000003-1b2b152a.ref' failed. Should I try again? (y/n) y
Unlink of file 'C:/temp/jgit/.git/reftable/000000000003-000000000003-1b2b152a.ref' failed. Should I try again? (y/n) y
Unlink of file 'C:/temp/jgit/.git/reftable/000000000003-000000000003-1b2b152a.ref' failed. Should I try again? (y/n) n
Unlink of file 'C:/temp/jgit/.git/reftable/000000000003-000000000003-1b2b152a.ref' failed. Should I try again? (y/n) n
Updated tag 'foo' (was ef0923a81)

$ git show-ref | grep foo
727666694e80ed39488451503d72f65bb4ef69f8 refs/tags/foo
`

you see #101 but the ref is changed

Expected behavior

Changes on tables.list should call

ReftableDatabase.clearCache() and
FileReftableStack.reload()

in FileReftableDatabase

Relevant log output

No response

Other information

I hope, this helps to improve jgit :)

@zotttelbart zotttelbart changed the title ref-table in jgit doesn't respect changes outside of jgit reftable in jgit doesn't respect changes outside of jgit Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant