Facing issue with Generate Changelog process

I am using Liquibase Version: 4.28.0 i.e. Liquibase Open Source 4.28.0 by Liquibase.
I am trying to migrate an existing Oracle DB to MySQL with changelog being generated in XML format. I find the “generate-changelog” process behaves erratically. Below are my observations -

  1. with blank target schema, generates changelog
  2. with blank target schema, doesn’t generate changelog
  3. with synced up target schema and truncated “DATABASECHANGELOG” and xml file removed, generates changelog
    I don’t find any reason for result 1 & 2 above. Does Liquibase make any updates in reference DB schema? or in file system? Apart from keeping the changes stored in target DB (table name DATABASECHANGELOG).
    Can you please help me with the list of steps that gets executed while running “generate-changelog”

Just to add here, another observation - for case 1, it finds changeset count >0 whereas for case 2, it finds changeset count as 0. My question - how does liquibase caculate changeset? for both the cases there is no data in DBChangelog table.