simonw / git-history

Tools for analyzing Git history using SQLite
Apache License 2.0
191 stars 18 forks source link

Confirm if this works with repos with branches in the history #46

Open simonw opened 2 years ago

simonw commented 2 years ago

I couldn't get this to work, and I have a hunch it may be because that repository uses branches and doesn't have a linear history:

git-history file iam.db \
  policy_sentry/shared/data/iam-definition.json \
  --id service --id privilege \
  --convert '
data = json.loads(content)
for service, stuff in data.items():
    for _, privilege in stuff["privileges"].items():
        privilege["service"] = service
        yield privilege
' --branch master

Against https://github.com/salesforce/policy_sentry

Originally posted by @simonw in https://github.com/simonw/iam-definitions-datasette/issues/1#issuecomment-989271347

simonw commented 2 years ago

Visualization of the branches over time: https://github.com/salesforce/policy_sentry/network

simonw commented 2 years ago

I'm suspicious that this code isn't iterating across every commit: https://github.com/simonw/git-history/blob/1a2b0b82d73edbe4ffdbf00be1c984ee28cca589/git_history/cli.py#L15-L16

I added some debug logging and I couldn't see it visit any commits which included versions of the policy_sentry/shared/data/iam-definition.json file.