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

Wrong commit order when checking out buggy revision #324

Closed
GabrieleMaurina opened this issue Apr 20, 2020 · 6 comments
Closed

Wrong commit order when checking out buggy revision #324

GabrieleMaurina opened this issue Apr 20, 2020 · 6 comments

Comments

@GabrieleMaurina
Copy link

Hi,
I am getting a wrong git history when checking out a buggy commit.

I executed:

defects4j checkout -p Lang -v 1b -w ./lang_1_buggy
cd lang_1_buggy
git log --oneline

and I got this:

5ad71ec7 (HEAD, tag: D4J_Lang_1_BUGGY_VERSION) D4J_Lang_1_BUGGY_VERSION
4058d66a (tag: D4J_Lang_1_FIXED_VERSION) D4J_Lang_1_FIXED_VERSION
32533071 (tag: D4J_Lang_1_POST_FIX_REVISION) D4J_Lang_1_POST_FIX_REVISION
687b2e62 LANG-747 NumberUtils does not handle Long Hex numbers
...

As you can see BUGGY, FIXED and POST_FIX revisions are in the wrong order, infact the fix comes before the bug in the git history.

I am showing this because I am interested in the real commit that preceded BUGGY. Normally I would just do git checkout HEAD^, however in this case it would get me to FIXED_VERSION, which is not what I want. Would you know if the commit before POST_FIX, in this case 687b2e62, is the actual commit that preceded BUGGY?

Thanks,
Gabriele

@GabrieleMaurina GabrieleMaurina changed the title Wrong commit order when checking out bug version Wrong commit order when checking out buggy revision Apr 20, 2020
@mernst
Copy link
Collaborator

mernst commented Apr 20, 2020

The tags D4J_Lang_1_BUGGY_VERSION, D4J_Lang_1_FIXED_VERSION, and D4J_Lang_1_POST_FIX_REVISION are on versions that might have fixes compared to the historical version of the software, such as removing tests that fail. This is what you need in order to do experiments in testing. Their order is arbitrary, so you should not use HEAD^1 on them. (Perhaps they should be created in a different order, but not if that would encourage people to use HEAD^1.)

If you want to examine the actual development history, then use the commit ids listed in the commit-db file. For Lang-1, that line is:

1,2c454a4ce3fe771098746879b166ede2284b94f4,687b2e62b7c6e81cd9d5c872b7fa9cc8fd3f1509,LANG-747,https://issues.apache.org/jira/browse/LANG-747

and so you can do a diff between the two given commits, and you can look at commits before them in the version history.
Does that help you solve your problem?

@GabrieleMaurina
Copy link
Author

Ok, I see.

So the two given hashes in commit-db are the hash of the real buggy commit and the hash of the real fixed commit?

@mernst
Copy link
Collaborator

mernst commented Apr 20, 2020

That is correct, according to https://homes.cs.washington.edu/~rjust/defects4j/html_doc/Vcs.html.

@GabrieleMaurina
Copy link
Author

Perfect, this solves my issue. Thank you.

On a side note: is there an easy way to get the name of test class that failed when ran on the buggy revision?

@rjust
Copy link
Owner

rjust commented Apr 23, 2020

You can use the defects4j info command to print the class and method name of the triggering test for any bug in Defects4J. Note that PR #312 will provide a richer query mechanism that allows you to query Defects4J internals.

You can also export the triggering test with the defects4j export command when you have a bug checked out to a working directory.

Hope this helps.

@GabrieleMaurina
Copy link
Author

This is perfect, thank you.

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

3 participants