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

correctness issues in Git tag parsing #2766

Open
vladak opened this issue May 5, 2019 · 1 comment
Open

correctness issues in Git tag parsing #2766

vladak opened this issue May 5, 2019 · 1 comment

Comments

@vladak
Copy link
Contributor

@vladak vladak commented May 5, 2019

When working on a fix for #2755 I noticed that tags are being handled that cannot be used anyway, e.g. tags of disconnected changesets. Similarly, per-branch tags should be constrained to the checked out branch.

@vladak
Copy link
Contributor Author

@vladak vladak commented May 17, 2019

The trouble with tags in this context is that they are not tied to any branch. So, for each tag in the list it would be necessary to determine if they are reachable from HEAD on the same branch, something like:

$ git log --all --graph
* commit 046a9e99e4571f6ef651f2db6c44c89fc78ea628 (HEAD -> master)
| Author: Vladimir Kotal <vlada@devnull.cz>
| Date:   Thu May 16 17:00:17 2019 +0200
| 
|     another
| 
* commit 28b0e9c0bdd5cc1d85d9324a81c5ef35d94aa2dc (tag: masteronly)
| Author: Vladimir Kotal <vlada@devnull.cz>
| Date:   Thu May 16 16:59:10 2019 +0200
| 
|     still in master
|   
| * commit d93c6bcafab0acfa2e343b02eb3ae5425e9ddc5f (tag: branched, mybranch)
|/  Author: Vladimir Kotal <vlada@devnull.cz>
|   Date:   Thu May 16 16:58:40 2019 +0200
|   
|       in branch
| 
* commit b52709fd32a42b179cde44c20ff0a7b8cfb9bd63 (tag: historical)
| Author: Vladimir Kotal <vlada@devnull.cz>
| Date:   Thu May 16 16:57:42 2019 +0200
| 
|     another
| 
* commit 4431c0a74007d339ba8a78af7202ca8c23cddd93 (tag: initial)
  Author: Vladimir Kotal <vlada@devnull.cz>
  Date:   Thu May 16 16:57:34 2019 +0200
  
      foo
$ git rev-list --branches=master --ancestry-path --count initial..HEAD
3
$ git rev-list --branches=master --ancestry-path --count historical..HEAD
2
$ git rev-list --branches=master --ancestry-path --count branched..HEAD
0
$ git rev-list --branches=master --ancestry-path --count masteronly..HEAD
1

I.e. the branched tag is unwanted since the count of "common" changesets is zero.

Of course, running one more command would add to the complexity (and the git rev-list command most probably has some non-trivial complexity for large repositories too). In addition to that, --ancestry-path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.