Skip to content

If the tag contains 00, it will break there #113

@sounisi5011

Description

@sounisi5011

I tried to push the following tag: v72.94001.10
However, the tag passed to the tag event was the following value:

const { Git } = require('node-git-server');

const repos = new Git('path/to/tmp', {
  autoCreate: true,
});

repos.on('tag', (tag) => {
  // tag.version === 'v72.94' // What!?
});

repos.listen(49152, { type: 'http' }, () => {
  // ...
});
repos.server.on('error', err => { throw err });

Apparently, tag names are cut off when 00 is encountered.
I have looked into the reason for this and found the following regular expression to be the cause.

'receive-pack': '([0-9a-fA-F]+) ([0-9a-fA-F]+) refs\/(heads|tags)\/(.*?)( |00|\u0000)|^(0000)$', // eslint-disable-line

This pattern is defined so that tag names after spaces, null characters, or 00 are not retrieved.
Why? Tag names (and branch names) can contain 00. What is the reason for excluding anything after 00?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions