How to disable automatic commits of .gitignore files?
Asked Answered
O

3

11

We have a test team using Hp Unified Functional Testing. The test and development teams all share the same Git repository. No one in the test team uses the Git capabilities in HP-UFT, files are commited and pushed outside the tool.

Despite this, HP-UFT (automatically) creates and performs commits of .gitignore files, looking like below. The commits seems to be on a per-project basis, and are cluttering the git log.

#UFT ignore section
*.lck
/Res*
#end UFT ignore section

The commits are not automatically pushed.

The commit message is the same for all commits (and is not very informative):

UFT Commit

How can this wierd behaviour be disabled in Hp Unified Functional Testing (version 12.51)? To be extra clear, what I am looking for is a way to make the tool not perform these commits. I know these files and folders should be ignored, but I would rather manage one single .gitignore file further up in the folder hierarchy.

Googling or reading the User Guide has not been to any help.


I put a bounty on this question, specifying that I would like an answer containing either:

  • A way to disable these commits from the tool itself. I know I can do workarounds with git hooks, and other solutions.
  • A link to a trustworthy source specifying that it is not possible to disable this behaviour from the tool.

After the bounty expired, no answer fulfills these conditions, therefore I am trying to clarify what kind of answers I want.

Oppugn answered 7/10, 2016 at 7:0 Comment(5)
Maybe a clean filter would convince Git that those .gitignore files have not actually changed? (as in https://mcmap.net/q/1158647/-ignoring-certain-xml-lines-when-merging)Revitalize
@Revitalize A good idea, but maybe I wasn't clear enough in my question after all. The tool creates new .gitignore files. I am looking for a way to avoid this.Oppugn
How about ignoring the git ignore files?Revitalize
(example: https://mcmap.net/q/12437/-how-can-i-stop-gitignore-from-appearing-in-the-list-of-untracked-files)Revitalize
@Revitalize That would be an alternative, although it is a work-around. Ideally I am looking for a way for the UFT tool to stop this behaviour. I understand, however, that probably more "git people" hang around here than "UFT people". (including myself)Oppugn
O
2

Both the answers by mpril and VonC are correct in the way that it doesn't seem to exist a straightforward way to disable the automatic commits of the files from HP-UFT. So the Git way to go would be to use the solution given by VonC and add a Git hook forcing these commits to be ignored.


However, we succesfully found out a workaround in HP-UFT which in my opinion feels better:

The addin for Git is located in HP-UFT-INSTALLATION-DIRECTORY/addins/VersionControlSystem. Changing the name of this folder to, for example, VersionControlSystem_backup (or simply remove the folder) makes sure HP-UFT does not perform these unwanted commits.

Of course, it would be prefered if there was a setting inside the application to disable the addin, but it doesn't seem to exist. Hopefully HP will fix this (or preferably the root cause with unwanted commits) in future releases of the application.

Oppugn answered 8/11, 2016 at 13:52 Comment(0)
F
2

There is no straight way to avoid this behaviour in UFT. Actually, you can add your own ignoring rules under "UFT" section. For instance, you can add line

'!/Res1' 

and theoretically this will allow to commit '/Res1' folder. Or, you can give another name for Result folder and freely commit it. Only keep in mind that the .lck file shouldn't get to common repository.

And why you need in repository the results of tests from the local machine?

Furbish answered 10/10, 2016 at 9:57 Comment(2)
I don't use the tool myself, but to me it seems very wierd that it performs commits "secretly" under the hood. I am not looking for a way to commit these folders, but what if we would like to have a single .gitignore file higher up in the folder hierarchy? There is no need to have an ignore file per project.Oppugn
Do you have any "proof" for this? Documentation or some other source?Oppugn
R
2

I don't know UFT, but if you have access to the git repo managed by that tool, you might consider setting up a git pre-commit hook (in .git/hooks/pre-commit), similar to "Use git pre-commit hooks to stop unwanted commits" by Jake McCrary (the script is just an example, and will need to be adapted to your case).

The idea is to look for the list of files which are about to be committed

git diff --cached --name-only --diff-filter=ACM

If that list includes only .gitignore files, you reject the commit.

Revitalize answered 19/10, 2016 at 7:55 Comment(4)
I don't know UFT either, but ideally I want to avoid doing a git workaround (as I stated in the bounty description). Anyway, we might need to fallback to a solution like this. The hook would need to be a bit more sophisticated though, since we would like to allow other commits of .gitignore files.Oppugn
@Oppugn Is the commit message (for those unwanted commits) always the same? Is so, the pre-commit hook can be fairly simple, and reject any commit with an unwanted message.Revitalize
Yes it is, I actually stated this in the question. That was also the first thing I thought about. Taking this with me.Oppugn
@Oppugn let's hope an actual "UFT" person will have more to say, but as a "Git person", that would be my approach ;)Revitalize
O
2

Both the answers by mpril and VonC are correct in the way that it doesn't seem to exist a straightforward way to disable the automatic commits of the files from HP-UFT. So the Git way to go would be to use the solution given by VonC and add a Git hook forcing these commits to be ignored.


However, we succesfully found out a workaround in HP-UFT which in my opinion feels better:

The addin for Git is located in HP-UFT-INSTALLATION-DIRECTORY/addins/VersionControlSystem. Changing the name of this folder to, for example, VersionControlSystem_backup (or simply remove the folder) makes sure HP-UFT does not perform these unwanted commits.

Of course, it would be prefered if there was a setting inside the application to disable the addin, but it doesn't seem to exist. Hopefully HP will fix this (or preferably the root cause with unwanted commits) in future releases of the application.

Oppugn answered 8/11, 2016 at 13:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.